3 # Copyright (c) 2008 David Aguilar
6 test_description='git submodule sync
8 These tests exercise the "git submodule sync" subcommand.
13 test_expect_success setup '
17 git commit -m upstream &&
19 git clone super submodule &&
21 git submodule add ../submodule submodule &&
23 git commit -m "submodule"
25 git clone super super-clone &&
26 (cd super-clone && git submodule update --init) &&
27 git clone super empty-clone &&
28 (cd empty-clone && git submodule init) &&
29 git clone super top-only-clone
32 test_expect_success 'change submodule' '
34 echo second line >> file &&
36 git commit -a -m "change submodule"
40 test_expect_success 'change submodule url' '
43 git checkout master &&
46 mv submodule moved-submodule &&
48 git config -f .gitmodules submodule.submodule.url ../moved-submodule &&
50 git commit -a -m moved-submodule
54 test_expect_success '"git submodule sync" should update submodule URLs' '
56 git pull --no-recurse-submodules &&
59 test -d "$(git config -f super-clone/submodule/.git/config \
60 remote.origin.url)" &&
61 (cd super-clone/submodule &&
62 git checkout master &&
66 test -d "$(git config submodule.submodule.url)"
70 test_expect_success '"git submodule sync" should update known submodule URLs' '
74 test -d "$(git config submodule.submodule.url)"
78 test_expect_success '"git submodule sync" should not vivify uninteresting submodule' '
82 test -z "$(git config submodule.submodule.url)" &&
83 git submodule sync submodule &&
84 test -z "$(git config submodule.submodule.url)"