Diff options
| -rwxr-xr-x | tests/t0104-tree.sh | 18 | |
| -rwxr-xr-x | tests/t0301-security.sh | 21 |
2 files changed, 22 insertions, 17 deletions
diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh index f17dd34..a42b247 100755 --- a/tests/t0104-tree.sh +++ b/tests/t0104-tree.sh @@ -453,4 +453,22 @@ test_expect_success 'a NUL past the first 8000 bytes still gets a blame link' ' test_grep ! ">blame</a>" tmp ' + +# Grouping directories ahead of files is behaviour this fork adds, so nothing +# upstream covers it. The directory sorts after the file by name, so only the +# grouping can put it first. +test_expect_success 'tree groups directories before files' ' + test_create_repo repos/grouped && + mkdir repos/grouped/zsub && + test_commit -C repos/grouped --no-tag inner zsub/inner && + test_commit -C repos/grouped --no-tag top afile && + cgitrc_repo groupedrc grouped enable-tree-group-dirs=1 && + cgit_ok groupedrc "url=grouped/tree/" >tmp && + dirline=$(grep -n "tree/zsub" tmp | head -n 1 | cut -d: -f1) && + fileline=$(grep -n "tree/afile" tmp | head -n 1 | cut -d: -f1) && + test -n "$dirline" && + test -n "$fileline" && + test "$dirline" -lt "$fileline" +' + test_done diff --git a/tests/t0301-security.sh b/tests/t0301-security.sh index 229aecb..7260ab3 100755 --- a/tests/t0301-security.sh +++ b/tests/t0301-security.sh @@ -25,9 +25,9 @@ cgit_ok_path() { # Some cases below share one repository and one config, so the fixture # carries everything they need at once, readmes holding markup that must not -# reach the page as markup and a subdirectory to sort ahead of the files. -# The blob limit is the lowest there is, 1 KB, so a small file shows that a -# blob under it is still served. +# reach the page as markup and a small file. The blob limit is the lowest +# there is, 1 KB, so the small file shows that a blob under it is still +# served. test_expect_success 'set up security fixtures' ' mkrepo repos/sec 1 && ( @@ -35,12 +35,10 @@ test_expect_success 'set up security fixtures' ' printf "# Title\n<script>alert(1)</script>\n" >README.md && printf "<script>alert(2)</script>\n" >readme.txt && printf "top\n" >afile && - mkdir zsub && - printf "inner\n" >zsub/inner && git add -A && git commit -m fixtures ) && - cgitrc_repo seccgitrc sec max-blob-size=1 enable-tree-group-dirs=1 + cgitrc_repo seccgitrc sec max-blob-size=1 ' # A revision beginning with a dash reaches git as an option rather than as a @@ -131,17 +129,6 @@ test_expect_success 'no page carries an inline handler' ' done ' -# Grouping directories ahead of files is behaviour this fork adds, so nothing -# upstream covers it. -test_expect_success 'tree groups directories before files' ' - cgit_rc seccgitrc "url=sec/tree/" >tmp && - dirline=$(grep -n "tree/zsub" tmp | head -n 1 | cut -d: -f1) && - fileline=$(grep -n "tree/afile" tmp | head -n 1 | cut -d: -f1) && - test -n "$dirline" && - test -n "$fileline" && - test "$dirline" -lt "$fileline" -' - # A file name is repository content and may hold a quote, which would break # out of the href attribute on the line number links of a side-by-side diff, # or a hash or question mark, which the attribute escaping leaves alone and |
