1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
test_description='Check content on tag page'
. ./setup.sh
test_expect_success 'create an annotated and a lightweight tag' '
(
cd repos/foo &&
git tag -a -m "Annotated tag
Release notes over
two lines." v1.0 &&
git tag light
)
'
test_expect_success 'generate foo/tag/?h=v1.0' 'cgit_url "foo/tag/&h=v1.0" >tmp'
test_expect_success 'find the name, date and tagger rows' '
grep "<tr><th scope=.row.>tag name</th><td>v1.0 (<span class=.oid.>[0-9a-f]*</span>)</td></tr>" tmp &&
grep "<tr><th scope=.row.>tag date</th><td><time datetime=" tmp &&
grep "<tr><th scope=.row.>tagged by</th><td>C O Mitter <committer@example.com></td></tr>" tmp
'
test_expect_success 'the object row names the full commit id' '
commit=$(git -C repos/foo rev-parse v1.0^{commit}) &&
grep "<tr><th scope=.row.>tagged object</th><td class=.oid.><a href=./foo/commit/?h=v1.0&id=$commit.>commit $commit</a></td></tr>" tmp &&
grep "<tr><th scope=.row.>download</th><td class=.oid.>" tmp
'
test_expect_success 'the message follows with no blank line before the body' '
tr -d "\n" <tmp >flat &&
grep "<div class=.commit-subject.>Annotated tag</div><div class=.commit-msg.>Release notes overtwo lines.</div>" flat
'
test_expect_success 'a lightweight tag gets the shorter table' '
cgit_url "foo/tag/&h=light" >tmp &&
grep "<tr><th scope=.row.>tag name</th><td>light</td></tr>" tmp &&
grep "<tr><th scope=.row.>tagged object</th><td class=.oid.><a" tmp &&
! grep "<th scope=.row.>tagged by</th>" tmp
'
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_expect_success 'a signed tag folds its signature after the message' '
(
cd repos/foo &&
{
echo "object $(git rev-parse HEAD)" &&
echo "type commit" &&
echo "tag signed" &&
echo "tagger C O Mitter <committer@example.com> 1700000000 +0000" &&
echo &&
echo "Signed release" &&
echo &&
echo "Notes." &&
echo &&
echo "-----BEGIN PGP SIGNATURE-----" &&
echo "iQEzBAABCAAdFiEE" &&
echo "-----END PGP SIGNATURE-----"
} >signed-tag &&
git update-ref refs/tags/signed $(git mktag <signed-tag)
) &&
cgit_url "foo/tag/&h=signed" >tmp &&
tr -d "\n" <tmp >flat &&
grep "<div class=.commit-msg.>Notes.</div><details class=.signature.><summary>Signature</summary><pre>-----BEGIN PGP SIGNATURE-----iQEzBAABCAAdFiEE-----END PGP SIGNATURE-----</pre></details>" flat
'
test_expect_success 'an unsigned tag has no fold' '
cgit_url "foo/tag/&h=v1.0" >tmp &&
! grep "details class=.signature." tmp
'
test_done
|