git cl issue 0: Remove Change-Id from message, not description
Using self.GetDescription() uses the description from the web.
Given that the user is purposefully disassociating their current
branch from the review on the web, they may have already changed
the commit message. We shouldn't set it back.
Bug: 742730
Change-Id: I0545cb6288c332fd475d1de7fb302f71ee41a415
Reviewed-on: https://chromium-review.googlesource.com/578229
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index 2c4b4bf..4444135 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -1471,12 +1471,6 @@
self._codereview_impl.CodereviewServerConfigKey(),
codereview_server)
else:
- desc = self.GetDescription()
- if desc and git_footers.get_footer_change_id(desc):
- print('WARNING: The change patched into this branch has a Change-Id. '
- 'Removing it.')
- RunGit(['commit', '--amend', '-m',
- git_footers.remove_footer(desc, 'Change-Id')])
# Reset all of these just to be clean.
reset_suffixes = [
'last-upload-hash',
@@ -1486,6 +1480,12 @@
] + self._PostUnsetIssueProperties()
for prop in reset_suffixes:
self._GitSetBranchConfigValue(prop, None, error_ok=True)
+ msg = RunGit(['log', '-1', '--format=%B']).strip()
+ if msg and git_footers.get_footer_change_id(msg):
+ print('WARNING: The change patched into this branch has a Change-Id. '
+ 'Removing it.')
+ RunGit(['commit', '--amend', '-m',
+ git_footers.remove_footer(msg, 'Change-Id')])
self.issue = None
self.patchset = None