Treat "Bug:" as an empty line in git cl upload

The default description in the editor when you invoke "git cl upload"
includes recent commit descriptions, some blank lines and comments, and
"Bug: ". The upload script properly strips out the comments but was
leaving in the "Bug:" line. This leads to CLs with blank Bug: lines,
which is sloppy. It also means that if a user changes their mind and
closes the upload editor without adding any content... they would still
have a CL created.

This change removes the "Bug: " line if nothing has been added to it,
thus avoiding uploading a change with an empty description, and avoiding
having meaningless Bug: lines.

Change-Id: I18c2094e5712d31729899c0ebd0a52de97dc4e7f
Reviewed-on: https://chromium-review.googlesource.com/861920
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
changes/20/861920/2
Bruce Dawson 8 years ago committed by Commit Bot
parent da669d6123
commit 2377b01e6c

@ -3473,8 +3473,9 @@ class ChangeDescription(object):
DieWithError('Running editor failed') DieWithError('Running editor failed')
lines = content.splitlines() lines = content.splitlines()
# Strip off comments. # Strip off comments and default inserted "Bug:" line.
clean_lines = [line.rstrip() for line in lines if not line.startswith('#')] clean_lines = [line.rstrip() for line in lines if not
(line.startswith('#') or line.rstrip() == "Bug:")]
if not clean_lines: if not clean_lines:
DieWithError('No CL description, aborting') DieWithError('No CL description, aborting')
self.set_description(clean_lines) self.set_description(clean_lines)

Loading…
Cancel
Save