]>
Commit | Line | Data |
---|---|---|
4c691016 BA |
1 | #!/bin/sh |
2 | ||
3 | test_description='Test cloning repos with submodules using remote-tracking branches' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
7 | pwd=$(pwd) | |
8 | ||
9 | test_expect_success 'setup' ' | |
10 | git checkout -b master && | |
11 | test_commit commit1 && | |
12 | mkdir sub && | |
13 | ( | |
14 | cd sub && | |
15 | git init && | |
16 | test_commit subcommit1 && | |
132f600b ES |
17 | git tag sub_when_added_to_super && |
18 | git branch other | |
4c691016 BA |
19 | ) && |
20 | git submodule add "file://$pwd/sub" sub && | |
21 | git commit -m "add submodule" && | |
22 | ( | |
23 | cd sub && | |
24 | test_commit subcommit2 | |
25 | ) | |
26 | ' | |
27 | ||
28 | test_expect_success 'clone with --no-remote-submodules' ' | |
29 | test_when_finished "rm -rf super_clone" && | |
30 | git clone --recurse-submodules --no-remote-submodules "file://$pwd/." super_clone && | |
31 | ( | |
32 | cd super_clone/sub && | |
33 | git diff --exit-code sub_when_added_to_super | |
34 | ) | |
35 | ' | |
36 | ||
37 | test_expect_success 'clone with --remote-submodules' ' | |
38 | test_when_finished "rm -rf super_clone" && | |
39 | git clone --recurse-submodules --remote-submodules "file://$pwd/." super_clone && | |
40 | ( | |
41 | cd super_clone/sub && | |
42 | git diff --exit-code remotes/origin/master | |
43 | ) | |
44 | ' | |
45 | ||
46 | test_expect_success 'check the default is --no-remote-submodules' ' | |
47 | test_when_finished "rm -rf super_clone" && | |
48 | git clone --recurse-submodules "file://$pwd/." super_clone && | |
49 | ( | |
50 | cd super_clone/sub && | |
51 | git diff --exit-code sub_when_added_to_super | |
52 | ) | |
53 | ' | |
54 | ||
132f600b ES |
55 | test_expect_success 'clone with --single-branch' ' |
56 | test_when_finished "rm -rf super_clone" && | |
57 | git clone --recurse-submodules --single-branch "file://$pwd/." super_clone && | |
58 | ( | |
59 | cd super_clone/sub && | |
60 | git rev-parse --verify origin/master && | |
61 | test_must_fail git rev-parse --verify origin/other | |
62 | ) | |
63 | ' | |
64 | ||
4c691016 | 65 | test_done |