summaryrefslogtreecommitdiff
path: root/pretty.c
diff options
context:
space:
mode:
authorMichael J Gruber <git@drmicha.warpmail.net>2013-02-14 17:04:46 +0100
committerJunio C Hamano <gitster@pobox.com>2013-02-14 09:30:36 -0800
commit0174eeaa736226a0bea19e9bf88c270d61aa9cce (patch)
tree94f0586682a4b6fd35bcf6753db2a8180d844e20 /pretty.c
parent4a868fd655a72c2663d9519363162db467baccb2 (diff)
downloadgit-0174eeaa736226a0bea19e9bf88c270d61aa9cce.tar.gz
pretty: make %GK output the signing key for signed commits
In order to employ signed keys in an automated way it is absolutely necessary to check which keys the signatures come from. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/pretty.c b/pretty.c
index 9ffe7bcebb..9119fe7728 100644
--- a/pretty.c
+++ b/pretty.c
@@ -695,6 +695,7 @@ struct format_commit_context {
char *gpg_status;
char good_bad;
char *signer;
+ char *key;
} signature;
char *message;
size_t width, indent1, indent2;
@@ -897,7 +898,9 @@ static void parse_signature_lines(struct format_commit_context *ctx)
if (!found)
continue;
ctx->signature.good_bad = signature_check[i].result;
- found += strlen(signature_check[i].check)+17;
+ found += strlen(signature_check[i].check);
+ ctx->signature.key = xmemdupz(found, 16);
+ found += 17;
next = strchrnul(found, '\n');
ctx->signature.signer = xmemdupz(found, next - found);
break;
@@ -1130,6 +1133,10 @@ static size_t format_commit_one(struct strbuf *sb, const char *placeholder,
if (c->signature.signer)
strbuf_addstr(sb, c->signature.signer);
break;
+ case 'K':
+ if (c->signature.key)
+ strbuf_addstr(sb, c->signature.key);
+ break;
}
return 2;
}