'git cl issue 0': Remove Change-Id
Although git-cl-upload warns when uploading a new patchset
to a change owned by someone else, if the uploader has run
'git cl issue 0', then git-cl believes they'll be uploading
a new change, so it doesn't bother checking. However, once
the upload begins, Gerrit notices the Change-Id in the commit
message, and instead adds a new patchset to someone else's
review (if the uploader is a committer).
This change introduces some logic to git-cl-issue to also
remove any Change-Id from the commit message when a user
tries to clear the metadata about their branch.
Bug: 741648
Change-Id: I6c7c3b24a7fc09c68220c8200b732fbdf9cf1fd3
Reviewed-on: https://chromium-review.googlesource.com/568267
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index 3d3589a..2846913 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -1471,6 +1471,12 @@
self._codereview_impl.CodereviewServerConfigKey(),
codereview_server)
else:
+ desc = self.GetDescription()
+ if 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',