From 6fdd3c789aa039a1439ec65bdde6a56ddd88c59d Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Wed, 4 Nov 2026 22:33:58 -1000 Subject: Report a snapshot format name that matches nothing --- source/ui-snapshot.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source/ui-snapshot.c') diff --git a/source/ui-snapshot.c b/source/ui-snapshot.c index 333bce6..910bee6 100644 --- a/source/ui-snapshot.c +++ b/source/ui-snapshot.c @@ -13,6 +13,7 @@ #define USE_THE_REPOSITORY_VARIABLE #include "cgit.h" +#include "config.h" #include "filter.h" #include "html.h" #include "shared.h" @@ -321,6 +322,7 @@ int cgit_parse_snapshots_mask(const char *str) struct string_list_item *item; const struct cgit_snapshot_format *f; int mask = 0; + int len; // A number is the legacy form of this setting and is still taken // ahead of the named forms below. @@ -340,6 +342,17 @@ int cgit_parse_snapshots_mask(const char *str) break; } } + // A 0 is the legacy form offering none, and stays quiet. + if (f->suffix || !strcmp(item->string, "0")) + continue; + // The first line alone, since a git config value can hold a + // newline that would forge a log line of its own. + len = (int)strcspn(item->string, "\n"); + if (config_origin.file) + fprintf(stderr, "[cgit] Ignoring unknown snapshot format %.*s in %s line %d\n", + len, item->string, config_origin.file, config_origin.line); + else + fprintf(stderr, "[cgit] Ignoring unknown snapshot format %.*s\n", len, item->string); } string_list_clear(&tokens, 0); -- cgit 2.12.1