From 0f11492868791513cbaae69c6476a00647f3fd47 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Thu, 19 Sep 2024 15:23:28 +0200 Subject: ui-snapshot: add option to disable prefix Hi everyone, it is me, ui snapshot prefix remover 3000 here today coming at you with another git patch --- ui-snapshot.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'ui-snapshot.c') diff --git a/ui-snapshot.c b/ui-snapshot.c index 3e38cd5..acae68c 100644 --- a/ui-snapshot.c +++ b/ui-snapshot.c @@ -308,11 +308,17 @@ void cgit_print_snapshot(const char *head, const char *hex, if (!prefix) prefix = xstrdup(cgit_snapshot_prefix(ctx.repo)); + if (!ctx.cfg.enable_snapshot_prefix && !ctx.repo->snapshot_prefix) { + free(prefix); + prefix = NULL; + } + if (sig_filename) write_sig(f, hex, filename, sig_filename); else make_snapshot(f, hex, prefix, filename); - free(prefix); + if (prefix) + free(prefix); free(adj_filename); } -- cgit