summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2021-05-01 09:37:13 -0400
committerMike Frysinger <vapier@google.com>2021-05-02 00:05:55 +0000
commit29626b4f463d12186d9ce96e07063214347ead18 (patch)
treed319df618fdfa30687d833fd79ee81efdee41257
parent3b038cecc4ff189f9f7263adc5f8bf1ae62f3380 (diff)
downloadgit-repo-29626b4f463d12186d9ce96e07063214347ead18.tar.gz
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>
-rw-r--r--project.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/project.py b/project.py
index 94c13785..f05ce66a 100644
--- a/project.py
+++ b/project.py
@@ -2443,14 +2443,6 @@ class Project(object):
2443 self.bare_objdir.init() 2443 self.bare_objdir.init()
2444 2444
2445 if self.use_git_worktrees: 2445 if self.use_git_worktrees:
2446 # Set up the m/ space to point to the worktree-specific ref space.
2447 # We'll update the worktree-specific ref space on each checkout.
2448 if self.manifest.branch:
2449 self.bare_git.symbolic_ref(
2450 '-m', 'redirecting to worktree scope',
2451 R_M + self.manifest.branch,
2452 R_WORKTREE_M + self.manifest.branch)
2453
2454 # Enable per-worktree config file support if possible. This is more a 2446 # Enable per-worktree config file support if possible. This is more a
2455 # nice-to-have feature for users rather than a hard requirement. 2447 # nice-to-have feature for users rather than a hard requirement.
2456 if git_require((2, 20, 0)): 2448 if git_require((2, 20, 0)):
@@ -2587,6 +2579,14 @@ class Project(object):
2587 def _InitMRef(self): 2579 def _InitMRef(self):
2588 if self.manifest.branch: 2580 if self.manifest.branch:
2589 if self.use_git_worktrees: 2581 if self.use_git_worktrees:
2582 # Set up the m/ space to point to the worktree-specific ref space.
2583 # We'll update the worktree-specific ref space on each checkout.
2584 ref = R_M + self.manifest.branch
2585 if not self.bare_ref.symref(ref):
2586 self.bare_git.symbolic_ref(
2587 '-m', 'redirecting to worktree scope',
2588 ref, R_WORKTREE_M + self.manifest.branch)
2589
2590 # We can't update this ref with git worktrees until it exists. 2590 # We can't update this ref with git worktrees until it exists.
2591 # We'll wait until the initial checkout to set it. 2591 # We'll wait until the initial checkout to set it.
2592 if not os.path.exists(self.worktree): 2592 if not os.path.exists(self.worktree):