t7510: add test cases for non-absolute gpg program
These cases cover scenarios where `gpg.program` is set as a program in `$PATH` or as a path relative to the user's home directory. Signed-off-by: Jonas Brandstötter <jonas.brandstoetter@gmx.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonas Brandstötter committed
Jul 22, 2025 at 21:09 UTC
26ef8872f1ccb095ef7d263edac1e844d6516bfd
1 file changed
+11
-1
t/t7510-signed-commit.sh
+11
-1
@@ -449,7 +449,17 @@ test_expect_success 'custom `gpg.program`' '
449
450
test_must_fail env LET_GPG_PROGRAM_FAIL=1 \
451
git commit -S --allow-empty -m must-fail 2>err &&
452
- grep zOMG err
452
+ grep zOMG err &&
453
+
454
+ # `gpg.program` starts with `~`, the path should be interpreted to be relative to `$HOME`
455
+ test_config gpg.program "~/fake-gpg" &&
456
+ env HOME="$(pwd)" \
457
+ git commit -S --allow-empty -m signed-commit &&
458
+
459
+ # `gpg.program` does not specify an absolute path, it should find a program in `$PATH`
460
+ test_config gpg.program "fake-gpg" &&
461
+ env PATH="$(pwd):$PATH" \
462
+ git commit -S --allow-empty -m signed-commit
463
'
464
465
test_done