From db02dd0524aa0bbc2a5da29b51f04d8058381dd6 Mon Sep 17 00:00:00 2001 From: Robert Iannucci Date: Wed, 19 Apr 2017 12:18:20 -0700 Subject: [PATCH] [git-cl] modify change description before committing. Otherwise if update_reviewers needs to modify the commit message it won't show in gerrit. Bug: Change-Id: Id81db48b7d15bd17cb924d1d046b31f2c48defa7 Reviewed-on: https://chromium-review.googlesource.com/482062 Commit-Queue: Robbie Iannucci Reviewed-by: Robbie Iannucci Reviewed-by: Andrii Shyshkalov --- git_cl.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/git_cl.py b/git_cl.py index f0dba6e8e6..bd06467af2 100755 --- a/git_cl.py +++ b/git_cl.py @@ -2896,12 +2896,16 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase): assert len(change_ids) == 1 change_id = change_ids[0] + if options.reviewers or options.tbrs or options.add_owners_to: + change_desc.update_reviewers(options.reviewers, options.tbrs, + options.add_owners_to, change) + remote, upstream_branch = self.FetchUpstreamTuple(self.GetBranch()) parent = self._ComputeParent(remote, upstream_branch, custom_cl_base, options.force, change_desc) tree = RunGit(['rev-parse', 'HEAD:']).strip() ref_to_push = RunGit(['commit-tree', tree, '-p', parent, - '-m', message]).strip() + '-m', change_desc.description]).strip() else: change_desc = ChangeDescription( options.message or CreateDescriptionFromLog(git_diff_args)) @@ -2912,6 +2916,9 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase): DownloadGerritHook(False) change_desc.set_description( self._AddChangeIdToCommitMessage(options, git_diff_args)) + if options.reviewers or options.tbrs or options.add_owners_to: + change_desc.update_reviewers(options.reviewers, options.tbrs, + options.add_owners_to, change) ref_to_push = 'HEAD' # For no-squash mode, we assume the remote called "origin" is the one we # want. It is not worthwhile to support different workflows for @@ -2930,10 +2937,6 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase): 'single commit.') confirm_or_exit(action='upload') - if options.reviewers or options.tbrs or options.add_owners_to: - change_desc.update_reviewers(options.reviewers, options.tbrs, - options.add_owners_to, change) - # Extra options that can be specified at push time. Doc: # https://gerrit-review.googlesource.com/Documentation/user-upload.html refspec_opts = []