summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-11-06 07:51:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-11-07 01:11:09 (GMT)
commit7488ba3eeaaaeb8c0e06cca12384f9f7f76082b5 (patch)
tree3e97e080b8af2a996777a91d8ccce6c82636dc19 /t
parentedc4d47d54cb1c0ec1550aa50bba86b23720a72f (diff)
downloadgit-7488ba3eeaaaeb8c0e06cca12384f9f7f76082b5.zip
git-7488ba3eeaaaeb8c0e06cca12384f9f7f76082b5.tar.gz
git-7488ba3eeaaaeb8c0e06cca12384f9f7f76082b5.tar.bz2
merge: handle --verify-signatures for unborn branch
When git-merge sees that we are on an unborn branch (i.e., there is no HEAD), it follows a totally separate code path than the usual merge logic. This code path does not know about verify_signatures, and so we fail to notice bad or missing signatures. This has been broken since --verify-signatures was added in efed002249 (merge/pull: verify GPG signatures of commits being merged, 2013-03-31). In an ideal world, we'd unify the flow for this case with the regular merge logic, which would fix this bug and avoid introducing similar ones. But because the unborn case is so different, it would be a burden on the rest of the function to continually handle the missing HEAD. So let's just port the verification check to this special case. Reported-by: Felix Eckhofer <felix@eckhofer.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t7612-merge-verify-signatures.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/t/t7612-merge-verify-signatures.sh b/t/t7612-merge-verify-signatures.sh
index e2b1df8..d99218a 100755
--- a/t/t7612-merge-verify-signatures.sh
+++ b/t/t7612-merge-verify-signatures.sh
@@ -103,4 +103,11 @@ test_expect_success GPG 'merge commit with bad signature with merge.verifySignat
git merge --no-verify-signatures $(cat forged.commit)
'
+test_expect_success GPG 'merge unsigned commit into unborn branch' '
+ test_when_finished "git checkout initial" &&
+ git checkout --orphan unborn &&
+ test_must_fail git merge --verify-signatures side-unsigned 2>mergeerror &&
+ test_i18ngrep "does not have a GPG signature" mergeerror
+'
+
test_done