Skip to content

Commit 8300d15

Browse files
dschogitster
authored andcommitted
t7510: add a test case that does not need gpg
This test case not only increases test coverage in setups without working gpg, but also prepares for verifying that the error message of `gpg.program` is shown upon failure. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 768bb23 commit 8300d15

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

t/t7510-signed-commit.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,4 +387,40 @@ test_expect_success GPG 'verify-commit verifies multiply signed commits' '
387387
! grep "BAD signature from" actual
388388
'
389389

390+
test_expect_success 'custom `gpg.program`' '
391+
write_script fake-gpg <<-\EOF &&
392+
args="$*"
393+
394+
# skip uninteresting options
395+
while case "$1" in
396+
--status-fd=*|--keyid-format=*) ;; # skip
397+
*) break;;
398+
esac; do shift; done
399+
400+
case "$1" in
401+
-bsau)
402+
cat >sign.file
403+
echo "[GNUPG:] SIG_CREATED $args" >&2
404+
echo "-----BEGIN PGP MESSAGE-----"
405+
echo "$args"
406+
echo "-----END PGP MESSAGE-----"
407+
;;
408+
--verify)
409+
cat "$2" >verify.file
410+
exit 0
411+
;;
412+
*)
413+
echo "Unhandled args: $*" >&2
414+
exit 1
415+
;;
416+
esac
417+
EOF
418+
419+
test_config gpg.program "$(pwd)/fake-gpg" &&
420+
git commit -S --allow-empty -m signed-commit &&
421+
test_path_exists sign.file &&
422+
git show --show-signature &&
423+
test_path_exists verify.file
424+
'
425+
390426
test_done

0 commit comments

Comments
 (0)