#!/bin/sh test_description='Check content on diff page' . ./setup.sh test_expect_success 'generate foo/diff' 'cgit_url "foo/diff" >tmp' test_expect_success 'find diff header' 'grep "a/file-5 b/file-5" tmp' test_expect_success 'find blob link' 'grep "@@ -0,0 +1 @@" tmp ' test_expect_success 'find added line' ' grep "
+5
" tmp ' test_expect_success 'ref picker: from: select present' ' grep "tmp ' test_expect_success 'diff with HEAD and root shows content' ' grep "diffstat" tmp ' test_expect_success 'flip link swaps explicit refs' ' cgit_query "url=foo/diff&id=master&id2=HEAD" >tmp && new=$(git --git-dir="$PWD/repos/foo/.git" rev-parse HEAD) && grep "/foo/diff/?id=$new&id2=master" tmp ' test_expect_success 'flip link omits id for a diff against a root commit' ' root=$(git --git-dir="$PWD/repos/foo/.git" rev-list --max-parents=0 HEAD) && cgit_query "url=foo/diff&id=$root" >tmp && grep "href=./foo/diff/?id2=$root." tmp ' test_done