Skip to content

Commit 2711b1a

Browse files
avargitster
authored andcommitted
submodule: add more exhaustive up-path testing
The tests added in 63e95be ("submodule: port resolve_relative_url from shell to C", 2016-04-15) didn't do a good job of testing various up-path invocations where the up-path would bring us beyond even the URL in question without emitting an error. These results look nonsensical, but it's worth exhaustively testing them before fixing any of this code, so we can see which of these cases were changed. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Acked-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 53f9a3e commit 2711b1a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

t/t0060-path-utils.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ test_submodule_relative_url "(null)" "../foo" "../submodule" "../submodule"
330330
test_submodule_relative_url "(null)" "./foo/bar" "../submodule" "foo/submodule"
331331
test_submodule_relative_url "(null)" "./foo" "../submodule" "submodule"
332332
test_submodule_relative_url "(null)" "//somewhere else/repo" "../subrepo" "//somewhere else/subrepo"
333+
test_submodule_relative_url "(null)" "//somewhere else/repo" "../../subrepo" "//subrepo"
334+
test_submodule_relative_url "(null)" "//somewhere else/repo" "../../../subrepo" "/subrepo"
335+
test_submodule_relative_url "(null)" "//somewhere else/repo" "../../../../subrepo" "subrepo"
333336
test_submodule_relative_url "(null)" "$(pwd)/subsuper_update_r" "../subsubsuper_update_r" "$(pwd)/subsubsuper_update_r"
334337
test_submodule_relative_url "(null)" "$(pwd)/super_update_r2" "../subsuper_update_r" "$(pwd)/subsuper_update_r"
335338
test_submodule_relative_url "(null)" "$(pwd)/." "../." "$(pwd)/."
@@ -344,10 +347,20 @@ test_submodule_relative_url "(null)" "file:///tmp/repo" "../subrepo" "file:///tm
344347
test_submodule_relative_url "(null)" "foo/bar" "../submodule" "foo/submodule"
345348
test_submodule_relative_url "(null)" "foo" "../submodule" "submodule"
346349
test_submodule_relative_url "(null)" "helper:://hostname/repo" "../subrepo" "helper:://hostname/subrepo"
350+
test_submodule_relative_url "(null)" "helper:://hostname/repo" "../../subrepo" "helper:://subrepo"
351+
test_submodule_relative_url "(null)" "helper:://hostname/repo" "../../../subrepo" "helper::/subrepo"
352+
test_submodule_relative_url "(null)" "helper:://hostname/repo" "../../../../subrepo" "helper::subrepo"
353+
test_submodule_relative_url "(null)" "helper:://hostname/repo" "../../../../../subrepo" "helper:subrepo"
354+
test_submodule_relative_url "(null)" "helper:://hostname/repo" "../../../../../../subrepo" ".:subrepo"
347355
test_submodule_relative_url "(null)" "ssh://hostname/repo" "../subrepo" "ssh://hostname/subrepo"
356+
test_submodule_relative_url "(null)" "ssh://hostname/repo" "../../subrepo" "ssh://subrepo"
357+
test_submodule_relative_url "(null)" "ssh://hostname/repo" "../../../subrepo" "ssh:/subrepo"
358+
test_submodule_relative_url "(null)" "ssh://hostname/repo" "../../../../subrepo" "ssh:subrepo"
359+
test_submodule_relative_url "(null)" "ssh://hostname/repo" "../../../../../subrepo" ".:subrepo"
348360
test_submodule_relative_url "(null)" "ssh://hostname:22/repo" "../subrepo" "ssh://hostname:22/subrepo"
349361
test_submodule_relative_url "(null)" "user@host:path/to/repo" "../subrepo" "user@host:path/to/subrepo"
350362
test_submodule_relative_url "(null)" "user@host:repo" "../subrepo" "user@host:subrepo"
363+
test_submodule_relative_url "(null)" "user@host:repo" "../../subrepo" ".:subrepo"
351364

352365
test_expect_success 'match .gitmodules' '
353366
test-tool path-utils is_dotgitmodules \

0 commit comments

Comments
 (0)