Fix squash_current_branch on dirty submodules

If there are dirty submodules, git commit -a will commit those which is
not desired. Turns out we don't need to use -a, since reset --soft
stages all changes anyways and we can just use git commit. Note that
there is a check prior to commit to ensure we are not creating an empty
commit.

R=jojwang

Fixed: 1478668
Change-Id: Iaa1ff8e638b7431511e6e194ad59e3c4adb39deb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4858836
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
changes/36/4858836/2
Josip Sokcevic 2 years ago committed by LUCI CQ
parent d4dfff088c
commit 4a4428445d

@ -980,9 +980,13 @@ def squash_current_branch(header=None, merge_base=None):
# is nothing to commit at this point.
print('Nothing to commit; squashed branch is empty')
return False
# git reset --soft will stage all changes so we can just commit those.
# Note: Just before reset --soft is called, we may have git submodules
# checked to an old commit (not latest state). We don't want to include
# those in our commit.
run('commit',
'--no-verify',
'-a',
'-F',
'-',
indata=log_msg.encode('utf-8'))

Loading…
Cancel
Save