Skip to contentSkip to conversation

t7400: avoid path mangling issues

PATCH In review Johannes Sixt 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t7400: avoid path mangling issues

From: Johannes Sixt <[email protected]>

A recently introduced test uses an absolute path. But when run on Windows using the MSYS bash, such a path is mangled into a Windows style path when it is passed to 'git config'. The subsequent 'test' then compares the mangled path to the unmangled version and reports a failure.

A path beginning with two slashes denotes a network directory (//server/share path) and is not mangled. Use that trick to side-step the issue. Just in case that 'git submodule init' regresses in such a way that it accesses the URL, use a path name that is unlikely to exist on POSIX systems, and that cannot be a server name on Windows.

---
Sorry, Jon, Junio, for the resend. Forgot to Cc the list.

 t/t7400-submodule-basic.sh | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
t/t7400-submodule-basic.sh +8 -3
index a899e6d..c73bec9 100755
@@ -510,14 +510,19 @@ test_expect_success '../subrepo works with port-qualified URL - ssh://hostname:2
 	)
 '
 
-test_expect_success '../subrepo path works with local path - /foo/repo' '
+# About the choice of the path in the next test:
+# - double-slash side-steps path mangling issues on Windows
+# - it is still an absolute local path
+# - there cannot be a server with a blank in its name just in case the
+#   path is used erroneously to access a //server/share style path
+test_expect_success '../subrepo path works with local path - //somewhere else/repo' '
 	(
 		cd reltest &&
 		cp pristine-.git-config .git/config &&
 		cp pristine-.gitmodules .gitmodules &&
-		git config remote.origin.url /foo/repo &&
+		git config remote.origin.url "//somewhere else/repo" &&
 		git submodule init &&
-		test "$(git config submodule.sub.url)" = /foo/subrepo
+		test "$(git config submodule.sub.url)" = "//somewhere else/subrepo"
 	)
 '
 
Signature · 1 line
1.7.11.rc3.1188.ga03e3fc
#1 lore raw
Quoted 47 lines · Johannes Sixt

From: Johannes Sixt <[email protected]>

A recently introduced test uses an absolute path. But when run on Windows using the MSYS bash, such a path is mangled into a Windows style path when it is passed to 'git config'. The subsequent 'test' then compares the mangled path to the unmangled version and reports a failure.

A path beginning with two slashes denotes a network directory (//server/share path) and is not mangled. Use that trick to side-step the issue. Just in case that 'git submodule init' regresses in such a way that it accesses the URL, use a path name that is unlikely to exist on POSIX systems, and that cannot be a server name on Windows.

---
 Sorry, Jon, Junio, for the resend. Forgot to Cc the list.

 t/t7400-submodule-basic.sh | 11 ++++++++---

 1 file changed, 8 insertions(+), 3 deletions(-)
t/t7400-submodule-basic.sh +0 -0
index a899e6d..c73bec9 100755
@@ -510,14 +510,19 @@ test_expect_success '../subrepo works with port-qualified URL - ssh://hostname:2
        )

 '

t/t7400-submodule-basic.sh +6 -1
-test_expect_success '../subrepo path works with local path - /foo/repo' '
+# About the choice of the path in the next test:
+# - double-slash side-steps path mangling issues on Windows
+# - it is still an absolute local path
+# - there cannot be a server with a blank in its name just in case the
+#   path is used erroneously to access a //server/share style path
+test_expect_success '../subrepo path works with local path - //somewhere else/repo' '

       (
               cd reltest &&
               cp pristine-.git-config .git/config &&
               cp pristine-.gitmodules .gitmodules &&
-               git config remote.origin.url /foo/repo &&
+               git config remote.origin.url "//somewhere else/repo" && git submodule init &&
-               test "$(git config submodule.sub.url)" = /foo/subrepo
+               test "$(git config submodule.sub.url)" = "//somewhere else/subrepo" )
 '

Quoted 2 lines

--
1.7.11.rc3.1188.ga03e3fc

Thank you for the report and the test case.

jon.