diff options
| author | Gavin Mak <gavinmak@google.com> | 2026-08-25 08:38:35 -0700 |
|---|---|---|
| committer | gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2026-08-31 12:33:39 -0700 |
| commit | 6541729a1844d4a7f4768576a57c48fed23a90bf (patch) | |
| tree | b293b6dc031c5ca211c974cedf39e076c5343d69 /tests/test_git_refs.py | |
| parent | b85e76a86a0d8064be5500f65d1a71c49aa00c22 (diff) | |
| download | git-repo-6541729a1844d4a7f4768576a57c48fed23a90bf.tar.gz | |
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>
Diffstat (limited to 'tests/test_git_refs.py')
| -rw-r--r-- | tests/test_git_refs.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/test_git_refs.py b/tests/test_git_refs.py index 183ed9d74..ab7bdbe97 100644 --- a/tests/test_git_refs.py +++ b/tests/test_git_refs.py | |||
| @@ -59,6 +59,7 @@ def test_reads_refs(tmp_path, reftable): | |||
| 59 | branch = _run(repo, "symbolic-ref", "--short", "HEAD") | 59 | branch = _run(repo, "symbolic-ref", "--short", "HEAD") |
| 60 | head = _run(repo, "rev-parse", "HEAD") | 60 | head = _run(repo, "rev-parse", "HEAD") |
| 61 | assert refs.symref("HEAD") == f"refs/heads/{branch}" | 61 | assert refs.symref("HEAD") == f"refs/heads/{branch}" |
| 62 | assert refs.head == f"refs/heads/{branch}" | ||
| 62 | assert refs.get("HEAD") == head | 63 | assert refs.get("HEAD") == head |
| 63 | assert refs.get(f"refs/heads/{branch}") == head | 64 | assert refs.get(f"refs/heads/{branch}") == head |
| 64 | 65 | ||
