Skip to content

Commit dd1308a

Browse files
committed
mingw: work around t2300's assuming non-Windows paths
On Windows, we have to juggle two different schemes of representing paths: the native, Windows paths (the only ones known to the main Git executable) on the one hand, and POSIX-ish ones used by the Bash through MSYS2's POSIX emulation layer on the other hand. A Windows path looks like this: C:\git-sdk-64\usr\src\git. In modern Windows, it is almost always legal to use forward slashes as directory separators, which is the reason why the Git executable itself would use the path C:/git-sdk-64/usr/src/git instead. The equivalent POSIX-ish path would be: /c/git-sdk-64/usr/src/git. This patch works around the assumption of t2300-cd-to-toplevel.sh that `git --exec-path` spits out a POSIX-ish path, by converting the output accordingly. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent f8fbb1f commit dd1308a

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)