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
13 TEST_PASSES_SANITIZE_LEAK
=true
16 test_expect_success
'setup' '
17 git config --global protocol.file.allow always
20 test_expect_success
'submodule config cache setup' '
29 mkdir namedsubmodule &&
41 git submodule add ../submodule &&
42 git submodule add --name thename ../namedsubmodule thepath &&
43 git commit -m "add submodules"
47 test_expect_success
'test submodule set-url' '
48 # add commits and move the submodules (change the urls)
55 mv submodule newsubmodule &&
63 mv namedsubmodule newnamedsubmodule &&
65 git -C newsubmodule show >expect &&
66 git -C newnamedsubmodule show >>expect &&
69 test_must_fail git submodule update --remote &&
70 git submodule set-url submodule ../newsubmodule &&
71 test_cmp_config ../newsubmodule -f .gitmodules submodule.submodule.url &&
72 git submodule set-url thepath ../newnamedsubmodule &&
73 test_cmp_config ../newnamedsubmodule -f .gitmodules submodule.thename.url &&
74 test_cmp_config "" -f .gitmodules --default "" submodule.thepath.url &&
75 git submodule update --remote
77 git -C super/submodule show >actual &&
78 git -C super/thepath show >>actual &&
79 test_cmp expect actual