diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
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.
Diffstat (limited to 'source')
| -rw-r--r-- | source/cgit.c | 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -rw-r--r-- | source/cgit.h | 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -rw-r--r-- | source/ui-patch.c | 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3 files changed, 13 insertions, 3 deletions
diff --git a/source/cgit.c b/source/cgit.c index 5f8ecfa..a877e92 100644 --- a/source/cgit.c +++ b/source/cgit.c @@ -54,6 +54,8 @@ struct refmatch { int found; }; +const char *cgit_version = CGIT_VERSION; + /* * Isolate git from the calling user's configuration, which could otherwise * break once HOME is unset below. It runs as a constructor because git reads diff --git a/source/cgit.h b/source/cgit.h index 5b92632..c04193f 100644 --- a/source/cgit.h +++ b/source/cgit.h @@ -324,6 +324,8 @@ struct cgit_context { int empty_repo; }; +extern const char *cgit_version; + extern struct cgit_repolist cgit_repolist; extern struct cgit_context ctx; 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); } } |
