Diff options
Diffstat (limited to '')
| -rwxr-xr-x | tests/t0108-rawdiff.sh | 45 |
1 file changed, 21 insertions, 24 deletions
diff --git a/tests/t0108-rawdiff.sh b/tests/t0108-rawdiff.sh index f68628a..9b4eb37 100755 --- a/tests/t0108-rawdiff.sh +++ b/tests/t0108-rawdiff.sh @@ -8,51 +8,48 @@ test_description='Check content on rawdiff page' . ./setup.sh test_expect_success 'generate foo/rawdiff' ' - cgit_query "url=foo/rawdiff" >tmp + cgit_url "foo/rawdiff" >tmp ' -# cgit writes its CGI headers and the blank line that ends them ahead of the -# body while git writes only the diff, so the head of the page comes off -# before the two are compared. test_expect_success 'compare with output of git-diff(1)' ' - git --git-dir="$PWD/repos/foo/.git" diff HEAD^.. >tmp2 && - strip_headers <tmp >tmp_ && - cmp tmp_ tmp2 + git -C repos/foo diff HEAD^.. >expect && + strip_headers <tmp >actual && + test_cmp expect actual ' test_expect_success 'find initial commit' ' - root=$(git --git-dir="$PWD/repos/foo/.git" rev-list --max-parents=0 HEAD) + root=$(git -C repos/foo rev-list --max-parents=0 HEAD) ' test_expect_success 'generate diff for initial commit' ' - cgit_query "url=foo/rawdiff&id=$root" >tmp + cgit_url "foo/rawdiff&id=$root" >tmp ' test_expect_success 'compare with output of git-diff-tree(1)' ' - git --git-dir="$PWD/repos/foo/.git" diff-tree -p --no-commit-id --root "$root" >tmp2 && - strip_headers <tmp >tmp_ && - cmp tmp_ tmp2 + 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 --git-dir="$PWD/repos/foo/.git" rev-parse HEAD) && - id2=$(git --git-dir="$PWD/repos/foo/.git" rev-parse HEAD~3) && - cgit_query "url=foo/rawdiff&id=$id&id2=$id2" >tmp + 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 --git-dir="$PWD/repos/foo/.git" diff HEAD~3..HEAD >tmp2 && - strip_headers <tmp >tmp_ && - cmp tmp_ tmp2 + 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_query "url=foo/rawdiff/file-4&id=$id&id2=$id2" >tmp && - git --git-dir="$PWD/repos/foo/.git" diff HEAD~3..HEAD -- file-4 >tmp2 && - strip_headers <tmp >tmp_ && - cmp tmp_ tmp2 && - grep "file-4" tmp_ && - ! grep "file-5" tmp_ + 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 |
