Skip to content

Commit fc901b9

Browse files
sokcevicGLUCI
authored and
LUCI
committedMar 13, 2025·
sync: Refresh index before updating repo
If the repo index is stale, reset --keep will refuse to reset workspace. An index can be stale if there are any modifications to file node, including mtime, atime, ownership changes, etc. Bug: b/375423099 Change-Id: Ibef03d9d8d2babbb107041707281687342ab7a77 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/460022 Commit-Queue: Josip Sokcevic <sokcevic@chromium.org> Tested-by: Josip Sokcevic <sokcevic@chromium.org> Reviewed-by: Scott Lee <ddoman@google.com>
1 parent 8d5f032 commit fc901b9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed
 

‎subcmds/sync.py

+2
Original file line numberDiff line numberDiff line change
@@ -1999,6 +1999,8 @@ def _PostRepoFetch(rp, repo_verify=True, verbose=False):
19991999
# We also have to make sure this will switch to an older commit if
20002000
# that's the latest tag in order to support release rollback.
20012001
try:
2002+
# Refresh index since reset --keep won't do it.
2003+
rp.work_git.update_index("-q", "--refresh")
20022004
rp.work_git.reset("--keep", new_rev)
20032005
except GitError as e:
20042006
raise RepoUnhandledExceptionError(e)

0 commit comments

Comments
 (0)
Please sign in to comment.