mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
project: Check references during sync
Symbolic references need to be checked each time sync is called, not only for newly created repositories. For example, it is possible to change a project name to the already existing name, and that will result in a broken git setup without this patch: refs/ will still point to the old repository, whereas all objects will point to the new repository. Bug: 40013418 Change-Id: I596d29d182986804989f0562fb45090224549b0f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/395798 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Josip Sokcevic <sokcevic@google.com> Commit-Queue: Josip Sokcevic <sokcevic@google.com>
This commit is contained in:
parent
b1d1ece2fb
commit
9b57aa00f6
15
project.py
15
project.py
@ -1277,7 +1277,20 @@ class Project:
|
||||
if is_new:
|
||||
self._InitGitDir(force_sync=force_sync, quiet=quiet)
|
||||
else:
|
||||
self._UpdateHooks(quiet=quiet)
|
||||
try:
|
||||
# At this point, it's possible that gitdir points to an old
|
||||
# objdir (e.g. name changed, but objdir exists). Check
|
||||
# references to ensure that's not the case. See
|
||||
# https://issues.gerritcodereview.com/40013418 for more
|
||||
# details.
|
||||
self._CheckDirReference(self.objdir, self.gitdir)
|
||||
|
||||
self._UpdateHooks(quiet=quiet)
|
||||
except GitError as e:
|
||||
if not force_sync:
|
||||
raise e
|
||||
# Let _InitGitDir fix the issue, force_sync is always True here.
|
||||
self._InitGitDir(force_sync=True, quiet=quiet)
|
||||
self._InitRemote()
|
||||
|
||||
if self.UseAlternates:
|
||||
|
Loading…
Reference in New Issue
Block a user