2 # Copyright (c) 2010, Jens Lehmann
4 test_description
='Recursive "git fetch" for submodules'
6 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=master
7 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
13 add_upstream_commit
() {
16 head1
=$
(git rev-parse
--short HEAD
) &&
17 echo new
>> subfile
&&
20 git commit
-m new subfile
&&
21 head2
=$
(git rev-parse
--short HEAD
) &&
22 echo "Fetching submodule submodule" > ..
/expect.err
&&
23 echo "From $pwd/submodule" >> ..
/expect.err
&&
24 echo " $head1..$head2 sub -> origin/sub" >> ..
/expect.err
28 head1
=$
(git rev-parse
--short HEAD
) &&
29 echo new
>> deepsubfile
&&
31 git add deepsubfile
&&
32 git commit
-m new deepsubfile
&&
33 head2
=$
(git rev-parse
--short HEAD
) &&
34 echo "Fetching submodule submodule/subdir/deepsubmodule" >> ..
/expect.err
35 echo "From $pwd/deepsubmodule" >> ..
/expect.err
&&
36 echo " $head1..$head2 deep -> origin/deep" >> ..
/expect.err
40 test_expect_success setup
'
41 mkdir deepsubmodule &&
45 echo deepsubcontent > deepsubfile &&
46 git add deepsubfile &&
47 git commit -m new deepsubfile &&
54 echo subcontent > subfile &&
56 git submodule add "$pwd/deepsubmodule" subdir/deepsubmodule &&
57 git commit -a -m new &&
60 git submodule add "$pwd/submodule" submodule &&
61 git commit -am initial &&
62 git branch -M super &&
63 git clone . downstream &&
66 git submodule update --init --recursive
70 test_expect_success
"fetch --recurse-submodules recurses into submodules" '
71 add_upstream_commit &&
74 git fetch --recurse-submodules >../actual.out 2>../actual.err
76 test_must_be_empty actual.out &&
77 test_cmp expect.err actual.err
80 test_expect_success
"submodule.recurse option triggers recursive fetch" '
81 add_upstream_commit &&
84 git -c submodule.recurse fetch >../actual.out 2>../actual.err
86 test_must_be_empty actual.out &&
87 test_cmp expect.err actual.err
90 test_expect_success
"fetch --recurse-submodules -j2 has the same output behaviour" '
91 add_upstream_commit &&
94 GIT_TRACE="$TRASH_DIRECTORY/trace.out" git fetch --recurse-submodules -j2 2>../actual.err
96 test_must_be_empty actual.out &&
97 test_cmp expect.err actual.err &&
98 grep "2 tasks" trace.out
101 test_expect_success
"fetch alone only fetches superproject" '
102 add_upstream_commit &&
105 git fetch >../actual.out 2>../actual.err
107 test_must_be_empty actual.out &&
108 test_must_be_empty actual.err
111 test_expect_success
"fetch --no-recurse-submodules only fetches superproject" '
114 git fetch --no-recurse-submodules >../actual.out 2>../actual.err
116 test_must_be_empty actual.out &&
117 test_must_be_empty actual.err
120 test_expect_success
"using fetchRecurseSubmodules=true in .gitmodules recurses into submodules" '
123 git config -f .gitmodules submodule.submodule.fetchRecurseSubmodules true &&
124 git fetch >../actual.out 2>../actual.err
126 test_must_be_empty actual.out &&
127 test_cmp expect.err actual.err
130 test_expect_success
"--no-recurse-submodules overrides .gitmodules config" '
131 add_upstream_commit &&
134 git fetch --no-recurse-submodules >../actual.out 2>../actual.err
136 test_must_be_empty actual.out &&
137 test_must_be_empty actual.err
140 test_expect_success
"using fetchRecurseSubmodules=false in .git/config overrides setting in .gitmodules" '
143 git config submodule.submodule.fetchRecurseSubmodules false &&
144 git fetch >../actual.out 2>../actual.err
146 test_must_be_empty actual.out &&
147 test_must_be_empty actual.err
150 test_expect_success
"--recurse-submodules overrides fetchRecurseSubmodules setting from .git/config" '
153 git fetch --recurse-submodules >../actual.out 2>../actual.err &&
154 git config --unset -f .gitmodules submodule.submodule.fetchRecurseSubmodules &&
155 git config --unset submodule.submodule.fetchRecurseSubmodules
157 test_must_be_empty actual.out &&
158 test_cmp expect.err actual.err
161 test_expect_success
"--quiet propagates to submodules" '
164 git fetch --recurse-submodules --quiet >../actual.out 2>../actual.err
166 test_must_be_empty actual.out &&
167 test_must_be_empty actual.err
170 test_expect_success
"--quiet propagates to parallel submodules" '
173 git fetch --recurse-submodules -j 2 --quiet >../actual.out 2>../actual.err
175 test_must_be_empty actual.out &&
176 test_must_be_empty actual.err
179 test_expect_success
"--dry-run propagates to submodules" '
180 add_upstream_commit &&
183 git fetch --recurse-submodules --dry-run >../actual.out 2>../actual.err
185 test_must_be_empty actual.out &&
186 test_cmp expect.err actual.err
189 test_expect_success
"Without --dry-run propagates to submodules" '
192 git fetch --recurse-submodules >../actual.out 2>../actual.err
194 test_must_be_empty actual.out &&
195 test_cmp expect.err actual.err
198 test_expect_success
"recurseSubmodules=true propagates into submodules" '
199 add_upstream_commit &&
202 git config fetch.recurseSubmodules true &&
203 git fetch >../actual.out 2>../actual.err
205 test_must_be_empty actual.out &&
206 test_cmp expect.err actual.err
209 test_expect_success
"--recurse-submodules overrides config in submodule" '
210 add_upstream_commit &&
215 git config fetch.recurseSubmodules false
217 git fetch --recurse-submodules >../actual.out 2>../actual.err
219 test_must_be_empty actual.out &&
220 test_cmp expect.err actual.err
223 test_expect_success
"--no-recurse-submodules overrides config setting" '
224 add_upstream_commit &&
227 git config fetch.recurseSubmodules true &&
228 git fetch --no-recurse-submodules >../actual.out 2>../actual.err
230 test_must_be_empty actual.out &&
231 test_must_be_empty actual.err
234 test_expect_success
"Recursion doesn't happen when no new commits are fetched in the superproject" '
239 git config --unset fetch.recurseSubmodules
241 git config --unset fetch.recurseSubmodules &&
242 git fetch >../actual.out 2>../actual.err
244 test_must_be_empty actual.out &&
245 test_must_be_empty actual.err
248 test_expect_success
"Recursion stops when no new submodule commits are fetched" '
249 head1=$(git rev-parse --short HEAD) &&
251 git commit -m "new submodule" &&
252 head2=$(git rev-parse --short HEAD) &&
253 echo "From $pwd/." > expect.err.sub &&
254 echo " $head1..$head2 super -> origin/super" >>expect.err.sub &&
255 head -3 expect.err >> expect.err.sub &&
258 git fetch >../actual.out 2>../actual.err
260 test_cmp expect.err.sub actual.err &&
261 test_must_be_empty actual.out
264 test_expect_success
"Recursion doesn't happen when new superproject commits don't change any submodules" '
265 add_upstream_commit &&
266 head1=$(git rev-parse --short HEAD) &&
269 git commit -m "new file" &&
270 head2=$(git rev-parse --short HEAD) &&
271 echo "From $pwd/." > expect.err.file &&
272 echo " $head1..$head2 super -> origin/super" >> expect.err.file &&
275 git fetch >../actual.out 2>../actual.err
277 test_must_be_empty actual.out &&
278 test_cmp expect.err.file actual.err
281 test_expect_success
"Recursion picks up config in submodule" '
284 git fetch --recurse-submodules &&
287 git config fetch.recurseSubmodules true
290 add_upstream_commit &&
291 head1=$(git rev-parse --short HEAD) &&
293 git commit -m "new submodule" &&
294 head2=$(git rev-parse --short HEAD) &&
295 echo "From $pwd/." > expect.err.sub &&
296 echo " $head1..$head2 super -> origin/super" >> expect.err.sub &&
297 cat expect.err >> expect.err.sub &&
300 git fetch >../actual.out 2>../actual.err &&
303 git config --unset fetch.recurseSubmodules
306 test_cmp expect.err.sub actual.err &&
307 test_must_be_empty actual.out
310 test_expect_success
"Recursion picks up all submodules when necessary" '
311 add_upstream_commit &&
315 cd subdir/deepsubmodule &&
317 git checkout -q FETCH_HEAD
319 head1=$(git rev-parse --short HEAD^) &&
320 git add subdir/deepsubmodule &&
321 git commit -m "new deepsubmodule" &&
322 head2=$(git rev-parse --short HEAD) &&
323 echo "Fetching submodule submodule" > ../expect.err.sub &&
324 echo "From $pwd/submodule" >> ../expect.err.sub &&
325 echo " $head1..$head2 sub -> origin/sub" >> ../expect.err.sub
327 head1=$(git rev-parse --short HEAD) &&
329 git commit -m "new submodule" &&
330 head2=$(git rev-parse --short HEAD) &&
331 echo "From $pwd/." > expect.err.2 &&
332 echo " $head1..$head2 super -> origin/super" >> expect.err.2 &&
333 cat expect.err.sub >> expect.err.2 &&
334 tail -3 expect.err >> expect.err.2 &&
337 git fetch >../actual.out 2>../actual.err
339 test_cmp expect.err.2 actual.err &&
340 test_must_be_empty actual.out
343 test_expect_success
"'--recurse-submodules=on-demand' doesn't recurse when no new commits are fetched in the superproject (and ignores config)" '
344 add_upstream_commit &&
348 cd subdir/deepsubmodule &&
350 git checkout -q FETCH_HEAD
352 head1=$(git rev-parse --short HEAD^) &&
353 git add subdir/deepsubmodule &&
354 git commit -m "new deepsubmodule" &&
355 head2=$(git rev-parse --short HEAD) &&
356 echo Fetching submodule submodule > ../expect.err.sub &&
357 echo "From $pwd/submodule" >> ../expect.err.sub &&
358 echo " $head1..$head2 sub -> origin/sub" >> ../expect.err.sub
362 git config fetch.recurseSubmodules true &&
363 git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err &&
364 git config --unset fetch.recurseSubmodules
366 test_must_be_empty actual.out &&
367 test_must_be_empty actual.err
370 test_expect_success
"'--recurse-submodules=on-demand' recurses as deep as necessary (and ignores config)" '
371 head1=$(git rev-parse --short HEAD) &&
373 git commit -m "new submodule" &&
374 head2=$(git rev-parse --short HEAD) &&
375 tail -3 expect.err > expect.err.deepsub &&
376 echo "From $pwd/." > expect.err &&
377 echo " $head1..$head2 super -> origin/super" >>expect.err &&
378 cat expect.err.sub >> expect.err &&
379 cat expect.err.deepsub >> expect.err &&
382 git config fetch.recurseSubmodules false &&
385 git config -f .gitmodules submodule.subdir/deepsubmodule.fetchRecursive false
387 git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err &&
388 git config --unset fetch.recurseSubmodules &&
391 git config --unset -f .gitmodules submodule.subdir/deepsubmodule.fetchRecursive
394 test_must_be_empty actual.out &&
395 test_cmp expect.err actual.err
398 test_expect_success
"'--recurse-submodules=on-demand' stops when no new submodule commits are found in the superproject (and ignores config)" '
399 add_upstream_commit &&
400 head1=$(git rev-parse --short HEAD) &&
403 git commit -m "new file" &&
404 head2=$(git rev-parse --short HEAD) &&
405 echo "From $pwd/." > expect.err.file &&
406 echo " $head1..$head2 super -> origin/super" >> expect.err.file &&
409 git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err
411 test_must_be_empty actual.out &&
412 test_cmp expect.err.file actual.err
415 test_expect_success
"'fetch.recurseSubmodules=on-demand' overrides global config" '
418 git fetch --recurse-submodules
420 add_upstream_commit &&
421 git config --global fetch.recurseSubmodules false &&
422 head1=$(git rev-parse --short HEAD) &&
424 git commit -m "new submodule" &&
425 head2=$(git rev-parse --short HEAD) &&
426 echo "From $pwd/." > expect.err.2 &&
427 echo " $head1..$head2 super -> origin/super" >>expect.err.2 &&
428 head -3 expect.err >> expect.err.2 &&
431 git config fetch.recurseSubmodules on-demand &&
432 git fetch >../actual.out 2>../actual.err
434 git config --global --unset fetch.recurseSubmodules &&
437 git config --unset fetch.recurseSubmodules
439 test_must_be_empty actual.out &&
440 test_cmp expect.err.2 actual.err
443 test_expect_success
"'submodule.<sub>.fetchRecurseSubmodules=on-demand' overrides fetch.recurseSubmodules" '
446 git fetch --recurse-submodules
448 add_upstream_commit &&
449 git config fetch.recurseSubmodules false &&
450 head1=$(git rev-parse --short HEAD) &&
452 git commit -m "new submodule" &&
453 head2=$(git rev-parse --short HEAD) &&
454 echo "From $pwd/." > expect.err.2 &&
455 echo " $head1..$head2 super -> origin/super" >>expect.err.2 &&
456 head -3 expect.err >> expect.err.2 &&
459 git config submodule.submodule.fetchRecurseSubmodules on-demand &&
460 git fetch >../actual.out 2>../actual.err
462 git config --unset fetch.recurseSubmodules &&
465 git config --unset submodule.submodule.fetchRecurseSubmodules
467 test_must_be_empty actual.out &&
468 test_cmp expect.err.2 actual.err
471 test_expect_success
"don't fetch submodule when newly recorded commits are already present" '
474 git checkout -q HEAD^^
476 head1=$(git rev-parse --short HEAD) &&
478 git commit -m "submodule rewound" &&
479 head2=$(git rev-parse --short HEAD) &&
480 echo "From $pwd/." > expect.err &&
481 echo " $head1..$head2 super -> origin/super" >> expect.err &&
484 git fetch >../actual.out 2>../actual.err
486 test_must_be_empty actual.out &&
487 test_cmp expect.err actual.err &&
494 test_expect_success
"'fetch.recurseSubmodules=on-demand' works also without .gitmodules entry" '
497 git fetch --recurse-submodules
499 add_upstream_commit &&
500 head1=$(git rev-parse --short HEAD) &&
502 git rm .gitmodules &&
503 git commit -m "new submodule without .gitmodules" &&
504 head2=$(git rev-parse --short HEAD) &&
505 echo "From $pwd/." >expect.err.2 &&
506 echo " $head1..$head2 super -> origin/super" >>expect.err.2 &&
507 head -3 expect.err >>expect.err.2 &&
511 git config fetch.recurseSubmodules on-demand &&
512 # fake submodule configuration to avoid skipping submodule handling
513 git config -f .gitmodules submodule.fake.path fake &&
514 git config -f .gitmodules submodule.fake.url fakeurl &&
515 git add .gitmodules &&
516 git config --unset submodule.submodule.url &&
517 git fetch >../actual.out 2>../actual.err &&
519 git config --unset fetch.recurseSubmodules &&
522 test_must_be_empty actual.out &&
523 test_cmp expect.err.2 actual.err &&
524 git checkout HEAD^ -- .gitmodules &&
525 git add .gitmodules &&
526 git commit -m "new submodule restored .gitmodules"
529 test_expect_success
'fetching submodules respects parallel settings' '
530 git config fetch.recurseSubmodules true &&
533 GIT_TRACE=$(pwd)/trace.out git fetch &&
534 grep "1 tasks" trace.out &&
535 GIT_TRACE=$(pwd)/trace.out git fetch --jobs 7 &&
536 grep "7 tasks" trace.out &&
537 git config submodule.fetchJobs 8 &&
538 GIT_TRACE=$(pwd)/trace.out git fetch &&
539 grep "8 tasks" trace.out &&
540 GIT_TRACE=$(pwd)/trace.out git fetch --jobs 9 &&
541 grep "9 tasks" trace.out
545 test_expect_success
'fetching submodule into a broken repository' '
546 # Prepare src and src/sub nested in it
551 git -C sub commit --allow-empty -m "initial in sub" &&
552 git submodule add -- ./sub sub &&
553 git commit -m "initial in top"
556 # Clone the old-fashoned way
558 git -C dst clone ../src/sub sub &&
560 # Make sure that old-fashoned layout is still supported
563 # "diff" would find no change
564 git -C dst diff --exit-code &&
566 # Recursive-fetch works fine
567 git -C dst fetch --recurse-submodules &&
569 # Break the receiving submodule
570 rm -f dst/sub/.git/HEAD &&
572 # NOTE: without the fix the following tests will recurse forever!
573 # They should terminate with an error.
575 test_must_fail git -C dst status &&
576 test_must_fail git -C dst diff &&
577 test_must_fail git -C dst fetch --recurse-submodules
580 test_expect_success
"fetch new commits when submodule got renamed" '
581 git clone . downstream_rename &&
583 cd downstream_rename &&
584 git submodule update --init --recursive &&
585 git checkout -b rename &&
586 git mv submodule submodule_renamed &&
588 cd submodule_renamed &&
589 git checkout -b rename_sub &&
593 git push origin rename_sub &&
594 git rev-parse HEAD >../../expect
596 git add submodule_renamed &&
597 git commit -m "update renamed submodule" &&
598 git push origin rename
602 git fetch --recurse-submodules=on-demand &&
605 git rev-parse origin/rename_sub >../../actual
608 test_cmp expect actual
611 test_expect_success
"fetch new submodule commits on-demand outside standard refspec" '
612 # add a second submodule and ensure it is around in downstream first
613 git clone submodule sub1 &&
614 git submodule add ./sub1 &&
615 git commit -m "adding a second submodule" &&
616 git -C downstream pull &&
617 git -C downstream submodule update --init --recursive &&
619 git checkout --detach &&
621 C=$(git -C submodule commit-tree -m "new change outside refs/heads" HEAD^{tree}) &&
622 git -C submodule update-ref refs/changes/1 $C &&
623 git update-index --cacheinfo 160000 $C submodule &&
626 D=$(git -C sub1 commit-tree -m "new change outside refs/heads" HEAD^{tree}) &&
627 git -C sub1 update-ref refs/changes/2 $D &&
628 git update-index --cacheinfo 160000 $D sub1 &&
630 git commit -m "updated submodules outside of refs/heads" &&
631 E=$(git rev-parse HEAD) &&
632 git update-ref refs/changes/3 $E &&
635 git fetch --recurse-submodules origin refs/changes/3:refs/heads/my_branch &&
636 git -C submodule cat-file -t $C &&
637 git -C sub1 cat-file -t $D &&
638 git checkout --recurse-submodules FETCH_HEAD
642 test_expect_success
'fetch new submodule commit on-demand in FETCH_HEAD' '
643 # depends on the previous test for setup
645 C=$(git -C submodule commit-tree -m "another change outside refs/heads" HEAD^{tree}) &&
646 git -C submodule update-ref refs/changes/4 $C &&
647 git update-index --cacheinfo 160000 $C submodule &&
650 D=$(git -C sub1 commit-tree -m "another change outside refs/heads" HEAD^{tree}) &&
651 git -C sub1 update-ref refs/changes/5 $D &&
652 git update-index --cacheinfo 160000 $D sub1 &&
654 git commit -m "updated submodules outside of refs/heads" &&
655 E=$(git rev-parse HEAD) &&
656 git update-ref refs/changes/6 $E &&
659 git fetch --recurse-submodules origin refs/changes/6 &&
660 git -C submodule cat-file -t $C &&
661 git -C sub1 cat-file -t $D &&
662 git checkout --recurse-submodules FETCH_HEAD
666 test_expect_success
'fetch new submodule commits on-demand without .gitmodules entry' '
667 # depends on the previous test for setup
669 git config -f .gitmodules --remove-section submodule.sub1 &&
670 git add .gitmodules &&
671 git commit -m "delete gitmodules file" &&
672 git checkout -B super &&
673 git -C downstream fetch &&
674 git -C downstream checkout origin/super &&
676 C=$(git -C submodule commit-tree -m "yet another change outside refs/heads" HEAD^{tree}) &&
677 git -C submodule update-ref refs/changes/7 $C &&
678 git update-index --cacheinfo 160000 $C submodule &&
681 D=$(git -C sub1 commit-tree -m "yet another change outside refs/heads" HEAD^{tree}) &&
682 git -C sub1 update-ref refs/changes/8 $D &&
683 git update-index --cacheinfo 160000 $D sub1 &&
685 git commit -m "updated submodules outside of refs/heads" &&
686 E=$(git rev-parse HEAD) &&
687 git update-ref refs/changes/9 $E &&
690 git fetch --recurse-submodules origin refs/changes/9 &&
691 git -C submodule cat-file -t $C &&
692 git -C sub1 cat-file -t $D &&
693 git checkout --recurse-submodules FETCH_HEAD
697 test_expect_success
'fetch new submodule commit intermittently referenced by superproject' '
698 # depends on the previous test for setup
700 D=$(git -C sub1 commit-tree -m "change 10 outside refs/heads" HEAD^{tree}) &&
701 E=$(git -C sub1 commit-tree -m "change 11 outside refs/heads" HEAD^{tree}) &&
702 F=$(git -C sub1 commit-tree -m "change 12 outside refs/heads" HEAD^{tree}) &&
704 git -C sub1 update-ref refs/changes/10 $D &&
705 git update-index --cacheinfo 160000 $D sub1 &&
706 git commit -m "updated submodules outside of refs/heads" &&
708 git -C sub1 update-ref refs/changes/11 $E &&
709 git update-index --cacheinfo 160000 $E sub1 &&
710 git commit -m "updated submodules outside of refs/heads" &&
712 git -C sub1 update-ref refs/changes/12 $F &&
713 git update-index --cacheinfo 160000 $F sub1 &&
714 git commit -m "updated submodules outside of refs/heads" &&
716 G=$(git rev-parse HEAD) &&
717 git update-ref refs/changes/13 $G &&
720 git fetch --recurse-submodules origin refs/changes/13 &&
722 git -C sub1 cat-file -t $D &&
723 git -C sub1 cat-file -t $E &&
724 git -C sub1 cat-file -t $F
732 git
-C "$dir" add
"$@" &&
733 git
-C "$dir" commit
-a -m "$msg" &&
737 compare_refs_in_dir
() {
744 git
-C "$1" rev-parse
--verify "$2" >expect
&&
745 git
-C "$3" rev-parse
--verify "$4" >actual
&&
746 eval $fail test_cmp expect actual
750 test_expect_success
'setup nested submodule fetch test' '
751 # does not depend on any previous test setups
753 for repo in outer middle inner
755 git init --bare $repo &&
756 git clone $repo ${repo}_content &&
757 echo "$repo" >"${repo}_content/file" &&
758 add_commit_push ${repo}_content "initial" file ||
763 git -C A submodule add "$pwd/middle" &&
764 git -C A/middle/ submodule add "$pwd/inner" &&
765 add_commit_push A/middle/ "adding inner sub" .gitmodules inner &&
766 add_commit_push A/ "adding middle sub" .gitmodules middle &&
769 git -C B/ submodule update --init middle &&
771 compare_refs_in_dir A HEAD B HEAD &&
772 compare_refs_in_dir A/middle HEAD B/middle HEAD &&
773 test_path_is_file B/file &&
774 test_path_is_file B/middle/file &&
775 test_path_is_missing B/middle/inner/file &&
777 echo "change on inner repo of A" >"A/middle/inner/file" &&
778 add_commit_push A/middle/inner "change on inner" file &&
779 add_commit_push A/middle "change on inner" inner &&
780 add_commit_push A "change on inner" middle
783 test_expect_success
'fetching a superproject containing an uninitialized sub/sub project' '
784 # depends on previous test for setup
787 compare_refs_in_dir A origin/HEAD B origin/HEAD
790 fetch_with_recursion_abort
() {
791 # In a regression the following git call will run into infinite recursion.
792 # To handle that, we connect the sed command to the git call by a pipe
793 # so that sed can kill the infinite recursion when detected.
794 # The recursion creates git output like:
795 # Fetching submodule sub
796 # Fetching submodule sub/sub <-- [1]
797 # Fetching submodule sub/sub/sub
799 # [1] sed will stop reading and cause git to eventually stop and die
801 git
-C "$1" fetch
--recurse-submodules 2>&1 |
802 sed "/Fetching submodule $2[^$]/q" >out
&&
803 ! grep "Fetching submodule $2[^$]" out
806 test_expect_success
'setup recursive fetch with uninit submodule' '
807 # does not depend on any previous test setups
809 test_create_repo super &&
810 test_commit -C super initial &&
811 test_create_repo sub &&
812 test_commit -C sub initial &&
813 git -C sub rev-parse HEAD >expect &&
815 git -C super submodule add ../sub &&
816 git -C super commit -m "add sub" &&
818 git clone super superclone &&
819 git -C superclone submodule status >out &&
820 sed -e "s/^-//" -e "s/ sub.*$//" out >actual &&
821 test_cmp expect actual
824 test_expect_success
'recursive fetch with uninit submodule' '
825 # depends on previous test for setup
827 fetch_with_recursion_abort superclone sub &&
828 git -C superclone submodule status >out &&
829 sed -e "s/^-//" -e "s/ sub$//" out >actual &&
830 test_cmp expect actual
833 test_expect_success
'recursive fetch after deinit a submodule' '
834 # depends on previous test for setup
836 git -C superclone submodule update --init sub &&
837 git -C superclone submodule deinit -f sub &&
839 fetch_with_recursion_abort superclone sub &&
840 git -C superclone submodule status >out &&
841 sed -e "s/^-//" -e "s/ sub$//" out >actual &&
842 test_cmp expect actual