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
|
test_description='Check the shipped link-commits extension'
CGIT_TEST_NO_CREATE_REPOS=YesPlease
. ./setup.sh
. "$TEST_OUTPUT_DIRECTORY/extensions/lib.sh"
for lua in ${interpreters:-lua}
do
test_expect_success STANDALONE_LUA "unit checks under $(lua_version "$lua")" '
"$lua" "$EXT_TEST_DIRECTORY/test-link-commits.lua" "$EXTENSIONS_DIRECTORY/link-commits.lua"
'
done
test_expect_success 'create a repository whose commit message holds matches' '
test_create_repo repos/linky &&
(
cd repos/linky &&
echo content >file &&
git add file &&
git commit -m "fix #123 near deadbeefcafe1234"
)
'
test_expect_success 'point cgit at it through the commit filter' '
cat >cgitrc <<-EOF
virtual-root=/
cache-size=0
repo.url=linky
repo.path=$PWD/repos/linky/.git
repo.commit-filter=lua:$EXTENSIONS_DIRECTORY/link-commits.lua
EOF
'
test_expect_success CGIT_LUA 'the issue mark stays text on the commit page' '
cgit_ok_url "linky/commit/" >tmp &&
test_grep "fix #123 near" tmp &&
test_grep ! "bugs.example.com" tmp
'
test_expect_success CGIT_LUA 'the object name links to its own page' '
cgit_ok_url "linky/commit/" >tmp &&
test_grep "id=deadbeefcafe1234.>deadbeefcafe1234</a>" tmp
'
test_done
|