diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Fix the submodule rows in the tree listing
A submodule row linked to a path with its trailing slash stripped,
was labelled by its path rather than its entry name, shared the
name's element with its hash, claimed a size of zero and offered a
blame button that cannot work on a gitlink.
Diffstat (limited to 'tests/t0104-tree.sh')
| -rwxr-xr-x | tests/t0104-tree.sh | 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 49 insertions, 0 deletions
diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh index f4039b6..a30297f 100755 --- a/tests/t0104-tree.sh +++ b/tests/t0104-tree.sh @@ -36,4 +36,53 @@ test_expect_success 'verify a+b?h=1+2 link' ' grep "/foo%2Bbar/tree/a%2Bb?h=1%2B2" tmp ' +test_expect_success 'set up a repo with a nested submodule' ' + mkrepo repos/submodules 1 && + ( + cd repos/submodules && + sub=$(git rev-parse HEAD) && + git update-index --add --cacheinfo 160000,$sub,vendor/sub && + git commit -m gitlink + ) && + { + echo "virtual-root=/" && + echo "cache-size=0" && + echo "enable-blame=1" && + echo "repo.url=submodules" && + echo "repo.path=$PWD/repos/submodules/.git" + } >submodrc +' + +test_expect_success 'generate submodules/tree/vendor' ' + CGIT_CONFIG="$PWD/submodrc" QUERY_STRING="url=submodules/tree/vendor" \ + cgit >tmp +' + +test_expect_success 'a submodule row shows the entry name alone' ' + grep "class=.ls-mod.>sub</span>" tmp && + ! grep ">vendor/sub</span>" tmp +' + +test_expect_success 'the submodule hash is titled with the full id' ' + sub=$(git -C repos/submodules rev-parse HEAD~1) && + grep "class=.ls-mod-hash. title=.$sub.>" tmp +' + +test_expect_success 'a submodule row shows no size' ' + grep "ls-mod" tmp >row && + grep "class=.ls-size.>-</td>" row +' + +test_expect_success 'a submodule row offers log but not blame or plain' ' + grep "ls-mod" tmp >row && + grep ">log</a>" row && + ! grep ">blame</a>" row && + ! grep ">plain</a>" row +' + +test_expect_success 'a file row still offers blame' ' + CGIT_CONFIG="$PWD/submodrc" QUERY_STRING="url=submodules/tree/" cgit >tmp && + grep ">blame</a>" tmp +' + test_done |
