From 2fe5a9daec6a86e964a64fce0c2abca5ccd896ad Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 17 Oct 2026 17:09:14 -1000 Subject: Lead a snapshot name to its tag ahead of a branch The refs listing offers a tag's snapshot under the stem of its name, and the lookup back from that name settled on whatever ref matched first, so a branch spelled like the stem was archived in the tag's place. Every candidate is now tried as a tag before any is tried as a branch. --- tests/t0110-snapshot.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/t0110-snapshot.sh b/tests/t0110-snapshot.sh index 373a05d..2ce8316 100755 --- a/tests/t0110-snapshot.sh +++ b/tests/t0110-snapshot.sh @@ -181,4 +181,13 @@ test_expect_success GZIP 'a compressed snapshot is made without a PATH' ' gzip -t nopath.tar.gz ' +# A link offers the snapshot of a tag, and the name on it has to lead back to +# that tag even when a branch is spelled like the tag's stem. +test_expect_success 'a snapshot name leads to the tag ahead of a branch' ' + git -C repos/vtags update-ref refs/heads/1.0 $(git -C repos/vtags commit-tree -m shadow HEAD^{tree}) && + CGIT_CONFIG="$PWD/vtagsrc" QUERY_STRING="url=vtags/snapshot/vtags-1.0.tar.gz" cgit >tmp && + strip_headers tag.tar.gz && + test "$(gzip -dc tag.tar.gz | git -C repos/vtags get-tar-commit-id)" = "$(git -C repos/vtags rev-parse refs/tags/v1.0^{commit})" +' + test_done -- cgit