These tests document failures to properly handle improperly normalized remote origin URLs. Signed-off-by: Jon Seymour <jon.seymour@xxxxxxxxx> --- t/t7400-submodule-basic.sh | 88 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index 80ec0f7..2674088 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -499,6 +499,39 @@ test_expect_success '../subrepo works with URL - ssh://hostname/repo' ' ) ' +test_expect_failure 'relative path works with URL - ssh://hostname/path/././repo' ' + ( + cd reltest && + cp pristine-.git-config .git/config && + cp pristine-.gitmodules .gitmodules && + git config remote.origin.url ssh://hostname/path/././repo && + git submodule init && + test "$(git config submodule.sub.url)" = ssh://hostname/path/subrepo + ) +' + +test_expect_failure 'relative path works with URL - ssh://hostname/path/detour/././../repo' ' + ( + cd reltest && + cp pristine-.git-config .git/config && + cp pristine-.gitmodules .gitmodules && + git config remote.origin.url ssh://hostname/path/detour/././../repo && + git submodule init && + test "$(git config submodule.sub.url)" = ssh://hostname/path/subrepo + ) +' + +test_expect_failure 'relative path works with URL - ssh://hostname/path/repo/.' ' + ( + cd reltest && + cp pristine-.git-config .git/config && + cp pristine-.gitmodules .gitmodules && + git config remote.origin.url ssh://hostname/path/repo/. && + git submodule init && + test "$(git config submodule.sub.url)" = ssh://hostname/path/subrepo + ) +' + test_expect_success '../subrepo works with port-qualified URL - ssh://hostname:22/repo' ' ( cd reltest && @@ -634,6 +667,50 @@ test_expect_success '../subrepo works with scp-style URL - user@host:path/to/rep ) ' +test_expect_failure 'relative path works with user@host:path/to/repo/.' ' + ( + cd reltest && + cp pristine-.git-config .git/config && + cp pristine-.gitmodules .gitmodules && + git config remote.origin.url user@host:path/to/repo/. && + git submodule init && + test "$(git config submodule.sub.url)" = user@host:path/to/subrepo + ) +' + +test_expect_failure 'relative path works with user@host:path/to/./repo' ' + ( + cd reltest && + cp pristine-.git-config .git/config && + cp pristine-.gitmodules .gitmodules && + git config remote.origin.url user@host:path/to/./repo && + git submodule init && + test "$(git config submodule.sub.url)" = user@host:path/to/subrepo + ) +' + +test_expect_failure 'relative path works with user@host:path/to/././repo' ' + ( + cd reltest && + cp pristine-.git-config .git/config && + cp pristine-.gitmodules .gitmodules && + git config remote.origin.url user@host:path/to/././repo && + git submodule init && + test "$(git config submodule.sub.url)" = user@host:path/to/subrepo + ) +' + +test_expect_failure 'relative path works with user@host:path/to/detour/../repo' ' + ( + cd reltest && + cp pristine-.git-config .git/config && + cp pristine-.gitmodules .gitmodules && + git config remote.origin.url user@host:path/to/detour/../repo && + git submodule init && + test "$(git config submodule.sub.url)" = user@host:path/to/subrepo + ) +' + test_expect_failure '../subrepo works with relative local path - foo' ' ( cd reltest && @@ -703,6 +780,17 @@ test_expect_success '../subrepo works with relative local path - ../foo/bar' ' ) ' +test_expect_failure 'relative path works with ../foo/./bar' ' + ( + cd reltest && + cp pristine-.git-config .git/config && + cp pristine-.gitmodules .gitmodules && + git config remote.origin.url ../foo/./bar && + git submodule init && + test "$(git config submodule.sub.url)" = ../foo/subrepo + ) +' + test_expect_success '../bar/a/b/c works with relative local path - ../foo/bar.git' ' ( cd reltest && -- 1.7.10.2.656.gb5a46db -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html