t/lib-credential.sh: drop shebang line
[git/raj.git] / t / t5617-clone-submodules-remote.sh
blob1a041df10bee558bf4b643f42d4ffa876fefbc14
1 #!/bin/sh
3 test_description='Test cloning repos with submodules using remote-tracking branches'
5 . ./test-lib.sh
7 pwd=$(pwd)
9 test_expect_success 'setup' '
10 git checkout -b master &&
11 test_commit commit1 &&
12 mkdir sub &&
14 cd sub &&
15 git init &&
16 test_commit subcommit1 &&
17 git tag sub_when_added_to_super &&
18 git branch other
19 ) &&
20 git submodule add "file://$pwd/sub" sub &&
21 git commit -m "add submodule" &&
23 cd sub &&
24 test_commit subcommit2
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 &&
32 cd super_clone/sub &&
33 git diff --exit-code sub_when_added_to_super
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 &&
41 cd super_clone/sub &&
42 git diff --exit-code remotes/origin/master
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 &&
50 cd super_clone/sub &&
51 git diff --exit-code sub_when_added_to_super
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 &&
59 cd super_clone/sub &&
60 git rev-parse --verify origin/master &&
61 test_must_fail git rev-parse --verify origin/other
65 test_done