mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-10-21 20:58:23 +00:00
project: reuse loaded refs when resolving HEAD
When the regular checkout has already loaded GitRefs, derive its current branch and HEAD object from that snapshot instead of spawning symbolic-ref or rev-parse again. Keep linked Git worktrees on their worktree-specific HEAD path because the shared repository HEAD is not authoritative for them. Bug: 543851900 Bug: 553599402 Change-Id: Iec456be5f3c279865b4165a75d1c6df36e331dbc Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/623181 Commit-Queue: Gavin Mak <gavinmak@google.com> Reviewed-by: Brian Gan <brgan@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
This commit is contained in:
1 parent
b85e76a86a
commit
6541729a18
4 files changed
+101
-7
No files matched your search
@@ -48,6 +48,11 @@ class GitRefs:
|
||||
self._EnsureLoaded()
|
||||
return self._symref.get(HEAD) or self._phyref.get(HEAD, "")
|
||||
|
||||
@property
|
||||
def is_loaded(self) -> bool:
|
||||
"""Whether a ref snapshot has already been loaded."""
|
||||
return self._phyref is not None
|
||||
|
||||
def get(self, name):
|
||||
try:
|
||||
return self.all[name]
|
||||
|
||||
Reference in new issue
Block a user