Code

t7004: extract generic "GPG testing" bits
[git.git] / t / lib-gpg.sh
1 #!/bin/sh
3 # Check if gpg is available
4 gpg --version >/dev/null 2>/dev/null
5 if [ $? -eq 127 ]; then
6         say "# gpg not found - skipping tag signing and verification tests"
7 else
8         # As said here: http://www.gnupg.org/documentation/faqs.html#q6.19
9         # the gpg version 1.0.6 didn't parse trust packets correctly, so for
10         # that version, creation of signed tags using the generated key fails.
11         case "$(gpg --version)" in
12         'gpg (GnuPG) 1.0.6'*)
13                 say "Skipping signed tag tests, because a bug in 1.0.6 version"
14                 ;;
15         *)
16                 test_set_prereq GPG
17                 ;;
18         esac
19 fi
21 # key generation info: gpg --homedir t/t7004 --gen-key
22 # Type DSA and Elgamal, size 2048 bits, no expiration date.
23 # Name and email: C O Mitter <committer@example.com>
24 # No password given, to enable non-interactive operation.
26 cp -R "$TEST_DIRECTORY"/lib-gpg ./gpghome
27 chmod 0700 gpghome
28 GNUPGHOME="$(pwd)/gpghome"
29 export GNUPGHOME