diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Offer tag snapshots only for a tagged commit
The tag page offered a download for a tag of a tree or a blob, which only led to a "Not a commit" page. The refs listing already checks.
Diffstat (limited to 'tests/t0113-tag.sh')
-rwxr-xr-xtests/t0113-tag.sh14
1 file changed, 14 insertions, 0 deletions
diff --git a/tests/t0113-tag.sh b/tests/t0113-tag.sh
index 2c9dc25..ff50f90 100755
--- a/tests/t0113-tag.sh
+++ b/tests/t0113-tag.sh
@@ -45,4 +45,18 @@ test_expect_success 'a lightweight tag gets the shorter table' '
! grep "<th scope=.row.>tagged by</th>" tmp
'
+# A snapshot is cut from a commit, so a tag of a tree or a blob offers none.
+test_expect_success 'a tag of anything but a commit offers no download' '
+ git -C repos/foo tag -a -m "a tree" tree-tag HEAD^{tree} &&
+ git -C repos/foo tag blob-tag HEAD:file-1 &&
+ cgit_url "foo/tag/&h=tree-tag" >tmp &&
+ grep "tagged object" tmp &&
+ ! grep ">download<" tmp &&
+ cgit_url "foo/tag/&h=blob-tag" >tmp &&
+ grep "tagged object" tmp &&
+ ! grep ">download<" tmp &&
+ cgit_url "foo/tag/&h=v1.0" >tmp &&
+ grep ">download<" tmp
+'
+
test_done