diff options
Diffstat (limited to '')
| -rw-r--r-- | source/ui-tree.c | 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -rwxr-xr-x | tests/t0104-tree.sh | 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2 files changed, 29 insertions, 1 deletion
diff --git a/source/ui-tree.c b/source/ui-tree.c index 51ab9ff..13a9787 100644 --- a/source/ui-tree.c +++ b/source/ui-tree.c @@ -262,7 +262,8 @@ static void print_dir_chain(const struct object_id *oid, char *name, char *rev, read_tree(the_repository, tree, &paths, only_child_cb, &child); - if (child.count != 1) + // The separator only goes out ahead of a level that will follow. + if (child.count != 1 || levels == MAX_DIR_CHAIN_LEVELS) break; html(" / "); diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh index a2ec3c2..e92b2a2 100755 --- a/tests/t0104-tree.sh +++ b/tests/t0104-tree.sh @@ -108,4 +108,31 @@ test_expect_success 'only a link target inside the tree is linked' ' ! grep "href=./links/tree/etc/passwd" tmp ' +# A row follows a chain of single directories for a set number of levels and +# stops on the last one it links, with no separator left hanging after it. +test_expect_success 'a long directory chain ends on a link' ' + test_create_repo repos/deep && + ( + cd repos/deep && + p=d1 && + for i in $(test_seq 2 17) + do + p=$p/d$i || return 1 + done && + mkdir -p $p && + echo deep >$p/file && + git add . && + git commit -m deep + ) && + { + echo "virtual-root=/" && + echo "cache-size=0" && + echo "repo.url=deep" && + echo "repo.path=$PWD/repos/deep/.git" + } >deeprc && + CGIT_CONFIG="$PWD/deeprc" QUERY_STRING="url=deep/tree/" cgit >tmp && + grep ">d15</a></td>" tmp && + ! grep " / </td>" tmp +' + test_done |
