Merge branch 'l10n/zh_TW/220113' of github.com:l10n-tw/git-po
[alt-git.git] / t / t7420-submodule-set-url.sh
blobef0cb6e8e185379dc853e16dcd7d2ea84ac8c9ff
1 #!/bin/sh
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
9 as expected.
12 TEST_NO_CREATE_REPO=1
13 . ./test-lib.sh
15 test_expect_success 'submodule config cache setup' '
16 mkdir submodule &&
18 cd submodule &&
19 git init &&
20 echo a >file &&
21 git add file &&
22 git commit -ma
23 ) &&
24 mkdir super &&
26 cd super &&
27 git init &&
28 git submodule add ../submodule &&
29 git commit -m "add submodule"
33 test_expect_success 'test submodule set-url' '
34 # add a commit and move the submodule (change the url)
36 cd submodule &&
37 echo b >>file &&
38 git add file &&
39 git commit -mb
40 ) &&
41 mv submodule newsubmodule &&
43 git -C newsubmodule show >expect &&
45 cd super &&
46 test_must_fail git submodule update --remote &&
47 git submodule set-url submodule ../newsubmodule &&
48 grep -F "url = ../newsubmodule" .gitmodules &&
49 git submodule update --remote
50 ) &&
51 git -C super/submodule show >actual &&
52 test_cmp expect actual
55 test_done