diff options
context:
space:
mode:
-rw-r--r--source/ui-stats.c5
-rwxr-xr-xtests/t0112-stats.sh6
2 files changed, 10 insertions, 1 deletion
diff --git a/source/ui-stats.c b/source/ui-stats.c
index f1a4d65..182cc06 100644
--- a/source/ui-stats.c
+++ b/source/ui-stats.c
@@ -247,7 +247,10 @@ static struct string_list collect_stats(const struct cgit_period *period)
struct string_list authors;
struct rev_info rev;
struct commit *commit;
- const char *argv[] = {NULL, ctx.qry.head, NULL, NULL};
+ // setup_revisions reads the entries after the double dash up to a
+ // NULL, past the count, so the sentinel has to stay even when the
+ // path fills the slot before it.
+ const char *argv[] = {NULL, ctx.qry.head, NULL, NULL, NULL};
int argc = 2;
time_t since;
struct tm tm;
diff --git a/tests/t0112-stats.sh b/tests/t0112-stats.sh
index 2ada672..bc9c25b 100755
--- a/tests/t0112-stats.sh
+++ b/tests/t0112-stats.sh
@@ -70,6 +70,12 @@ test_expect_success 'extensionless fixture files fold into Other' '
grep "class=.left.>Other" tmp
'
+test_expect_success 'stats below a path stay a normal page' '
+ statq "url=stat/stats/file-1" >tmp &&
+ grep "Status: 200" tmp &&
+ grep "<h2>Commits per author" tmp
+'
+
test_expect_success 'all four periods offered when max-stats is unset' '
statq "url=stat/stats/" >tmp &&
grep "<option value=.w." tmp &&