diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/t0110-snapshot.sh34
1 file changed, 34 insertions, 0 deletions
diff --git a/tests/t0110-snapshot.sh b/tests/t0110-snapshot.sh
index 9c8ce35..79fecef 100755
--- a/tests/t0110-snapshot.sh
+++ b/tests/t0110-snapshot.sh
@@ -112,4 +112,38 @@ test_expect_success UNZIP 'unzip and verify the content' '
test_line_count = 1 master/file-5
'
+# A tag named v1.0 sheds its v in the snapshot name unless dropping it would
+# merge two tags. The first tag below stays a loose ref on purpose, because on
+# a case-insensitive filesystem a ref lookup for V1.0 finds the loose v1.0
+# file, and deciding by lookups called every fresh tag ambiguous and kept its
+# v until git happened to pack the refs.
+test_expect_success 'set up a repo with a versioned tag' '
+ mkrepo repos/vtags 2 &&
+ git -C repos/vtags update-ref refs/tags/v1.0 HEAD &&
+ {
+ echo "virtual-root=/" &&
+ echo "cache-size=0" &&
+ echo "snapshots=tar.gz" &&
+ echo "repo.url=vtags" &&
+ echo "repo.path=$PWD/repos/vtags/.git"
+ } >vtagsrc
+'
+
+test_expect_success 'a loose v tag still sheds its v in the snapshot name' '
+ CGIT_CONFIG="$PWD/vtagsrc" QUERY_STRING="url=vtags/refs/" cgit >tmp &&
+ grep "vtags-1.0.tar.gz" tmp &&
+ ! grep "vtags-v1.0.tar.gz" tmp
+'
+
+# The second tag goes in only after the first is packed, since two loose files
+# differing in case alone cannot coexist on a case-insensitive filesystem.
+test_expect_success 'a real case collision keeps the v on both tags' '
+ git -C repos/vtags pack-refs --all &&
+ git -C repos/vtags update-ref refs/tags/V1.0 HEAD~1 &&
+ CGIT_CONFIG="$PWD/vtagsrc" QUERY_STRING="url=vtags/refs/" cgit >tmp &&
+ grep "vtags-v1.0.tar.gz" tmp &&
+ grep "vtags-V1.0.tar.gz" tmp &&
+ ! grep "vtags-1.0.tar.gz" tmp
+'
+
test_done