From 2a6726adaa8083207adad600a102762ca41bbd58 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 24 Oct 2026 10:22:37 -1000 Subject: Sign patches with the cgit version git format-patch ends each patch with the version of git that wrote it, and the bare "cgit" that 3a00e19 left in its place said less. The version is written as git writes its own, without the v of the tag, so a release build signs with "cgit 2.9.0". The footer and the generator tag still leave versions out. --- source/ui-patch.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'source/ui-patch.c') diff --git a/source/ui-patch.c b/source/ui-patch.c index 525e660..78c850c 100644 --- a/source/ui-patch.c +++ b/source/ui-patch.c @@ -62,6 +62,7 @@ void cgit_print_patch(const char *new_rev, const char *old_rev, const char *pref struct commit *commit; struct object_id new_oid, old_oid; char rev_range[REV_RANGE_LEN]; + const char *version; // setup_revisions reads these the way git reads a command line, so the // first entry stands in for the program name and is skipped, and the // array has to stay null terminated because the path after the double @@ -130,11 +131,16 @@ void cgit_print_patch(const char *new_rev, const char *old_rev, const char *pref ctx.page.filename = cgit_fmt("%s.patch", rev_range); cgit_print_http_headers(); + // git format-patch signs with its bare version number, so the v that + // cgit's tags carry is left off to read the same way. + if (!skip_prefix(cgit_version, "v", &version)) + version = cgit_version; + while ((commit = get_revision(&rev))) { log_tree_commit(&rev, commit); // Two dashes and a space is the mail signature separator, so - // git am and mail readers drop the line below rather than - // carrying it into the commit message. - printf("-- \ncgit\n\n"); + // git am and mail readers drop the version note below rather + // than carrying it into the commit message. + printf("-- \ncgit %s\n\n", version); } } -- cgit 2.9.1