mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
project: fix m/ generation when switching manifest branches
We were updating the per-checkout m/ pseudo ref when syncing, but we only created the common m/ redirect when initializing a project for the first time. This is fine unless the user switches the manifest branch in an existing project, then we never create that redirect. Bug: https://crbug.com/gerrit/14468 Change-Id: I5325e7e602dcb4ce150bef258901ba5e9fdea461 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/304822 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
3b038cecc4
commit
29626b4f46
16
project.py
16
project.py
@ -2443,14 +2443,6 @@ class Project(object):
|
||||
self.bare_objdir.init()
|
||||
|
||||
if self.use_git_worktrees:
|
||||
# Set up the m/ space to point to the worktree-specific ref space.
|
||||
# We'll update the worktree-specific ref space on each checkout.
|
||||
if self.manifest.branch:
|
||||
self.bare_git.symbolic_ref(
|
||||
'-m', 'redirecting to worktree scope',
|
||||
R_M + self.manifest.branch,
|
||||
R_WORKTREE_M + self.manifest.branch)
|
||||
|
||||
# Enable per-worktree config file support if possible. This is more a
|
||||
# nice-to-have feature for users rather than a hard requirement.
|
||||
if git_require((2, 20, 0)):
|
||||
@ -2587,6 +2579,14 @@ class Project(object):
|
||||
def _InitMRef(self):
|
||||
if self.manifest.branch:
|
||||
if self.use_git_worktrees:
|
||||
# Set up the m/ space to point to the worktree-specific ref space.
|
||||
# We'll update the worktree-specific ref space on each checkout.
|
||||
ref = R_M + self.manifest.branch
|
||||
if not self.bare_ref.symref(ref):
|
||||
self.bare_git.symbolic_ref(
|
||||
'-m', 'redirecting to worktree scope',
|
||||
ref, R_WORKTREE_M + self.manifest.branch)
|
||||
|
||||
# We can't update this ref with git worktrees until it exists.
|
||||
# We'll wait until the initial checkout to set it.
|
||||
if not os.path.exists(self.worktree):
|
||||
|
Loading…
Reference in New Issue
Block a user