submodule: Use cat instead of echo to avoid DOS line-endings
[git/mingw/4msysgit.git] / t / t7403-submodule-sync.sh
blob3620215c1f84b8e184b470c92b9a01c15fd75dc2
1 #!/bin/sh
3 # Copyright (c) 2008 David Aguilar
6 test_description='git submodule sync
8 These tests exercise the "git submodule sync" subcommand.
11 . ./test-lib.sh
13 test_expect_success setup '
14 echo file > file &&
15 git add file &&
16 test_tick &&
17 git commit -m upstream &&
18 git clone . super &&
19 git clone super submodule &&
20 (cd super &&
21 git submodule add ../submodule submodule &&
22 test_tick &&
23 git commit -m "submodule"
24 ) &&
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' '
33 (cd submodule &&
34 echo second line >> file &&
35 test_tick &&
36 git commit -a -m "change submodule"
40 test_expect_success 'change submodule url' '
41 (cd super &&
42 cd submodule &&
43 git checkout master &&
44 git pull
45 ) &&
46 mv submodule moved-submodule &&
47 (cd super &&
48 git config -f .gitmodules submodule.submodule.url ../moved-submodule &&
49 test_tick &&
50 git commit -a -m moved-submodule
54 test_expect_success '"git submodule sync" should update submodule URLs' '
55 (cd super-clone &&
56 git pull --no-recurse-submodules &&
57 git submodule sync
58 ) &&
59 test -d "$(cd super-clone/submodule &&
60 git config remote.origin.url
61 )" &&
62 (cd super-clone/submodule &&
63 git checkout master &&
64 git pull
65 ) &&
66 (cd super-clone &&
67 test -d "$(git config submodule.submodule.url)"
71 test_expect_success '"git submodule sync" should update known submodule URLs' '
72 (cd empty-clone &&
73 git pull &&
74 git submodule sync &&
75 test -d "$(git config submodule.submodule.url)"
79 test_expect_success '"git submodule sync" should not vivify uninteresting submodule' '
80 (cd top-only-clone &&
81 git pull &&
82 git submodule sync &&
83 test -z "$(git config submodule.submodule.url)" &&
84 git submodule sync submodule &&
85 test -z "$(git config submodule.submodule.url)"
89 test_done