git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/1] mingw: work around t2300's assuming non-Windows paths

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jun 18, 2016, 10:49 UTC
Message-ID
<a8bebe126bcd047720a13e90b85b8dccb7231187.1466246919.git.johannes.schindelin@gmx.de>
In-Reply-To
<cover.1466246919.git.johannes.schindelin@gmx.de>

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>
---
 t/t2300-cd-to-toplevel.sh | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/t/t2300-cd-to-toplevel.sh b/t/t2300-cd-to-toplevel.sh
index cccd7d9..c8de6d8 100755
--- a/t/t2300-cd-to-toplevel.sh
+++ b/t/t2300-cd-to-toplevel.sh
@@ -4,11 +4,19 @@ test_description='cd_to_toplevel'
 
 . ./test-lib.sh
 
+EXEC_PATH="$(git --exec-path)"
+test_have_prereq !MINGW ||
+case "$EXEC_PATH" in
+[A-Za-z]:/*)
+	EXEC_PATH="/${EXEC_PATH%%:*}${EXEC_PATH#?:}"
+	;;
+esac
+
 test_cd_to_toplevel () {
 	test_expect_success $3 "$2" '
 		(
 			cd '"'$1'"' &&
-			PATH="$(git --exec-path):$PATH" &&
+			PATH="$EXEC_PATH:$PATH" &&
 			. git-sh-setup &&
 			cd_to_toplevel &&
 			[ "$(pwd -P)" = "$TOPLEVEL" ]
-- 
2.9.0.118.gce770ba.dirty
Previous: Johannes SchindelinNext: Junio C Hamano
Message 2 of 11 in “Fix testing of `master` on Windows”
  1. 0/1 Fix testing of `master` on WindowsJohannes Schindelin, Jun 18, 2016
  2. 1/1 mingw: work around t2300's assuming non-Windows pathsJohannes Schindelin, Jun 18, 2016
  3. Junio C HamanoJun 20, 2016
  4. Johannes SchindelinJun 21, 2016
  5. Junio C HamanoJun 21, 2016
  6. Junio C HamanoJun 21, 2016
  7. Johannes SchindelinJun 22, 2016
  8. Junio C HamanoJun 22, 2016
  9. Johannes SchindelinJun 22, 2016
  10. Junio C HamanoJun 22, 2016
  11. Johannes SchindelinJun 22, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.