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
9 GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
=1
10 export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
16 add_upstream_commit
() {
19 head1
=$
(git rev-parse
--short HEAD
) &&
20 echo new
>> subfile
&&
23 git commit
-m new subfile
&&
24 head2
=$
(git rev-parse
--short HEAD
) &&
25 echo "Fetching submodule submodule" > ..
/expect.err
&&
26 echo "From $pwd/submodule" >> ..
/expect.err
&&
27 echo " $head1..$head2 sub -> origin/sub" >> ..
/expect.err
31 head1
=$
(git rev-parse
--short HEAD
) &&
32 echo new
>> deepsubfile
&&
34 git add deepsubfile
&&
35 git commit
-m new deepsubfile
&&
36 head2
=$
(git rev-parse
--short HEAD
) &&
37 echo "Fetching submodule submodule/subdir/deepsubmodule" >> ..
/expect.err
38 echo "From $pwd/deepsubmodule" >> ..
/expect.err
&&
39 echo " $head1..$head2 deep -> origin/deep" >> ..
/expect.err
43 test_expect_success setup
'
44 git config --global protocol.file.allow always &&
45 mkdir deepsubmodule &&
49 echo deepsubcontent > deepsubfile &&
50 git add deepsubfile &&
51 git commit -m new deepsubfile &&
58 echo subcontent > subfile &&
60 git submodule add "$pwd/deepsubmodule" subdir/deepsubmodule &&
61 git commit -a -m new &&
64 git submodule add "$pwd/submodule" submodule &&
65 git commit -am initial &&
66 git branch -M super &&
67 git clone . downstream &&
70 git submodule update --init --recursive
74 test_expect_success
"fetch --recurse-submodules recurses into submodules" '
75 add_upstream_commit &&
78 git fetch --recurse-submodules >../actual.out 2>../actual.err
80 test_must_be_empty actual.out &&
81 test_cmp expect.err actual.err
84 test_expect_success
"submodule.recurse option triggers recursive fetch" '
85 add_upstream_commit &&
88 git -c submodule.recurse fetch >../actual.out 2>../actual.err
90 test_must_be_empty actual.out &&
91 test_cmp expect.err actual.err
94 test_expect_success
"fetch --recurse-submodules -j2 has the same output behaviour" '
95 add_upstream_commit &&
98 GIT_TRACE="$TRASH_DIRECTORY/trace.out" git fetch --recurse-submodules -j2 2>../actual.err
100 test_must_be_empty actual.out &&
101 test_cmp expect.err actual.err &&
102 grep "2 tasks" trace.out
105 test_expect_success
"fetch alone only fetches superproject" '
106 add_upstream_commit &&
109 git fetch >../actual.out 2>../actual.err
111 test_must_be_empty actual.out &&
112 test_must_be_empty actual.err
115 test_expect_success
"fetch --no-recurse-submodules only fetches superproject" '
118 git fetch --no-recurse-submodules >../actual.out 2>../actual.err
120 test_must_be_empty actual.out &&
121 test_must_be_empty actual.err
124 test_expect_success
"using fetchRecurseSubmodules=true in .gitmodules recurses into submodules" '
127 git config -f .gitmodules submodule.submodule.fetchRecurseSubmodules true &&
128 git fetch >../actual.out 2>../actual.err
130 test_must_be_empty actual.out &&
131 test_cmp expect.err actual.err
134 test_expect_success
"--no-recurse-submodules overrides .gitmodules config" '
135 add_upstream_commit &&
138 git fetch --no-recurse-submodules >../actual.out 2>../actual.err
140 test_must_be_empty actual.out &&
141 test_must_be_empty actual.err
144 test_expect_success
"using fetchRecurseSubmodules=false in .git/config overrides setting in .gitmodules" '
147 git config submodule.submodule.fetchRecurseSubmodules false &&
148 git fetch >../actual.out 2>../actual.err
150 test_must_be_empty actual.out &&
151 test_must_be_empty actual.err
154 test_expect_success
"--recurse-submodules overrides fetchRecurseSubmodules setting from .git/config" '
157 git fetch --recurse-submodules >../actual.out 2>../actual.err &&
158 git config --unset -f .gitmodules submodule.submodule.fetchRecurseSubmodules &&
159 git config --unset submodule.submodule.fetchRecurseSubmodules
161 test_must_be_empty actual.out &&
162 test_cmp expect.err actual.err
165 test_expect_success
"--quiet propagates to submodules" '
168 git fetch --recurse-submodules --quiet >../actual.out 2>../actual.err
170 test_must_be_empty actual.out &&
171 test_must_be_empty actual.err
174 test_expect_success
"--quiet propagates to parallel submodules" '
177 git fetch --recurse-submodules -j 2 --quiet >../actual.out 2>../actual.err
179 test_must_be_empty actual.out &&
180 test_must_be_empty actual.err
183 test_expect_success
"--dry-run propagates to submodules" '
184 add_upstream_commit &&
187 git fetch --recurse-submodules --dry-run >../actual.out 2>../actual.err
189 test_must_be_empty actual.out &&
190 test_cmp expect.err actual.err
193 test_expect_success
"Without --dry-run propagates to submodules" '
196 git fetch --recurse-submodules >../actual.out 2>../actual.err
198 test_must_be_empty actual.out &&
199 test_cmp expect.err actual.err
202 test_expect_success
"recurseSubmodules=true propagates into submodules" '
203 add_upstream_commit &&
206 git config fetch.recurseSubmodules true &&
207 git fetch >../actual.out 2>../actual.err
209 test_must_be_empty actual.out &&
210 test_cmp expect.err actual.err
213 test_expect_success
"--recurse-submodules overrides config in submodule" '
214 add_upstream_commit &&
219 git config fetch.recurseSubmodules false
221 git fetch --recurse-submodules >../actual.out 2>../actual.err
223 test_must_be_empty actual.out &&
224 test_cmp expect.err actual.err
227 test_expect_success
"--no-recurse-submodules overrides config setting" '
228 add_upstream_commit &&
231 git config fetch.recurseSubmodules true &&
232 git fetch --no-recurse-submodules >../actual.out 2>../actual.err
234 test_must_be_empty actual.out &&
235 test_must_be_empty actual.err
238 test_expect_success
"Recursion doesn't happen when no new commits are fetched in the superproject" '
243 git config --unset fetch.recurseSubmodules
245 git config --unset fetch.recurseSubmodules &&
246 git fetch >../actual.out 2>../actual.err
248 test_must_be_empty actual.out &&
249 test_must_be_empty actual.err
252 test_expect_success
"Recursion stops when no new submodule commits are fetched" '
253 head1=$(git rev-parse --short HEAD) &&
255 git commit -m "new submodule" &&
256 head2=$(git rev-parse --short HEAD) &&
257 echo "From $pwd/." > expect.err.sub &&
258 echo " $head1..$head2 super -> origin/super" >>expect.err.sub &&
259 head -3 expect.err >> expect.err.sub &&
262 git fetch >../actual.out 2>../actual.err
264 test_cmp expect.err.sub actual.err &&
265 test_must_be_empty actual.out
268 test_expect_success
"Recursion doesn't happen when new superproject commits don't change any submodules" '
269 add_upstream_commit &&
270 head1=$(git rev-parse --short HEAD) &&
273 git commit -m "new file" &&
274 head2=$(git rev-parse --short HEAD) &&
275 echo "From $pwd/." > expect.err.file &&
276 echo " $head1..$head2 super -> origin/super" >> expect.err.file &&
279 git fetch >../actual.out 2>../actual.err
281 test_must_be_empty actual.out &&
282 test_cmp expect.err.file actual.err
285 test_expect_success
"Recursion picks up config in submodule" '
288 git fetch --recurse-submodules &&
291 git config fetch.recurseSubmodules true
294 add_upstream_commit &&
295 head1=$(git rev-parse --short HEAD) &&
297 git commit -m "new submodule" &&
298 head2=$(git rev-parse --short HEAD) &&
299 echo "From $pwd/." > expect.err.sub &&
300 echo " $head1..$head2 super -> origin/super" >> expect.err.sub &&
301 cat expect.err >> expect.err.sub &&
304 git fetch >../actual.out 2>../actual.err &&
307 git config --unset fetch.recurseSubmodules
310 test_cmp expect.err.sub actual.err &&
311 test_must_be_empty actual.out
314 test_expect_success
"Recursion picks up all submodules when necessary" '
315 add_upstream_commit &&
319 cd subdir/deepsubmodule &&
321 git checkout -q FETCH_HEAD
323 head1=$(git rev-parse --short HEAD^) &&
324 git add subdir/deepsubmodule &&
325 git commit -m "new deepsubmodule" &&
326 head2=$(git rev-parse --short HEAD) &&
327 echo "Fetching submodule submodule" > ../expect.err.sub &&
328 echo "From $pwd/submodule" >> ../expect.err.sub &&
329 echo " $head1..$head2 sub -> origin/sub" >> ../expect.err.sub
331 head1=$(git rev-parse --short HEAD) &&
333 git commit -m "new submodule" &&
334 head2=$(git rev-parse --short HEAD) &&
335 echo "From $pwd/." > expect.err.2 &&
336 echo " $head1..$head2 super -> origin/super" >> expect.err.2 &&
337 cat expect.err.sub >> expect.err.2 &&
338 tail -3 expect.err >> expect.err.2 &&
341 git fetch >../actual.out 2>../actual.err
343 test_cmp expect.err.2 actual.err &&
344 test_must_be_empty actual.out
347 test_expect_success
"'--recurse-submodules=on-demand' doesn't recurse when no new commits are fetched in the superproject (and ignores config)" '
348 add_upstream_commit &&
352 cd subdir/deepsubmodule &&
354 git checkout -q FETCH_HEAD
356 head1=$(git rev-parse --short HEAD^) &&
357 git add subdir/deepsubmodule &&
358 git commit -m "new deepsubmodule" &&
359 head2=$(git rev-parse --short HEAD) &&
360 echo Fetching submodule submodule > ../expect.err.sub &&
361 echo "From $pwd/submodule" >> ../expect.err.sub &&
362 echo " $head1..$head2 sub -> origin/sub" >> ../expect.err.sub
366 git config fetch.recurseSubmodules true &&
367 git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err &&
368 git config --unset fetch.recurseSubmodules
370 test_must_be_empty actual.out &&
371 test_must_be_empty actual.err
374 test_expect_success
"'--recurse-submodules=on-demand' recurses as deep as necessary (and ignores config)" '
375 head1=$(git rev-parse --short HEAD) &&
377 git commit -m "new submodule" &&
378 head2=$(git rev-parse --short HEAD) &&
379 tail -3 expect.err > expect.err.deepsub &&
380 echo "From $pwd/." > expect.err &&
381 echo " $head1..$head2 super -> origin/super" >>expect.err &&
382 cat expect.err.sub >> expect.err &&
383 cat expect.err.deepsub >> expect.err &&
386 git config fetch.recurseSubmodules false &&
389 git config -f .gitmodules submodule.subdir/deepsubmodule.fetchRecursive false
391 git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err &&
392 git config --unset fetch.recurseSubmodules &&
395 git config --unset -f .gitmodules submodule.subdir/deepsubmodule.fetchRecursive
398 test_must_be_empty actual.out &&
399 test_cmp expect.err actual.err
402 test_expect_success
"'--recurse-submodules=on-demand' stops when no new submodule commits are found in the superproject (and ignores config)" '
403 add_upstream_commit &&
404 head1=$(git rev-parse --short HEAD) &&
407 git commit -m "new file" &&
408 head2=$(git rev-parse --short HEAD) &&
409 echo "From $pwd/." > expect.err.file &&
410 echo " $head1..$head2 super -> origin/super" >> expect.err.file &&
413 git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err
415 test_must_be_empty actual.out &&
416 test_cmp expect.err.file actual.err
419 test_expect_success
"'fetch.recurseSubmodules=on-demand' overrides global config" '
422 git fetch --recurse-submodules
424 add_upstream_commit &&
425 git config --global fetch.recurseSubmodules false &&
426 head1=$(git rev-parse --short HEAD) &&
428 git commit -m "new submodule" &&
429 head2=$(git rev-parse --short HEAD) &&
430 echo "From $pwd/." > expect.err.2 &&
431 echo " $head1..$head2 super -> origin/super" >>expect.err.2 &&
432 head -3 expect.err >> expect.err.2 &&
435 git config fetch.recurseSubmodules on-demand &&
436 git fetch >../actual.out 2>../actual.err
438 git config --global --unset fetch.recurseSubmodules &&
441 git config --unset fetch.recurseSubmodules
443 test_must_be_empty actual.out &&
444 test_cmp expect.err.2 actual.err
447 test_expect_success
"'submodule.<sub>.fetchRecurseSubmodules=on-demand' overrides fetch.recurseSubmodules" '
450 git fetch --recurse-submodules
452 add_upstream_commit &&
453 git config fetch.recurseSubmodules false &&
454 head1=$(git rev-parse --short HEAD) &&
456 git commit -m "new submodule" &&
457 head2=$(git rev-parse --short HEAD) &&
458 echo "From $pwd/." > expect.err.2 &&
459 echo " $head1..$head2 super -> origin/super" >>expect.err.2 &&
460 head -3 expect.err >> expect.err.2 &&
463 git config submodule.submodule.fetchRecurseSubmodules on-demand &&
464 git fetch >../actual.out 2>../actual.err
466 git config --unset fetch.recurseSubmodules &&
469 git config --unset submodule.submodule.fetchRecurseSubmodules
471 test_must_be_empty actual.out &&
472 test_cmp expect.err.2 actual.err
475 test_expect_success
"don't fetch submodule when newly recorded commits are already present" '
478 git checkout -q HEAD^^
480 head1=$(git rev-parse --short HEAD) &&
482 git commit -m "submodule rewound" &&
483 head2=$(git rev-parse --short HEAD) &&
484 echo "From $pwd/." > expect.err &&
485 echo " $head1..$head2 super -> origin/super" >> expect.err &&
488 git fetch >../actual.out 2>../actual.err
490 test_must_be_empty actual.out &&
491 test_cmp expect.err actual.err &&
498 test_expect_success
"'fetch.recurseSubmodules=on-demand' works also without .gitmodules entry" '
501 git fetch --recurse-submodules
503 add_upstream_commit &&
504 head1=$(git rev-parse --short HEAD) &&
506 git rm .gitmodules &&
507 git commit -m "new submodule without .gitmodules" &&
508 head2=$(git rev-parse --short HEAD) &&
509 echo "From $pwd/." >expect.err.2 &&
510 echo " $head1..$head2 super -> origin/super" >>expect.err.2 &&
511 head -3 expect.err >>expect.err.2 &&
515 git config fetch.recurseSubmodules on-demand &&
516 # fake submodule configuration to avoid skipping submodule handling
517 git config -f .gitmodules submodule.fake.path fake &&
518 git config -f .gitmodules submodule.fake.url fakeurl &&
519 git add .gitmodules &&
520 git config --unset submodule.submodule.url &&
521 git fetch >../actual.out 2>../actual.err &&
523 git config --unset fetch.recurseSubmodules &&
526 test_must_be_empty actual.out &&
527 test_cmp expect.err.2 actual.err &&
528 git checkout HEAD^ -- .gitmodules &&
529 git add .gitmodules &&
530 git commit -m "new submodule restored .gitmodules"
533 test_expect_success
'fetching submodules respects parallel settings' '
534 git config fetch.recurseSubmodules true &&
537 GIT_TRACE=$(pwd)/trace.out git fetch &&
538 grep "1 tasks" trace.out &&
539 GIT_TRACE=$(pwd)/trace.out git fetch --jobs 7 &&
540 grep "7 tasks" trace.out &&
541 git config submodule.fetchJobs 8 &&
542 GIT_TRACE=$(pwd)/trace.out git fetch &&
543 grep "8 tasks" trace.out &&
544 GIT_TRACE=$(pwd)/trace.out git fetch --jobs 9 &&
545 grep "9 tasks" trace.out
549 test_expect_success
'fetching submodule into a broken repository' '
550 # Prepare src and src/sub nested in it
555 git -C sub commit --allow-empty -m "initial in sub" &&
556 git submodule add -- ./sub sub &&
557 git commit -m "initial in top"
560 # Clone the old-fashoned way
562 git -C dst clone ../src/sub sub &&
564 # Make sure that old-fashoned layout is still supported
567 # "diff" would find no change
568 git -C dst diff --exit-code &&
570 # Recursive-fetch works fine
571 git -C dst fetch --recurse-submodules &&
573 # Break the receiving submodule
574 rm -f dst/sub/.git/HEAD &&
576 # NOTE: without the fix the following tests will recurse forever!
577 # They should terminate with an error.
579 test_must_fail git -C dst status &&
580 test_must_fail git -C dst diff &&
581 test_must_fail git -C dst fetch --recurse-submodules
584 test_expect_success
"fetch new commits when submodule got renamed" '
585 git clone . downstream_rename &&
587 cd downstream_rename &&
588 git submodule update --init --recursive &&
589 git checkout -b rename &&
590 git mv submodule submodule_renamed &&
592 cd submodule_renamed &&
593 git checkout -b rename_sub &&
597 git push origin rename_sub &&
598 git rev-parse HEAD >../../expect
600 git add submodule_renamed &&
601 git commit -m "update renamed submodule" &&
602 git push origin rename
606 git fetch --recurse-submodules=on-demand &&
609 git rev-parse origin/rename_sub >../../actual
612 test_cmp expect actual
615 test_expect_success
"fetch new submodule commits on-demand outside standard refspec" '
616 # add a second submodule and ensure it is around in downstream first
617 git clone submodule sub1 &&
618 git submodule add ./sub1 &&
619 git commit -m "adding a second submodule" &&
620 git -C downstream pull &&
621 git -C downstream submodule update --init --recursive &&
623 git checkout --detach &&
625 C=$(git -C submodule commit-tree -m "new change outside refs/heads" HEAD^{tree}) &&
626 git -C submodule update-ref refs/changes/1 $C &&
627 git update-index --cacheinfo 160000 $C submodule &&
630 D=$(git -C sub1 commit-tree -m "new change outside refs/heads" HEAD^{tree}) &&
631 git -C sub1 update-ref refs/changes/2 $D &&
632 git update-index --cacheinfo 160000 $D sub1 &&
634 git commit -m "updated submodules outside of refs/heads" &&
635 E=$(git rev-parse HEAD) &&
636 git update-ref refs/changes/3 $E &&
639 git fetch --recurse-submodules origin refs/changes/3:refs/heads/my_branch &&
640 git -C submodule cat-file -t $C &&
641 git -C sub1 cat-file -t $D &&
642 git checkout --recurse-submodules FETCH_HEAD
646 test_expect_success
'fetch new submodule commit on-demand in FETCH_HEAD' '
647 # depends on the previous test for setup
649 C=$(git -C submodule commit-tree -m "another change outside refs/heads" HEAD^{tree}) &&
650 git -C submodule update-ref refs/changes/4 $C &&
651 git update-index --cacheinfo 160000 $C submodule &&
654 D=$(git -C sub1 commit-tree -m "another change outside refs/heads" HEAD^{tree}) &&
655 git -C sub1 update-ref refs/changes/5 $D &&
656 git update-index --cacheinfo 160000 $D sub1 &&
658 git commit -m "updated submodules outside of refs/heads" &&
659 E=$(git rev-parse HEAD) &&
660 git update-ref refs/changes/6 $E &&
663 git fetch --recurse-submodules origin refs/changes/6 &&
664 git -C submodule cat-file -t $C &&
665 git -C sub1 cat-file -t $D &&
666 git checkout --recurse-submodules FETCH_HEAD
670 test_expect_success
'fetch new submodule commits on-demand without .gitmodules entry' '
671 # depends on the previous test for setup
673 git config -f .gitmodules --remove-section submodule.sub1 &&
674 git add .gitmodules &&
675 git commit -m "delete gitmodules file" &&
676 git checkout -B super &&
677 git -C downstream fetch &&
678 git -C downstream checkout origin/super &&
680 C=$(git -C submodule commit-tree -m "yet another change outside refs/heads" HEAD^{tree}) &&
681 git -C submodule update-ref refs/changes/7 $C &&
682 git update-index --cacheinfo 160000 $C submodule &&
685 D=$(git -C sub1 commit-tree -m "yet another change outside refs/heads" HEAD^{tree}) &&
686 git -C sub1 update-ref refs/changes/8 $D &&
687 git update-index --cacheinfo 160000 $D sub1 &&
689 git commit -m "updated submodules outside of refs/heads" &&
690 E=$(git rev-parse HEAD) &&
691 git update-ref refs/changes/9 $E &&
694 git fetch --recurse-submodules origin refs/changes/9 &&
695 git -C submodule cat-file -t $C &&
696 git -C sub1 cat-file -t $D &&
697 git checkout --recurse-submodules FETCH_HEAD
701 test_expect_success
'fetch new submodule commit intermittently referenced by superproject' '
702 # depends on the previous test for setup
704 D=$(git -C sub1 commit-tree -m "change 10 outside refs/heads" HEAD^{tree}) &&
705 E=$(git -C sub1 commit-tree -m "change 11 outside refs/heads" HEAD^{tree}) &&
706 F=$(git -C sub1 commit-tree -m "change 12 outside refs/heads" HEAD^{tree}) &&
708 git -C sub1 update-ref refs/changes/10 $D &&
709 git update-index --cacheinfo 160000 $D sub1 &&
710 git commit -m "updated submodules outside of refs/heads" &&
712 git -C sub1 update-ref refs/changes/11 $E &&
713 git update-index --cacheinfo 160000 $E sub1 &&
714 git commit -m "updated submodules outside of refs/heads" &&
716 git -C sub1 update-ref refs/changes/12 $F &&
717 git update-index --cacheinfo 160000 $F sub1 &&
718 git commit -m "updated submodules outside of refs/heads" &&
720 G=$(git rev-parse HEAD) &&
721 git update-ref refs/changes/13 $G &&
724 git fetch --recurse-submodules origin refs/changes/13 &&
726 git -C sub1 cat-file -t $D &&
727 git -C sub1 cat-file -t $E &&
728 git -C sub1 cat-file -t $F
736 git
-C "$dir" add
"$@" &&
737 git
-C "$dir" commit
-a -m "$msg" &&
741 compare_refs_in_dir
() {
748 git
-C "$1" rev-parse
--verify "$2" >expect
&&
749 git
-C "$3" rev-parse
--verify "$4" >actual
&&
750 eval $fail test_cmp expect actual
754 test_expect_success
'setup nested submodule fetch test' '
755 # does not depend on any previous test setups
757 for repo in outer middle inner
759 git init --bare $repo &&
760 git clone $repo ${repo}_content &&
761 echo "$repo" >"${repo}_content/file" &&
762 add_commit_push ${repo}_content "initial" file ||
767 git -C A submodule add "$pwd/middle" &&
768 git -C A/middle/ submodule add "$pwd/inner" &&
769 add_commit_push A/middle/ "adding inner sub" .gitmodules inner &&
770 add_commit_push A/ "adding middle sub" .gitmodules middle &&
773 git -C B/ submodule update --init middle &&
775 compare_refs_in_dir A HEAD B HEAD &&
776 compare_refs_in_dir A/middle HEAD B/middle HEAD &&
777 test_path_is_file B/file &&
778 test_path_is_file B/middle/file &&
779 test_path_is_missing B/middle/inner/file &&
781 echo "change on inner repo of A" >"A/middle/inner/file" &&
782 add_commit_push A/middle/inner "change on inner" file &&
783 add_commit_push A/middle "change on inner" inner &&
784 add_commit_push A "change on inner" middle
787 test_expect_success
'fetching a superproject containing an uninitialized sub/sub project' '
788 # depends on previous test for setup
791 compare_refs_in_dir A origin/HEAD B origin/HEAD
794 fetch_with_recursion_abort
() {
795 # In a regression the following git call will run into infinite recursion.
796 # To handle that, we connect the sed command to the git call by a pipe
797 # so that sed can kill the infinite recursion when detected.
798 # The recursion creates git output like:
799 # Fetching submodule sub
800 # Fetching submodule sub/sub <-- [1]
801 # Fetching submodule sub/sub/sub
803 # [1] sed will stop reading and cause git to eventually stop and die
805 git
-C "$1" fetch
--recurse-submodules 2>&1 |
806 sed "/Fetching submodule $2[^$]/q" >out
&&
807 ! grep "Fetching submodule $2[^$]" out
810 test_expect_success
'setup recursive fetch with uninit submodule' '
811 # does not depend on any previous test setups
813 test_create_repo super &&
814 test_commit -C super initial &&
815 test_create_repo sub &&
816 test_commit -C sub initial &&
817 git -C sub rev-parse HEAD >expect &&
819 git -C super submodule add ../sub &&
820 git -C super commit -m "add sub" &&
822 git clone super superclone &&
823 git -C superclone submodule status >out &&
824 sed -e "s/^-//" -e "s/ sub.*$//" out >actual &&
825 test_cmp expect actual
828 test_expect_success
'recursive fetch with uninit submodule' '
829 # depends on previous test for setup
831 fetch_with_recursion_abort superclone sub &&
832 git -C superclone submodule status >out &&
833 sed -e "s/^-//" -e "s/ sub$//" out >actual &&
834 test_cmp expect actual
837 test_expect_success
'recursive fetch after deinit a submodule' '
838 # depends on previous test for setup
840 git -C superclone submodule update --init sub &&
841 git -C superclone submodule deinit -f sub &&
843 fetch_with_recursion_abort superclone sub &&
844 git -C superclone submodule status >out &&
845 sed -e "s/^-//" -e "s/ sub$//" out >actual &&
846 test_cmp expect actual