- '%GS': show the name of the signer for a signed commit
- '%GK': show the key used to sign a signed commit
- '%GF': show the fingerprint of the key used to sign a signed commit
+- '%GP': show the fingerprint of the primary key whose subkey was used
+ to sign a signed commit
- '%gD': reflog selector, e.g., `refs/stash@{1}` or
`refs/stash@{2 minutes ago`}; the format follows the rules described
for the `-g` option. The portion before the `@` is the refname as
FREE_AND_NULL(sigc->signer);
FREE_AND_NULL(sigc->key);
FREE_AND_NULL(sigc->fingerprint);
+ FREE_AND_NULL(sigc->primary_key_fingerprint);
}
/* An exclusive status -- only one of them can appear in output */
{
const char *buf = sigc->gpg_status;
const char *line, *next;
- int i;
+ int i, j;
int seen_exclusive_status = 0;
/* Iterate over all lines */
next = strchrnul(line, ' ');
free(sigc->fingerprint);
sigc->fingerprint = xmemdupz(line, next - line);
+
+ /* Skip interim fields */
+ for (j = 9; j > 0; j--) {
+ if (!*next)
+ break;
+ line = next + 1;
+ next = strchrnul(line, ' ');
+ }
+
+ next = strchrnul(line, '\n');
+ free(sigc->primary_key_fingerprint);
+ sigc->primary_key_fingerprint = xmemdupz(line, next - line);
}
break;
*/
sigc->result = 'E';
/* Clear partial data to avoid confusion */
+ FREE_AND_NULL(sigc->primary_key_fingerprint);
FREE_AND_NULL(sigc->fingerprint);
FREE_AND_NULL(sigc->signer);
FREE_AND_NULL(sigc->key);
if (c->signature_check.fingerprint)
strbuf_addstr(sb, c->signature_check.fingerprint);
break;
+ case 'P':
+ if (c->signature_check.primary_key_fingerprint)
+ strbuf_addstr(sb, c->signature_check.primary_key_fingerprint);
+ break;
default:
return 0;
}