t7400: avoid path mangling issues
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. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Sixt committed
Jun 14, 2012 at 14:10 UTC
c517e73d0f116f8293f1fbc7f92bb60ea8047b0f
1 file changed
+8
-3
t/t7400-submodule-basic.sh
+8
-3
@@ -510,14 +510,19 @@ test_expect_success '../subrepo works with port-qualified URL - ssh://hostname:2
510
)
511
'
512
513
-test_expect_success '../subrepo path works with local path - /foo/repo' '
513
+# About the choice of the path in the next test:
514
+# - double-slash side-steps path mangling issues on Windows
515
+# - it is still an absolute local path
516
+# - there cannot be a server with a blank in its name just in case the
517
+# path is used erroneously to access a //server/share style path
518
+test_expect_success '../subrepo path works with local path - //somewhere else/repo' '
519
(
520
cd reltest &&
521
cp pristine-.git-config .git/config &&
522
cp pristine-.gitmodules .gitmodules &&
518
- git config remote.origin.url /foo/repo &&
523
+ git config remote.origin.url "//somewhere else/repo" &&
524
git submodule init &&
520
- test "$(git config submodule.sub.url)" = /foo/subrepo
525
+ test "$(git config submodule.sub.url)" = "//somewhere else/subrepo"
526
)
527
'
528