Skip to content

Commit 2f36339

Browse files
five-shgitster
authored andcommitted
t/lib-gpg: introduce new prereq GPG2
GnuPG v2.0.0 released in 2006, which according to its release notes https://gnupg.org/download/release_notes.html is the "First stable version of GnuPG integrating OpenPGP and S/MIME". Use this version or its successors for tests that will fail for versions less than v2.0.0 because of the difference in the output on stderr between the versions (v2.* vs v0.* or v2.* vs v1.*). Skip if the GPG version detected is less than v2.0.0. Do not, however, remove the existing prereq GPG yet since a lot of tests still work with the prereq GPG (that is even with versions v0.* or v1.*) and some systems still use these versions. Mentored-by: Christian Couder <[email protected]> Mentored-by: Hariom Verma <[email protected]> Signed-off-by: Kousik Sanagavarapu <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fe86abd commit 2f36339

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

t/lib-gpg.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,27 @@ test_lazy_prereq GPG '
5151
esac
5252
'
5353

54+
test_lazy_prereq GPG2 '
55+
gpg_version=$(gpg --version 2>&1)
56+
test $? != 127 || exit 1
57+
58+
case "$gpg_version" in
59+
"gpg (GnuPG) "[01].*)
60+
say "This test requires a GPG version >= v2.0.0"
61+
exit 1
62+
;;
63+
*)
64+
(gpgconf --kill all || : ) &&
65+
gpg --homedir "${GNUPGHOME}" --import \
66+
"$TEST_DIRECTORY"/lib-gpg/keyring.gpg &&
67+
gpg --homedir "${GNUPGHOME}" --import-ownertrust \
68+
"$TEST_DIRECTORY"/lib-gpg/ownertrust &&
69+
gpg --homedir "${GNUPGHOME}" </dev/null >/dev/null \
70+
71+
;;
72+
esac
73+
'
74+
5475
test_lazy_prereq GPGSM '
5576
test_have_prereq GPG &&
5677
# Available key info:

t/t7510-signed-commit.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,13 @@ test_expect_success GPG 'amending already signed commit' '
218218
! grep "BAD signature from" actual
219219
'
220220

221+
test_expect_success GPG2 'bare signature' '
222+
git verify-commit fifth-signed 2>expect &&
223+
echo >>expect &&
224+
git log -1 --format="%GG" fifth-signed >actual &&
225+
test_cmp expect actual
226+
'
227+
221228
test_expect_success GPG 'show good signature with custom format' '
222229
cat >expect <<-\EOF &&
223230
G

0 commit comments

Comments
 (0)