Skip to content

Commit 279976c

Browse files
committed
tests: prepend to PATH with $PATH_SEP, not a literal ":"
Several tests make a script in the current directory findable by git-spawned helpers (a fake gpg, a fake editor, ...) by prepending $PWD to PATH as `PATH="$PWD:$PATH"`. The literal ":" is the POSIX path-list separator, which is what the MSYS2 Bash uses, but BusyBox' ash speaks to Win32 directly and its PATH is ";"-separated. The hardcoded ":" then glues $PWD onto the first real entry, so for instance t7510's `gpg.program=fake-gpg` can no longer be found and the commit aborts with "cannot spawn fake-gpg: No such file or directory". test-lib already computes the correct separator in $PATH_SEP (";" when the inherited PATH contains one, ":" otherwise); use it. This is a no-op for the existing POSIX and MSYS2 callers and fixes the BusyBox runs. Assisted-by: Opus 4.8 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 68c3915 commit 279976c

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

t/t3430-rebase-merges.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ test_expect_success 'merge -c rewords when a strategy is given' '
234234
git add G.t
235235
EOF
236236
237-
PATH="$PWD:$PATH" \
237+
PATH="$PWD$PATH_SEP$PATH" \
238238
GIT_SEQUENCE_EDITOR="echo merge -c H G >" \
239239
GIT_EDITOR="echo edited >>" \
240240
git rebase --no-ff -ir -s override -Xxopt E &&
@@ -570,7 +570,7 @@ test_expect_success '--rebase-merges with strategies' '
570570
echo overridden$1 >>G.t
571571
git add G.t
572572
EOF
573-
PATH="$PWD:$PATH" git rebase -ir -s override -Xxopt G &&
573+
PATH="$PWD$PATH_SEP$PATH" git rebase -ir -s override -Xxopt G &&
574574
test_write_lines G overridden--xopt >expect &&
575575
test_cmp expect G.t
576576
'

t/t5801-remote-helpers.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ test_expect_success 'totally broken helper reports failure message' '
350350
exit 1
351351
EOF
352352
test_must_fail \
353-
env PATH="$PWD:$PATH" \
353+
env PATH="$PWD$PATH_SEP$PATH" \
354354
git clone broken://example.com/foo.git 2>stderr &&
355355
grep aborted stderr
356356
'

t/t7005-editor.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ do
5858
export $i
5959
;;
6060
esac &&
61-
PATH="$PWD:$PATH" TERM=vt100 git commit --amend
61+
PATH="$PWD$PATH_SEP$PATH" TERM=vt100 git commit --amend
6262
) &&
6363
test_commit_message HEAD -m "Edited by $i"
6464
'
@@ -80,7 +80,7 @@ test_expect_success 'Using editors with overrides' '
8080
export $i
8181
;;
8282
esac &&
83-
PATH="$PWD:$PATH" git commit --amend &&
83+
PATH="$PWD$PATH_SEP$PATH" git commit --amend &&
8484
test_commit_message HEAD expect || exit 1
8585
done
8686
)

t/t7510-signed-commit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ test_expect_success 'custom `gpg.program`' '
458458
459459
# `gpg.program` does not specify an absolute path, it should find a program in `$PATH`
460460
test_config gpg.program "fake-gpg" &&
461-
env PATH="$PWD:$PATH" \
461+
env PATH="$PWD$PATH_SEP$PATH" \
462462
git commit -S --allow-empty -m signed-commit
463463
'
464464

t/t9001-send-email.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2621,7 +2621,7 @@ test_expect_success $PREREQ 'mailmap support in Cc header' '
26212621

26222622
test_expect_success $PREREQ 'test using command name with --sendmail-cmd' '
26232623
clean_fake_sendmail &&
2624-
PATH="$PWD:$PATH" \
2624+
PATH="$PWD$PATH_SEP$PATH" \
26252625
git send-email \
26262626
--from="Example <nobody@example.com>" \
26272627
--to=nobody@example.com \

0 commit comments

Comments
 (0)