diff options
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/t0105-plain.sh | 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 25 insertions, 0 deletions
diff --git a/tests/t0105-plain.sh b/tests/t0105-plain.sh index 27e8daa..2e5513f 100755 --- a/tests/t0105-plain.sh +++ b/tests/t0105-plain.sh @@ -71,4 +71,29 @@ test_expect_success 'only text and xml types carry a charset' ' sed "/^$/q" tmp | grep "^Content-Type: image/svg+xml; charset=UTF-8$" ' +# A tree can carry two entries of one name, which only a repository with +# fsck off accepts, and the plain view answers the first alone. +test_expect_success 'plain answers once for duplicate tree entries' ' + test_create_repo repos/dup && + ( + cd repos/dup && + blob=$(printf PNGDATA | git hash-object -w --stdin) && + inner=$(printf "100644 blob %s\\tinside\\n" $blob | git mktree) && + top=$(printf "100644 blob %s\\tx.png\\n040000 tree %s\\tx.png\\n" $blob $inner | git mktree --missing) && + c=$(echo dup | git commit-tree $top) && + git update-ref refs/heads/master $c + ) && + { + echo "virtual-root=/" && + echo "cache-size=0" && + echo "mimetype.png=image/png" && + echo "repo.url=dup" && + echo "repo.path=$PWD/repos/dup/.git" + } >duprc && + CGIT_CONFIG="$PWD/duprc" QUERY_STRING="url=dup/plain/x.png" cgit >tmp && + test $(grep -c "^Status:" tmp) = 1 && + test $(grep -c "^Content-Type:" tmp) = 1 && + grep "^Content-Type: image/png" tmp +' + test_done |
