diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-07-15 10:28:48 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-07-15 10:28:48 -0700 |
commit | 2bb7aface663f4d9f01d08282ee38cf8f636df0d (patch) | |
tree | d09bfbfb5dd648bff2d895ea23edceb8e50dc033 /t | |
parent | 3bb6149186ea6bed5e6fd7b2f830fb499a1a8658 (diff) | |
parent | 275cd184d52b5b81cb89e4ec33e540fb2ae61c1f (diff) | |
download | git-2bb7aface663f4d9f01d08282ee38cf8f636df0d.tar.gz git-2bb7aface663f4d9f01d08282ee38cf8f636df0d.tar.xz |
Merge branch 'fg/submodule-clone-depth'
Allow shallow-cloning of submodules with "git submodule update".
* fg/submodule-clone-depth:
Add --depth to submodule update/add
Diffstat (limited to 't')
-rwxr-xr-x | t/t7400-submodule-basic.sh | 16 | ||||
-rwxr-xr-x | t/t7406-submodule-update.sh | 24 |
2 files changed, 33 insertions, 7 deletions
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index 50e6ad745..5ee97b003 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -963,4 +963,20 @@ test_expect_success 'submodule with UTF-8 name' ' git submodule >&2 && test -n "$(git submodule | grep "$svname")" ' + +test_expect_success 'submodule add clone shallow submodule' ' + mkdir super && + pwd=$(pwd) + ( + cd super && + git init && + git submodule add --depth=1 file://"$pwd"/example2 submodule && + ( + cd submodule && + test 1 = $(git log --oneline | wc -l) + ) + ) +' + + test_done diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh index bc7cfcd83..b192f936b 100755 --- a/t/t7406-submodule-update.sh +++ b/t/t7406-submodule-update.sh @@ -729,14 +729,24 @@ test_expect_success 'submodule update properly revives a moved submodule' ' test_expect_success SYMLINKS 'submodule update can handle symbolic links in pwd' ' mkdir -p linked/dir && ln -s linked/dir linkto && - ( - cd linkto && - git clone "$TRASH_DIRECTORY"/super_update_r2 super && - ( - cd super && - git submodule update --init --recursive - ) + (cd linkto && + git clone "$TRASH_DIRECTORY"/super_update_r2 super && + (cd super && + git submodule update --init --recursive + ) ) ' +test_expect_success 'submodule update clone shallow submodule' ' + git clone cloned super3 && + pwd=$(pwd) + (cd super3 && + sed -e "s#url = ../#url = file://$pwd/#" <.gitmodules >.gitmodules.tmp && + mv -f .gitmodules.tmp .gitmodules && + git submodule update --init --depth=3 + (cd submodule && + test 1 = $(git log --oneline | wc -l) + ) + ) +' test_done |