Browse Source

Remove unnecessary RunHook call for squash mode.

RunHook being called at the beginning of the git cl upload command, is necessary for non-squash mode, but is an extra and unnecessary call for squash mode. This Runhook call can be moved later down the call stack as well, but would require a lot more changes to tests (in what needs to be mocked)

Change-Id: I0373c5de84d98c4e8c39dece95a247227562ab82
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6181588
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Joanna Wang 7 months ago
parent
commit
a1fd773224
1 changed files with 4 additions and 1 deletions
  1. 4 1
      git_cl.py

+ 4 - 1
git_cl.py

@@ -2187,7 +2187,10 @@ class Changelist(object):
 
         change_desc = self._GetDescriptionForUpload(options, git_diff_args,
                                                     files)
-        if not options.bypass_hooks:
+
+        # For options.squash, RunHook is called once for each branch in
+        # PrepareChange().
+        if not options.bypass_hooks and not options.squash:
             hook_results = self.RunHook(committing=False,
                                         may_prompt=not options.force,
                                         verbose=options.verbose,