tests: create gpg homedir on the fly

GnuPG 2.1 homedir looks different, so just create it on the fly by importing needed private and public keys and ownertrust. This solves an issue with gnupg 2.1 running interactive pinentry when old secret key is present. Signed-off-by: Christian Hesse <mail@eworm.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Christian Hesse committed Dec 12, 2014 at 09:50 UTC b41a36e635803f1dc011007e836ae244f9ae04c1
4 files changed +11 -3
t/lib-gpg.sh
+7 -3
@@ -16,11 +16,15 @@ else
16 # Type DSA and Elgamal, size 2048 bits, no expiration date.
17 # Name and email: C O Mitter <committer@example.com>
18 # No password given, to enable non-interactive operation.
19 - cp -R "$TEST_DIRECTORY"/lib-gpg ./gpghome
20 - chmod 0700 gpghome
21 - chmod 0600 gpghome/*
19 + mkdir ./gpghome
20 + chmod 0700 ./gpghome
21 GNUPGHOME="$(pwd)/gpghome"
22 export GNUPGHOME
23 + gpg --homedir "${GNUPGHOME}" --import \
24 + "$TEST_DIRECTORY"/lib-gpg/pubring.gpg \
25 + "$TEST_DIRECTORY"/lib-gpg/secring.gpg
26 + gpg --homedir "${GNUPGHOME}" --import-ownertrust \
27 + "$TEST_DIRECTORY"/lib-gpg/ownertrust
28 test_set_prereq GPG
29 ;;
30 esac
t/lib-gpg/ownertrust new
+4
@@ -0,0 +1,4 @@
1 +# List of assigned trustvalues, created Thu 11 Dec 2014 01:26:28 PM CET
2 +# (Use "gpg --import-ownertrust" to restore them)
3 +73D758744BE721698EC54E8713B6F51ECDDE430D:6:
4 +D4BE22311AD3131E5EDA29A461092E85B7227189:3:
t/lib-gpg/random_seed
Binary files a/t/lib-gpg/random_seed and /dev/null differ
t/lib-gpg/trustdb.gpg
Binary files a/t/lib-gpg/trustdb.gpg and /dev/null differ