mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-03-31 14:09:28 +00:00
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>
This commit is contained in:
parent
8d5f032611
commit
fc901b92bb
@ -1999,6 +1999,8 @@ def _PostRepoFetch(rp, repo_verify=True, verbose=False):
|
||||
# We also have to make sure this will switch to an older commit if
|
||||
# that's the latest tag in order to support release rollback.
|
||||
try:
|
||||
# Refresh index since reset --keep won't do it.
|
||||
rp.work_git.update_index("-q", "--refresh")
|
||||
rp.work_git.reset("--keep", new_rev)
|
||||
except GitError as e:
|
||||
raise RepoUnhandledExceptionError(e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user