diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce 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 'source')
| -rw-r--r-- | source/ui-refs.c | 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -rw-r--r-- | source/ui-shared.c | 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2 files changed, 3 insertions, 5 deletions
diff --git a/source/ui-refs.c b/source/ui-refs.c index e4a0dd0..890a959 100644 --- a/source/ui-refs.c +++ b/source/ui-refs.c @@ -294,7 +294,7 @@ void cgit_print_branches(int maxcount) print_branch_header(); collect_branches(&list); - if (maxcount == 0 || maxcount > list.count) + if (maxcount <= 0 || maxcount > list.count) maxcount = list.count; // The date sort covers the list, the name sort only the rows about to @@ -323,9 +323,7 @@ void cgit_print_tags(int maxcount) if (list.count == 0) return; qsort(list.refs, list.count, sizeof(*list.refs), cmp_date); - if (!maxcount) - maxcount = list.count; - else if (maxcount > list.count) + if (maxcount <= 0 || maxcount > list.count) maxcount = list.count; print_tag_header(); for (i = 0; i < maxcount; i++) diff --git a/source/ui-shared.c b/source/ui-shared.c index 409ad40..7d28c39 100644 --- a/source/ui-shared.c +++ b/source/ui-shared.c @@ -485,7 +485,7 @@ static int print_branch_option(const struct reference *ref, void *data) const char *name = ref->name; // The switcher runs on every page, so it is bounded like the refs list. - if (ctx.cfg.max_ref_count && opt->count >= ctx.cfg.max_ref_count) + if (ctx.cfg.max_ref_count > 0 && opt->count >= ctx.cfg.max_ref_count) return -1; // A name spelled like an option is refused as a head, so offering it // would only lead to an error page. |
