]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t7510: add test cases for non-absolute gpg program
authorJonas Brandstötter <jonas.brandstoetter@gmx.at>
Tue, 22 Jul 2025 19:09:22 +0000 (21:09 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 22 Jul 2025 20:28:58 +0000 (13:28 -0700)
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>
t/t7510-signed-commit.sh

index 39677e859ab31173f7eaa36df1a0d3ecfe285abf..95d2ebe27793f07c10667931c671d1e1f56b1bcf 100755 (executable)
@@ -449,7 +449,17 @@ test_expect_success 'custom `gpg.program`' '
 
        test_must_fail env LET_GPG_PROGRAM_FAIL=1 \
        git commit -S --allow-empty -m must-fail 2>err &&
-       grep zOMG err
+       grep zOMG err &&
+
+       # `gpg.program` starts with `~`, the path should be interpreted to be relative to `$HOME`
+       test_config gpg.program "~/fake-gpg" &&
+       env HOME="$(pwd)" \
+       git commit -S --allow-empty -m signed-commit &&
+
+       # `gpg.program` does not specify an absolute path, it should find a program in `$PATH`
+       test_config gpg.program "fake-gpg" &&
+       env PATH="$(pwd):$PATH" \
+       git commit -S --allow-empty -m signed-commit
 '
 
 test_done