3 test_description
='Test shallow cloning of repos with submodules'
9 test_expect_success
'setup' '
10 git checkout -b master &&
11 test_commit commit1 &&
12 test_commit commit2 &&
17 test_commit subcommit1 &&
18 test_commit subcommit2 &&
19 test_commit subcommit3
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 &&
30 git log --oneline >lines &&
31 test_line_count = 3 lines
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 &&
45 git log --oneline >lines &&
46 test_line_count = 2 lines
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 &&
60 git log --oneline >lines &&
61 test_line_count = 2 lines
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 &&
75 git log --oneline >lines &&
76 test_line_count = 3 lines
80 git log --oneline >lines &&
81 test_line_count = 1 lines