summaryrefslogtreecommitdiff
path: root/t/t5526-fetch-submodules.sh
diff options
context:
space:
mode:
authorHeiko Voigt <hvoigt@hvoigt.net>2017-10-06 22:30:47 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-10-08 01:39:47 (GMT)
commit01ce12252c959ed0f4b4b021adffa7a84a2d64a6 (patch)
tree214921904ec57be7569f531dc52894082f528fbf /t/t5526-fetch-submodules.sh
parentd35688db19c9ea97e9e2ce751dc7b47aee21636b (diff)
downloadgit-01ce12252c959ed0f4b4b021adffa7a84a2d64a6.zip
git-01ce12252c959ed0f4b4b021adffa7a84a2d64a6.tar.gz
git-01ce12252c959ed0f4b4b021adffa7a84a2d64a6.tar.bz2
fetch: add test to make sure we stay backwards compatible
The current implementation of submodules supports on-demand fetch if there is no .gitmodules entry for a submodule. Let's add a test to document this behavior. Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5526-fetch-submodules.sh')
-rwxr-xr-xt/t5526-fetch-submodules.sh42
1 files changed, 41 insertions, 1 deletions
diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh
index 42251f7..43a22f6 100755
--- a/t/t5526-fetch-submodules.sh
+++ b/t/t5526-fetch-submodules.sh
@@ -478,7 +478,47 @@ test_expect_success "don't fetch submodule when newly recorded commits are alrea
git fetch >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
- test_i18ncmp expect.err actual.err
+ test_i18ncmp expect.err actual.err &&
+ (
+ cd submodule &&
+ git checkout -q master
+ )
+'
+
+test_expect_success "'fetch.recurseSubmodules=on-demand' works also without .gitmodule entry" '
+ (
+ cd downstream &&
+ git fetch --recurse-submodules
+ ) &&
+ add_upstream_commit &&
+ head1=$(git rev-parse --short HEAD) &&
+ git add submodule &&
+ git rm .gitmodules &&
+ git commit -m "new submodule without .gitmodules" &&
+ printf "" >expect.out &&
+ head2=$(git rev-parse --short HEAD) &&
+ echo "From $pwd/." >expect.err.2 &&
+ echo " $head1..$head2 master -> origin/master" >>expect.err.2 &&
+ head -3 expect.err >>expect.err.2 &&
+ (
+ cd downstream &&
+ rm .gitmodules &&
+ git config fetch.recurseSubmodules on-demand &&
+ # fake submodule configuration to avoid skipping submodule handling
+ git config -f .gitmodules submodule.fake.path fake &&
+ git config -f .gitmodules submodule.fake.url fakeurl &&
+ git add .gitmodules &&
+ git config --unset submodule.submodule.url &&
+ git fetch >../actual.out 2>../actual.err &&
+ # cleanup
+ git config --unset fetch.recurseSubmodules &&
+ git reset --hard
+ ) &&
+ test_i18ncmp expect.out actual.out &&
+ test_i18ncmp expect.err.2 actual.err &&
+ git checkout HEAD^ -- .gitmodules &&
+ git add .gitmodules &&
+ git commit -m "new submodule restored .gitmodules"
'
test_expect_success 'fetching submodules respects parallel settings' '