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>
diff --git a/git_cl.py b/git_cl.py
index 9d1b861..311b637 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -3473,8 +3473,9 @@
DieWithError('Running editor failed')
lines = content.splitlines()
- # Strip off comments.
- clean_lines = [line.rstrip() for line in lines if not line.startswith('#')]
+ # Strip off comments and default inserted "Bug:" line.
+ clean_lines = [line.rstrip() for line in lines if not
+ (line.startswith('#') or line.rstrip() == "Bug:")]
if not clean_lines:
DieWithError('No CL description, aborting')
self.set_description(clean_lines)