Skip to content

Commit 26ef887

Browse files
424evergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7d275cd commit 26ef887

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

t/t7510-signed-commit.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,17 @@ test_expect_success 'custom `gpg.program`' '
449449
450450
test_must_fail env LET_GPG_PROGRAM_FAIL=1 \
451451
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
453463
'
454464

455465
test_done

0 commit comments

Comments
 (0)