config: make empty js= omit script tag
[cgit.git] / tests / t0108-patch.sh
blob013d68024d5df8ef1ad8764de80a9d65d624a525
1 #!/bin/sh
3 test_description='Check content on patch page'
4 . ./setup.sh
6 test_expect_success 'generate foo/patch' '
7 cgit_query "url=foo/patch" >tmp
10 test_expect_success 'find `From:` line' '
11 grep "^From: " tmp
14 test_expect_success 'find `Date:` line' '
15 grep "^Date: " tmp
18 test_expect_success 'find `Subject:` line' '
19 grep "^Subject: commit 5" tmp
22 test_expect_success 'find `cgit` signature' '
23 tail -2 tmp | head -1 | grep "^cgit"
26 test_expect_success 'compare with output of git-format-patch(1)' '
27 CGIT_VERSION=$(sed -n "s/CGIT_VERSION = //p" ../../VERSION) &&
28 git --git-dir="$PWD/repos/foo/.git" format-patch --subject-prefix="" --signature="cgit $CGIT_VERSION" --stdout HEAD^ >tmp2 &&
29 strip_headers <tmp >tmp_ &&
30 test_cmp tmp_ tmp2
33 test_expect_success 'find initial commit' '
34 root=$(git --git-dir="$PWD/repos/foo/.git" rev-list --max-parents=0 HEAD)
37 test_expect_success 'generate patch for initial commit' '
38 cgit_query "url=foo/patch&id=$root" >tmp
41 test_expect_success 'find `cgit` signature' '
42 tail -2 tmp | head -1 | grep "^cgit"
45 test_expect_success 'generate patches for multiple commits' '
46 id=$(git --git-dir="$PWD/repos/foo/.git" rev-parse HEAD) &&
47 id2=$(git --git-dir="$PWD/repos/foo/.git" rev-parse HEAD~3) &&
48 cgit_query "url=foo/patch&id=$id&id2=$id2" >tmp
51 test_expect_success 'find `cgit` signature' '
52 tail -2 tmp | head -1 | grep "^cgit"
55 test_expect_success 'compare with output of git-format-patch(1)' '
56 CGIT_VERSION=$(sed -n "s/CGIT_VERSION = //p" ../../VERSION) &&
57 git --git-dir="$PWD/repos/foo/.git" format-patch -N --subject-prefix="" --signature="cgit $CGIT_VERSION" --stdout HEAD~3..HEAD >tmp2 &&
58 strip_headers <tmp >tmp_ &&
59 test_cmp tmp_ tmp2
62 test_done