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
|
test_description='Check content on rawdiff page'
. ./setup.sh
test_expect_success 'generate foo/rawdiff' '
cgit_url "foo/rawdiff" >tmp
'
test_expect_success 'compare with output of git-diff(1)' '
git -C repos/foo diff HEAD^.. >expect &&
strip_headers <tmp >actual &&
test_cmp expect actual
'
test_expect_success 'find initial commit' '
root=$(git -C repos/foo rev-list --max-parents=0 HEAD)
'
test_expect_success 'generate diff for initial commit' '
cgit_url "foo/rawdiff&id=$root" >tmp
'
test_expect_success 'compare with output of git-diff-tree(1)' '
git -C repos/foo diff-tree -p --no-commit-id --root "$root" >expect &&
strip_headers <tmp >actual &&
test_cmp expect actual
'
test_expect_success 'generate diff for multiple commits' '
id=$(git -C repos/foo rev-parse HEAD) &&
id2=$(git -C repos/foo rev-parse HEAD~3) &&
cgit_url "foo/rawdiff&id=$id&id2=$id2" >tmp
'
test_expect_success 'compare with output of git-diff(1)' '
git -C repos/foo diff HEAD~3..HEAD >expect &&
strip_headers <tmp >actual &&
test_cmp expect actual
'
test_expect_success 'a path limits the diff to that file' '
cgit_url "foo/rawdiff/file-4&id=$id&id2=$id2" >tmp &&
git -C repos/foo diff HEAD~3..HEAD -- file-4 >expect &&
strip_headers <tmp >actual &&
test_cmp expect actual &&
grep "file-4" actual &&
! grep "file-5" actual
'
test_done
|