Fix roll dep to use update-index

This change updates roll-dep to update submodule revision using `git update-index` instead of `git add` to stay consistent with our design.

Fix: 1406766
Change-Id: Ic23b9758a5893ac211d459a3c451bb102d4501a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4177144
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
changes/44/4177144/2
Aravind Vasudevan 2 years ago committed by LUCI CQ
parent 474e28e576
commit a111c9189d

@ -210,12 +210,16 @@ def finalize(commit_msg, current_dir, rolls):
# Pull the dependency to the right revision. This is surprising to users
# otherwise. The revision update is done before commiting to update
# submodule revision if present.
for _head, roll_to, full_dir in sorted(rolls.values()):
for dependency, (_head, roll_to, full_dir) in sorted(rolls.items()):
check_call(['git', 'checkout', '--quiet', roll_to], cwd=full_dir)
# This adds the submodule revision update to the commit.
if is_submoduled():
check_call(['git', 'add', full_dir])
check_call([
'git', 'update-index', '--add', '--cacheinfo', '160000,{},{}'.format(
roll_to, dependency)
],
cwd=current_dir)
check_call(['git', 'add', 'DEPS'], cwd=current_dir)
# We have to set delete=False and then let the object go out of scope so

Loading…
Cancel
Save