3 # Copyright (c) 2019 Denton Liu
6 test_description
='Test submodules set-url subcommand
8 This test verifies that the set-url subcommand of git-submodule is working
15 test_expect_success
'setup' '
16 git config --global protocol.file.allow always
19 test_expect_success
'submodule config cache setup' '
28 mkdir namedsubmodule &&
40 git submodule add ../submodule &&
41 git submodule add --name thename ../namedsubmodule thepath &&
42 git commit -m "add submodules"
46 test_expect_success
'test submodule set-url' '
47 # add commits and move the submodules (change the urls)
54 mv submodule newsubmodule &&
62 mv namedsubmodule newnamedsubmodule &&
64 git -C newsubmodule show >expect &&
65 git -C newnamedsubmodule show >>expect &&
68 test_must_fail git submodule update --remote &&
69 git submodule set-url submodule ../newsubmodule &&
70 test_cmp_config ../newsubmodule -f .gitmodules submodule.submodule.url &&
71 git submodule set-url thepath ../newnamedsubmodule &&
72 test_cmp_config ../newnamedsubmodule -f .gitmodules submodule.thename.url &&
73 test_cmp_config "" -f .gitmodules --default "" submodule.thepath.url &&
74 git submodule update --remote
76 git -C super/submodule show >actual &&
77 git -C super/thepath show >>actual &&
78 test_cmp expect actual