Skip to content

Commit

Permalink
tests: create gpg homedir on the fly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christian Hesse authored and Junio C Hamano committed Dec 12, 2014
1 parent 8213d87 commit b41a36e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
10 changes: 7 additions & 3 deletions t/lib-gpg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ else
# Type DSA and Elgamal, size 2048 bits, no expiration date.
# Name and email: C O Mitter <committer@example.com>
# No password given, to enable non-interactive operation.
cp -R "$TEST_DIRECTORY"/lib-gpg ./gpghome
chmod 0700 gpghome
chmod 0600 gpghome/*
mkdir ./gpghome
chmod 0700 ./gpghome
GNUPGHOME="$(pwd)/gpghome"
export GNUPGHOME
gpg --homedir "${GNUPGHOME}" --import \
"$TEST_DIRECTORY"/lib-gpg/pubring.gpg \
"$TEST_DIRECTORY"/lib-gpg/secring.gpg
gpg --homedir "${GNUPGHOME}" --import-ownertrust \
"$TEST_DIRECTORY"/lib-gpg/ownertrust
test_set_prereq GPG
;;
esac
Expand Down
4 changes: 4 additions & 0 deletions t/lib-gpg/ownertrust
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# List of assigned trustvalues, created Thu 11 Dec 2014 01:26:28 PM CET
# (Use "gpg --import-ownertrust" to restore them)
73D758744BE721698EC54E8713B6F51ECDDE430D:6:
D4BE22311AD3131E5EDA29A461092E85B7227189:3:
Binary file removed t/lib-gpg/random_seed
Binary file not shown.
Binary file removed t/lib-gpg/trustdb.gpg
Binary file not shown.

0 comments on commit b41a36e

Please sign in to comment.