Code

submodule: fix relative url parsing for scp-style origin
[git.git] / t / t7400-submodule-basic.sh
index 1a4dc5f89353df7d7bda4bea539ee5bd7a3b9bae..8b004f60d68561d0a4d6701bfc0ad8525a596117 100755 (executable)
@@ -331,4 +331,42 @@ test_expect_success 'add submodules without specifying an explicit path' '
        git config -f .gitmodules submodule.bare.path bare
 '
 
+test_expect_success 'set up for relative path tests' '
+       mkdir reltest &&
+       (
+               cd reltest &&
+               git init &&
+               mkdir sub &&
+               (
+                       cd sub &&
+                       git init &&
+                       test_commit foo
+               ) &&
+               git add sub &&
+               git config -f .gitmodules submodule.sub.path sub &&
+               git config -f .gitmodules submodule.sub.url ../subrepo &&
+               cp .git/config pristine-.git-config
+       )
+'
+
+test_expect_success 'relative path works with URL' '
+       (
+               cd reltest &&
+               cp pristine-.git-config .git/config &&
+               git config remote.origin.url ssh://hostname/repo &&
+               git submodule init &&
+               test "$(git config submodule.sub.url)" = ssh://hostname/subrepo
+       )
+'
+
+test_expect_success 'relative path works with user@host:path' '
+       (
+               cd reltest &&
+               cp pristine-.git-config .git/config &&
+               git config remote.origin.url user@host:repo &&
+               git submodule init &&
+               test "$(git config submodule.sub.url)" = user@host:subrepo
+       )
+'
+
 test_done