diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-05-06 14:45:43 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-05-06 14:45:43 -0700 |
commit | 5f3b21c1119abc7e19c988b399c7726d47bbb0d1 (patch) | |
tree | 1a89aa68fe3d548cf24de1476eaaf1e52e27d1e4 /t | |
parent | ca158f4633e40fb8a6e7e6b78dc7ad559718a19b (diff) | |
parent | d22eb044750631f30bdbfc3dc42d684e73d18ddc (diff) | |
download | git-5f3b21c1119abc7e19c988b399c7726d47bbb0d1.tar.gz |
Merge branch 'sb/clone-shallow-passthru'
"git clone" learned "--shallow-submodules" option.
* sb/clone-shallow-passthru:
clone: add `--shallow-submodules` flag
Diffstat (limited to 't')
-rwxr-xr-x | t/t5614-clone-submodules.sh | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/t/t5614-clone-submodules.sh b/t/t5614-clone-submodules.sh new file mode 100755 index 0000000000..62044c5a02 --- /dev/null +++ b/t/t5614-clone-submodules.sh @@ -0,0 +1,85 @@ +#!/bin/sh + +test_description='Test shallow cloning of repos with submodules' + +. ./test-lib.sh + +pwd=$(pwd) + +test_expect_success 'setup' ' + git checkout -b master && + test_commit commit1 && + test_commit commit2 && + mkdir sub && + ( + cd sub && + git init && + test_commit subcommit1 && + test_commit subcommit2 && + test_commit subcommit3 + ) && + git submodule add "file://$pwd/sub" sub && + git commit -m "add submodule" +' + +test_expect_success 'nonshallow clone implies nonshallow submodule' ' + test_when_finished "rm -rf super_clone" && + git clone --recurse-submodules "file://$pwd/." super_clone && + ( + cd super_clone && + git log --oneline >lines && + test_line_count = 3 lines + ) && + ( + cd super_clone/sub && + git log --oneline >lines && + test_line_count = 3 lines + ) +' + +test_expect_success 'shallow clone implies shallow submodule' ' + test_when_finished "rm -rf super_clone" && + git clone --recurse-submodules --depth 2 "file://$pwd/." super_clone && + ( + cd super_clone && + git log --oneline >lines && + test_line_count = 2 lines + ) && + ( + cd super_clone/sub && + git log --oneline >lines && + test_line_count = 1 lines + ) +' + +test_expect_success 'shallow clone with non shallow submodule' ' + test_when_finished "rm -rf super_clone" && + git clone --recurse-submodules --depth 2 --no-shallow-submodules "file://$pwd/." super_clone && + ( + cd super_clone && + git log --oneline >lines && + test_line_count = 2 lines + ) && + ( + cd super_clone/sub && + git log --oneline >lines && + test_line_count = 3 lines + ) +' + +test_expect_success 'non shallow clone with shallow submodule' ' + test_when_finished "rm -rf super_clone" && + git clone --recurse-submodules --no-local --shallow-submodules "file://$pwd/." super_clone && + ( + cd super_clone && + git log --oneline >lines && + test_line_count = 3 lines + ) && + ( + cd super_clone/sub && + git log --oneline >lines && + test_line_count = 1 lines + ) +' + +test_done |