git-svn: skip mergeinfo handling with --no-follow-parent
[git/git-svn.git] / t / t5614-clone-submodules.sh
blob32d83e2694d5b7b1e2acb78bc0b32262390f4e95
1 #!/bin/sh
3 test_description='Test shallow cloning of repos with submodules'
5 . ./test-lib.sh
7 pwd=$(pwd)
9 test_expect_success 'setup' '
10 git checkout -b master &&
11 test_commit commit1 &&
12 test_commit commit2 &&
13 mkdir sub &&
15 cd sub &&
16 git init &&
17 test_commit subcommit1 &&
18 test_commit subcommit2 &&
19 test_commit subcommit3
20 ) &&
21 git submodule add "file://$pwd/sub" sub &&
22 git commit -m "add submodule"
25 test_expect_success 'nonshallow clone implies nonshallow submodule' '
26 test_when_finished "rm -rf super_clone" &&
27 git clone --recurse-submodules "file://$pwd/." super_clone &&
29 cd super_clone &&
30 git log --oneline >lines &&
31 test_line_count = 3 lines
32 ) &&
34 cd super_clone/sub &&
35 git log --oneline >lines &&
36 test_line_count = 3 lines
40 test_expect_success 'shallow clone implies shallow submodule' '
41 test_when_finished "rm -rf super_clone" &&
42 git clone --recurse-submodules --depth 2 "file://$pwd/." super_clone &&
44 cd super_clone &&
45 git log --oneline >lines &&
46 test_line_count = 2 lines
47 ) &&
49 cd super_clone/sub &&
50 git log --oneline >lines &&
51 test_line_count = 1 lines
55 test_expect_success 'shallow clone with non shallow submodule' '
56 test_when_finished "rm -rf super_clone" &&
57 git clone --recurse-submodules --depth 2 --no-shallow-submodules "file://$pwd/." super_clone &&
59 cd super_clone &&
60 git log --oneline >lines &&
61 test_line_count = 2 lines
62 ) &&
64 cd super_clone/sub &&
65 git log --oneline >lines &&
66 test_line_count = 3 lines
70 test_expect_success 'non shallow clone with shallow submodule' '
71 test_when_finished "rm -rf super_clone" &&
72 git clone --recurse-submodules --no-local --shallow-submodules "file://$pwd/." super_clone &&
74 cd super_clone &&
75 git log --oneline >lines &&
76 test_line_count = 3 lines
77 ) &&
79 cd super_clone/sub &&
80 git log --oneline >lines &&
81 test_line_count = 1 lines
85 test_expect_success 'clone follows shallow recommendation' '
86 test_when_finished "rm -rf super_clone" &&
87 git config -f .gitmodules submodule.sub.shallow true &&
88 git add .gitmodules &&
89 git commit -m "recommed shallow for sub" &&
90 git clone --recurse-submodules --no-local "file://$pwd/." super_clone &&
92 cd super_clone &&
93 git log --oneline >lines &&
94 test_line_count = 4 lines
95 ) &&
97 cd super_clone/sub &&
98 git log --oneline >lines &&
99 test_line_count = 1 lines
103 test_expect_success 'get unshallow recommended shallow submodule' '
104 test_when_finished "rm -rf super_clone" &&
105 git clone --no-local "file://$pwd/." super_clone &&
107 cd super_clone &&
108 git submodule update --init --no-recommend-shallow &&
109 git log --oneline >lines &&
110 test_line_count = 4 lines
111 ) &&
113 cd super_clone/sub &&
114 git log --oneline >lines &&
115 test_line_count = 3 lines
119 test_expect_success 'clone follows non shallow recommendation' '
120 test_when_finished "rm -rf super_clone" &&
121 git config -f .gitmodules submodule.sub.shallow false &&
122 git add .gitmodules &&
123 git commit -m "recommed non shallow for sub" &&
124 git clone --recurse-submodules --no-local "file://$pwd/." super_clone &&
126 cd super_clone &&
127 git log --oneline >lines &&
128 test_line_count = 5 lines
129 ) &&
131 cd super_clone/sub &&
132 git log --oneline >lines &&
133 test_line_count = 3 lines
137 test_done