merge: refuse --commit with --squash
[gitweb.git] / t / lib-gpg.sh
index a5d3b2cbaad4edd078b8d58160dc4252ce8adec9..8d28652b729b46cb08de8ddd4347dddda9e246a7 100755 (executable)
@@ -38,7 +38,35 @@ then
                        "$TEST_DIRECTORY"/lib-gpg/ownertrust &&
                gpg --homedir "${GNUPGHOME}" </dev/null >/dev/null 2>&1 \
                        --sign -u committer@example.com &&
-               test_set_prereq GPG
+               test_set_prereq GPG &&
+               # Available key info:
+               # * see t/lib-gpg/gpgsm-gen-key.in
+               # To generate new certificate:
+               #  * no passphrase
+               #       gpgsm --homedir /tmp/gpghome/ \
+               #               -o /tmp/gpgsm.crt.user \
+               #               --generate-key \
+               #               --batch t/lib-gpg/gpgsm-gen-key.in
+               # To import certificate:
+               #       gpgsm --homedir /tmp/gpghome/ \
+               #               --import /tmp/gpgsm.crt.user
+               # To export into a .p12 we can later import:
+               #       gpgsm --homedir /tmp/gpghome/ \
+               #               -o t/lib-gpg/gpgsm_cert.p12 \
+               #               --export-secret-key-p12 "committer@example.com"
+               echo | gpgsm --homedir "${GNUPGHOME}" 2>/dev/null \
+                       --passphrase-fd 0 --pinentry-mode loopback \
+                       --import "$TEST_DIRECTORY"/lib-gpg/gpgsm_cert.p12 &&
+
+               gpgsm --homedir "${GNUPGHOME}" 2>/dev/null -K |
+               grep fingerprint: |
+               cut -d" " -f4 |
+               tr -d '\n' >"${GNUPGHOME}/trustlist.txt" &&
+
+               echo " S relax" >>"${GNUPGHOME}/trustlist.txt" &&
+               echo hello | gpgsm --homedir "${GNUPGHOME}" >/dev/null \
+                       -u committer@example.com -o /dev/null --sign - 2>&1 &&
+               test_set_prereq GPGSM
                ;;
        esac
 fi