@@ -35,27 +35,72 @@ test_expect_success GPG 'create signed commits' '
35
35
'
36
36
37
37
test_expect_success GPG ' merge unsigned commit with verification' '
38
+ test_when_finished "git reset --hard && git checkout initial" &&
38
39
test_must_fail git merge --ff-only --verify-signatures side-unsigned 2>mergeerror &&
39
40
test_i18ngrep "does not have a GPG signature" mergeerror
40
41
'
41
42
43
+ test_expect_success GPG ' merge unsigned commit with merge.verifySignatures=true' '
44
+ test_when_finished "git reset --hard && git checkout initial" &&
45
+ test_config merge.verifySignatures true &&
46
+ test_must_fail git merge --ff-only side-unsigned 2>mergeerror &&
47
+ test_i18ngrep "does not have a GPG signature" mergeerror
48
+ '
49
+
42
50
test_expect_success GPG ' merge commit with bad signature with verification' '
51
+ test_when_finished "git reset --hard && git checkout initial" &&
43
52
test_must_fail git merge --ff-only --verify-signatures $(cat forged.commit) 2>mergeerror &&
44
53
test_i18ngrep "has a bad GPG signature" mergeerror
45
54
'
46
55
56
+ test_expect_success GPG ' merge commit with bad signature with merge.verifySignatures=true' '
57
+ test_when_finished "git reset --hard && git checkout initial" &&
58
+ test_config merge.verifySignatures true &&
59
+ test_must_fail git merge --ff-only $(cat forged.commit) 2>mergeerror &&
60
+ test_i18ngrep "has a bad GPG signature" mergeerror
61
+ '
62
+
47
63
test_expect_success GPG ' merge commit with untrusted signature with verification' '
64
+ test_when_finished "git reset --hard && git checkout initial" &&
48
65
test_must_fail git merge --ff-only --verify-signatures side-untrusted 2>mergeerror &&
49
66
test_i18ngrep "has an untrusted GPG signature" mergeerror
50
67
'
51
68
69
+ test_expect_success GPG ' merge commit with untrusted signature with merge.verifySignatures=true' '
70
+ test_when_finished "git reset --hard && git checkout initial" &&
71
+ test_config merge.verifySignatures true &&
72
+ test_must_fail git merge --ff-only side-untrusted 2>mergeerror &&
73
+ test_i18ngrep "has an untrusted GPG signature" mergeerror
74
+ '
75
+
52
76
test_expect_success GPG ' merge signed commit with verification' '
77
+ test_when_finished "git reset --hard && git checkout initial" &&
53
78
git merge --verbose --ff-only --verify-signatures side-signed >mergeoutput &&
54
79
test_i18ngrep "has a good GPG signature" mergeoutput
55
80
'
56
81
82
+ test_expect_success GPG ' merge signed commit with merge.verifySignatures=true' '
83
+ test_when_finished "git reset --hard && git checkout initial" &&
84
+ test_config merge.verifySignatures true &&
85
+ git merge --verbose --ff-only side-signed >mergeoutput &&
86
+ test_i18ngrep "has a good GPG signature" mergeoutput
87
+ '
88
+
57
89
test_expect_success GPG ' merge commit with bad signature without verification' '
90
+ test_when_finished "git reset --hard && git checkout initial" &&
91
+ git merge $(cat forged.commit)
92
+ '
93
+
94
+ test_expect_success GPG ' merge commit with bad signature with merge.verifySignatures=false' '
95
+ test_when_finished "git reset --hard && git checkout initial" &&
96
+ test_config merge.verifySignatures false &&
58
97
git merge $(cat forged.commit)
59
98
'
60
99
100
+ test_expect_success GPG ' merge commit with bad signature with merge.verifySignatures=true and --no-verify-signatures' '
101
+ test_when_finished "git reset --hard && git checkout initial" &&
102
+ test_config merge.verifySignatures true &&
103
+ git merge --no-verify-signatures $(cat forged.commit)
104
+ '
105
+
61
106
test_done
0 commit comments