diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Read a negative ref count as no limit
summary-branches, summary-tags and max-ref-count already listed every ref at 0, but a negative value reached qsort as a count and crashed the summary and refs pages, and emptied the branch switcher.
Diffstat (limited to 'tests/t0204-limits.sh')
-rwxr-xr-xtests/t0204-limits.sh20
1 file changed, 20 insertions, 0 deletions
diff --git a/tests/t0204-limits.sh b/tests/t0204-limits.sh
index 245c016..b1c797a 100755
--- a/tests/t0204-limits.sh
+++ b/tests/t0204-limits.sh
@@ -105,6 +105,26 @@ test_expect_success 'tag page paginates independently' '
! grep "log/?h=" tmp
'
+# A count of 0 lists every ref, and a negative one has to mean the same
+# rather than reach the sort as a size.
+test_expect_success 'a negative ref count lists every ref' '
+ for n in 0 -1
+ do
+ {
+ echo "summary-branches=$n" &&
+ echo "summary-tags=$n" &&
+ sed "s/^max-ref-count=2$/max-ref-count=$n/" limitrc
+ } >count$n.rc &&
+ CGIT_CONFIG="$PWD/count$n.rc" QUERY_STRING="url=limits/refs/" cgit >refs$n &&
+ CGIT_CONFIG="$PWD/count$n.rc" QUERY_STRING="url=limits/" cgit >summary$n ||
+ return 1
+ done &&
+ grep "log/?h=branch-3" refs0 &&
+ grep "/tag/?h=tag-3" summary0 &&
+ test_cmp refs0 refs-1 &&
+ test_cmp summary0 summary-1
+'
+
# A file that busts max-diff-lines is replaced by a link to its own page,
# where the reader asked for that one file and the limit no longer applies.
# The rest of the commit still renders, so one huge file cannot hide the