Clear existing Change-Ids from description if issue is 0
git cl upload may not create a new change even if issue is 0 because
of a leftover Change-Id footer in the commit message.
Bug: 1484251
Change-Id: Ibee0542e0f5a2cbf930b1882892fbb7640054b69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4880971
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
diff --git a/git_cl.py b/git_cl.py
index d1936ec..cfb6234 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -1788,6 +1788,12 @@
bug = options.bug
fixed = options.fixed
if not self.GetIssue():
+ # There isn't any issue attached, so we shouldn't keep existing
+ # Change-Ids in the description.
+ if git_footers.get_footer_change_id(description):
+ description = git_footers.remove_footer(description,
+ 'Change-Id')
+
# Extract bug number from branch name, but only if issue is being
# created. It must start with bug or fix, followed by _ or - and
# number. Optionally, it may contain _ or - after number with
@@ -1829,7 +1835,7 @@
def _GetTitleForUpload(self, options, multi_change_upload=False):
# type: (optparse.Values, Optional[bool]) -> str
- # Getting titles for multipl commits is not supported so we return the
+ # Getting titles for multiple commits is not supported so we return the
# default.
if not options.squash or multi_change_upload or options.title:
return options.title