mirror of
https://github.com/git/git
synced 2024-06-30 22:54:27 +00:00
t7420: test that we correctly handle renamed submodules
Create a second submodule with a name that differs from its path. Test that calling set-url modifies the correct .gitmodules entries. Make sure we don't create a section named after the path instead of the name. Signed-off-by: Jan Alexander Steffens (heftig) <heftig@archlinux.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
32bff3675e
commit
bd1c20ccd7
|
@ -25,17 +25,26 @@ test_expect_success 'submodule config cache setup' '
|
|||
git add file &&
|
||||
git commit -ma
|
||||
) &&
|
||||
mkdir namedsubmodule &&
|
||||
(
|
||||
cd namedsubmodule &&
|
||||
git init &&
|
||||
echo 1 >file &&
|
||||
git add file &&
|
||||
git commit -m1
|
||||
) &&
|
||||
mkdir super &&
|
||||
(
|
||||
cd super &&
|
||||
git init &&
|
||||
git submodule add ../submodule &&
|
||||
git commit -m "add submodule"
|
||||
git submodule add --name thename ../namedsubmodule thepath &&
|
||||
git commit -m "add submodules"
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'test submodule set-url' '
|
||||
# add a commit and move the submodule (change the url)
|
||||
# add commits and move the submodules (change the urls)
|
||||
(
|
||||
cd submodule &&
|
||||
echo b >>file &&
|
||||
|
@ -44,15 +53,28 @@ test_expect_success 'test submodule set-url' '
|
|||
) &&
|
||||
mv submodule newsubmodule &&
|
||||
|
||||
(
|
||||
cd namedsubmodule &&
|
||||
echo 2 >>file &&
|
||||
git add file &&
|
||||
git commit -m2
|
||||
) &&
|
||||
mv namedsubmodule newnamedsubmodule &&
|
||||
|
||||
git -C newsubmodule show >expect &&
|
||||
git -C newnamedsubmodule show >>expect &&
|
||||
(
|
||||
cd super &&
|
||||
test_must_fail git submodule update --remote &&
|
||||
git submodule set-url submodule ../newsubmodule &&
|
||||
test_cmp_config ../newsubmodule -f .gitmodules submodule.submodule.url &&
|
||||
git submodule set-url thepath ../newnamedsubmodule &&
|
||||
test_cmp_config ../newnamedsubmodule -f .gitmodules submodule.thename.url &&
|
||||
test_cmp_config "" -f .gitmodules --default "" submodule.thepath.url &&
|
||||
git submodule update --remote
|
||||
) &&
|
||||
git -C super/submodule show >actual &&
|
||||
git -C super/thepath show >>actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user