Skip to content

Commit 3a30c14

Browse files
committed
Merge branch 'jc/t2300-setup' into maint
Portability fix for Windows. * jc/t2300-setup: t2300: "git --exec-path" is not usable in $PATH on Windows as-is
2 parents 438d4e7 + 412b9a1 commit 3a30c14

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

t/t2300-cd-to-toplevel.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,19 @@ test_description='cd_to_toplevel'
44

55
. ./test-lib.sh
66

7+
EXEC_PATH="$(git --exec-path)"
8+
test_have_prereq !MINGW ||
9+
case "$EXEC_PATH" in
10+
[A-Za-z]:/*)
11+
EXEC_PATH="/${EXEC_PATH%%:*}${EXEC_PATH#?:}"
12+
;;
13+
esac
14+
715
test_cd_to_toplevel () {
816
test_expect_success $3 "$2" '
917
(
1018
cd '"'$1'"' &&
11-
PATH="$(git --exec-path):$PATH" &&
19+
PATH="$EXEC_PATH:$PATH" &&
1220
. git-sh-setup &&
1321
cd_to_toplevel &&
1422
[ "$(pwd -P)" = "$TOPLEVEL" ]

0 commit comments

Comments
 (0)