diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-11-18 18:23:54 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-11-18 18:23:54 +0900 |
commit | 6d2035ee605980efa9915e10d35e7a355fc74077 (patch) | |
tree | 5d33f09a10185d66398070e26bcaf864f55709bd /commit.c | |
parent | 39847644adb3678da91048b2ac6ebc2b3c475f3a (diff) | |
parent | 01a31f3bcaae8b62e5e11ee12d7b1606700f0721 (diff) | |
download | git-6d2035ee605980efa9915e10d35e7a355fc74077.tar.gz |
Merge branch 'jk/verify-sig-merge-into-void'
"git merge" and "git pull" that merges into an unborn branch used
to completely ignore "--verify-signatures", which has been
corrected.
* jk/verify-sig-merge-into-void:
pull: handle --verify-signatures for unborn branch
merge: handle --verify-signatures for unborn branch
merge: extract verify_merge_signature() helper
Diffstat (limited to 'commit.c')
-rw-r--r-- | commit.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -1099,7 +1099,33 @@ int check_commit_signature(const struct commit *commit, struct signature_check * return ret; } +void verify_merge_signature(struct commit *commit, int verbosity) +{ + char hex[GIT_MAX_HEXSZ + 1]; + struct signature_check signature_check; + memset(&signature_check, 0, sizeof(signature_check)); + + check_commit_signature(commit, &signature_check); + + find_unique_abbrev_r(hex, &commit->object.oid, DEFAULT_ABBREV); + switch (signature_check.result) { + case 'G': + break; + case 'U': + die(_("Commit %s has an untrusted GPG signature, " + "allegedly by %s."), hex, signature_check.signer); + case 'B': + die(_("Commit %s has a bad GPG signature " + "allegedly by %s."), hex, signature_check.signer); + default: /* 'N' */ + die(_("Commit %s does not have a GPG signature."), hex); + } + if (verbosity >= 0 && signature_check.result == 'G') + printf(_("Commit %s has a good GPG signature by %s\n"), + hex, signature_check.signer); + signature_check_clear(&signature_check); +} void append_merge_tag_headers(struct commit_list *parents, struct commit_extra_header ***tail) |