submodule: document failure to handle relative superproject origin URLs
This test case documents several cases where handling of relative superproject origin URLs doesn't produce an expected result. submodule.{sub}.url in the superproject is incorrect in these cases: foo ./foo ./foo/bar The remote.origin.url of the submodule is incorrect in the above cases and also when the superproject origin URL is like: foo/bar ../foo ../foo/bar Signed-off-by: Jon Seymour <jon.seymour@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
712693e8db
commit
49301c64f3
@ -564,6 +564,18 @@ test_expect_success '../subrepo works with scp-style URL - user@host:path/to/rep
|
|||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_failure '../subrepo works with relative local path - foo' '
|
||||||
|
(
|
||||||
|
cd reltest &&
|
||||||
|
cp pristine-.git-config .git/config &&
|
||||||
|
cp pristine-.gitmodules .gitmodules &&
|
||||||
|
git config remote.origin.url foo &&
|
||||||
|
# actual: fails with an error
|
||||||
|
git submodule init &&
|
||||||
|
test "$(git config submodule.sub.url)" = subrepo
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success '../subrepo works with relative local path - foo/bar' '
|
test_expect_success '../subrepo works with relative local path - foo/bar' '
|
||||||
(
|
(
|
||||||
cd reltest &&
|
cd reltest &&
|
||||||
@ -575,6 +587,28 @@ test_expect_success '../subrepo works with relative local path - foo/bar' '
|
|||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_failure '../subrepo works with relative local path - ./foo' '
|
||||||
|
(
|
||||||
|
cd reltest &&
|
||||||
|
cp pristine-.git-config .git/config &&
|
||||||
|
cp pristine-.gitmodules .gitmodules &&
|
||||||
|
git config remote.origin.url ./foo &&
|
||||||
|
git submodule init &&
|
||||||
|
test "$(git config submodule.sub.url)" = subrepo
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_failure '../subrepo works with relative local path - ./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 '../subrepo works with relative local path - ../foo' '
|
test_expect_success '../subrepo works with relative local path - ../foo' '
|
||||||
(
|
(
|
||||||
cd reltest &&
|
cd reltest &&
|
||||||
|
@ -26,7 +26,9 @@ test_expect_success setup '
|
|||||||
(cd super-clone && git submodule update --init) &&
|
(cd super-clone && git submodule update --init) &&
|
||||||
git clone super empty-clone &&
|
git clone super empty-clone &&
|
||||||
(cd empty-clone && git submodule init) &&
|
(cd empty-clone && git submodule init) &&
|
||||||
git clone super top-only-clone
|
git clone super top-only-clone &&
|
||||||
|
git clone super relative-clone &&
|
||||||
|
(cd relative-clone && git submodule update --init)
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'change submodule' '
|
test_expect_success 'change submodule' '
|
||||||
@ -86,4 +88,90 @@ test_expect_success '"git submodule sync" should not vivify uninteresting submod
|
|||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_failure '"git submodule sync" handles origin URL of the form foo' '
|
||||||
|
(cd relative-clone &&
|
||||||
|
git remote set-url origin foo &&
|
||||||
|
git submodule sync &&
|
||||||
|
(cd submodule &&
|
||||||
|
#actual fails with: "cannot strip off url foo
|
||||||
|
test "$(git config remote.origin.url)" = "../submodule"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_failure '"git submodule sync" handles origin URL of the form foo/bar' '
|
||||||
|
(cd relative-clone &&
|
||||||
|
git remote set-url origin foo/bar &&
|
||||||
|
git submodule sync &&
|
||||||
|
(cd submodule &&
|
||||||
|
#actual foo/submodule
|
||||||
|
test "$(git config remote.origin.url)" = "../foo/submodule"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_failure '"git submodule sync" handles origin URL of the form ./foo' '
|
||||||
|
(cd relative-clone &&
|
||||||
|
git remote set-url origin ./foo &&
|
||||||
|
git submodule sync &&
|
||||||
|
(cd submodule &&
|
||||||
|
#actual ./submodule
|
||||||
|
test "$(git config remote.origin.url)" = "../submodule"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_failure '"git submodule sync" handles origin URL of the form ./foo/bar' '
|
||||||
|
(cd relative-clone &&
|
||||||
|
git remote set-url origin ./foo/bar &&
|
||||||
|
git submodule sync &&
|
||||||
|
(cd submodule &&
|
||||||
|
#actual ./foo/submodule
|
||||||
|
test "$(git config remote.origin.url)" = "../foo/submodule"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_failure '"git submodule sync" handles origin URL of the form ../foo' '
|
||||||
|
(cd relative-clone &&
|
||||||
|
git remote set-url origin ../foo &&
|
||||||
|
git submodule sync &&
|
||||||
|
(cd submodule &&
|
||||||
|
#actual ../submodule
|
||||||
|
test "$(git config remote.origin.url)" = "../../submodule"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_failure '"git submodule sync" handles origin URL of the form ../foo/bar' '
|
||||||
|
(cd relative-clone &&
|
||||||
|
git remote set-url origin ../foo/bar &&
|
||||||
|
git submodule sync &&
|
||||||
|
(cd submodule &&
|
||||||
|
#actual ../foo/submodule
|
||||||
|
test "$(git config remote.origin.url)" = "../../foo/submodule"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_failure '"git submodule sync" handles origin URL of the form ../foo/bar with deeply nested submodule' '
|
||||||
|
(cd relative-clone &&
|
||||||
|
git remote set-url origin ../foo/bar &&
|
||||||
|
mkdir -p a/b/c &&
|
||||||
|
( cd a/b/c &&
|
||||||
|
git init &&
|
||||||
|
:> .gitignore &&
|
||||||
|
git add .gitignore &&
|
||||||
|
test_tick &&
|
||||||
|
git commit -m "initial commit" ) &&
|
||||||
|
git submodule add ../bar/a/b/c ./a/b/c &&
|
||||||
|
git submodule sync &&
|
||||||
|
(cd a/b/c &&
|
||||||
|
#actual ../foo/bar/a/b/c
|
||||||
|
test "$(git config remote.origin.url)" = "../../../../foo/bar/a/b/c"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Reference in New Issue
Block a user