about summary refs log tree commit diff stats
path: root/ui-shared.c
diff options
context:
space:
mode:
authorJohn Keeping2018-03-31 16:15:48 +0100
committerJason A. Donenfeld2018-06-27 18:11:19 +0200
commitc712d5ac434b9ee8cb4e63a173a2538e1878637f (patch)
tree8b4f71d0fb9ef478409109fbf485532ae90660f0 /ui-shared.c
parentui-refs: use shared function to print tag downloads (diff)
downloadcgit-c712d5ac434b9ee8cb4e63a173a2538e1878637f.tar.gz
cgit-c712d5ac434b9ee8cb4e63a173a2538e1878637f.zip
snapshot: support archive signatures
Read signatures from the notes refs refs/notes/signatures/$FORMAT where
FORMAT is one of our archive formats ("tar", "tar.gz", ...).  The note
is expected to simply contain the signature content to be returned when
the snapshot "${filename}.asc" is requested, so the signature for
cgit-1.1.tar.xz can be stored against the v1.1 tag with:

	git notes --ref=refs/notes/signatures/tar.xz add -C "$(
		gpg --output - --armor --detach-sign cgit-1.1.tar.xz |
		git hash-object -w --stdin
	)" v1.1

and then downloaded by simply appending ".asc" to the archive URL.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
Diffstat (limited to 'ui-shared.c')
-rw-r--r--ui-shared.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c index 9d7ee3d..8a786e0 100644 --- a/ui-shared.c +++ b/ui-shared.c
@@ -1133,6 +1133,13 @@ void cgit_print_snapshot_links(const struct cgit_repo *repo, const char *ref,
1133 strbuf_addstr(&filename, f->suffix); 1133 strbuf_addstr(&filename, f->suffix);
1134 cgit_snapshot_link(filename.buf, NULL, NULL, NULL, NULL, 1134 cgit_snapshot_link(filename.buf, NULL, NULL, NULL, NULL,
1135 filename.buf); 1135 filename.buf);
1136 if (cgit_snapshot_get_sig(ref, f)) {
1137 strbuf_addstr(&filename, ".asc");
1138 html(" (");
1139 cgit_snapshot_link("sig", NULL, NULL, NULL, NULL,
1140 filename.buf);
1141 html(")");
1142 }
1136 html(separator); 1143 html(separator);
1137 } 1144 }
1138 strbuf_release(&filename); 1145 strbuf_release(&filename);