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
|
test_description='Check the shipped link-commits extension'
CGIT_TEST_NO_CREATE_REPOS=YesPlease
. ./setup.sh
. "$TEST_OUTPUT_DIRECTORY/extensions/lib.sh"
interpreters=$(ext_lua_interpreters 4)
test -z "$interpreters" &&
say 'no standalone lua on the path, unit checks skipped'
for lua in $interpreters
do
test_expect_success "unit checks under $lua" "
'$lua' '$EXT_TEST_DIRECTORY/test-link-commits.lua' '$EXTENSIONS_DIRECTORY/link-commits.lua'
"
done
test "$CGIT_HAS_LUA" -eq 1 && test_set_prereq CGIT_LUA
test "$CGIT_HAS_LUA" -eq 1 ||
say 'cgit built without lua, filter checks through cgit skipped'
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
enable-filter-overrides=1
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 links out on the commit page' '
cgit_url "linky/commit/" >tmp &&
grep "bugs.example.com/?bug=123.>#123</a>" tmp
'
test_expect_success CGIT_LUA 'the object name links to its own page' '
grep "id=deadbeefcafe1234.>deadbeefcafe1234</a>" tmp
'
test_done
|