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 mkdir deepsubmodule &&
48 echo deepsubcontent > deepsubfile &&
49 git add deepsubfile &&
50 git commit -m new deepsubfile &&
57 echo subcontent > subfile &&
59 git submodule add "$pwd/deepsubmodule" subdir/deepsubmodule &&
60 git commit -a -m new &&
63 git submodule add "$pwd/submodule" submodule &&
64 git commit -am initial &&
65 git branch -M super &&
66 git clone . downstream &&
69 git submodule update --init --recursive
73 test_expect_success
"fetch --recurse-submodules recurses into submodules" '
74 add_upstream_commit &&
77 git fetch --recurse-submodules >../actual.out 2>../actual.err
79 test_must_be_empty actual.out &&
80 test_cmp expect.err actual.err
83 test_expect_success
"submodule.recurse option triggers recursive fetch" '
84 add_upstream_commit &&
87 git -c submodule.recurse fetch >../actual.out 2>../actual.err
89 test_must_be_empty actual.out &&
90 test_cmp expect.err actual.err
93 test_expect_success
"fetch --recurse-submodules -j2 has the same output behaviour" '
94 add_upstream_commit &&
97 GIT_TRACE="$TRASH_DIRECTORY/trace.out" git fetch --recurse-submodules -j2 2>../actual.err
99 test_must_be_empty actual.out &&
100 test_cmp expect.err actual.err &&
101 grep "2 tasks" trace.out
104 test_expect_success
"fetch alone only fetches superproject" '
105 add_upstream_commit &&
108 git fetch >../actual.out 2>../actual.err
110 test_must_be_empty actual.out &&
111 test_must_be_empty actual.err
114 test_expect_success
"fetch --no-recurse-submodules only fetches superproject" '
117 git fetch --no-recurse-submodules >../actual.out 2>../actual.err
119 test_must_be_empty actual.out &&
120 test_must_be_empty actual.err
123 test_expect_success
"using fetchRecurseSubmodules=true in .gitmodules recurses into submodules" '
126 git config -f .gitmodules submodule.submodule.fetchRecurseSubmodules true &&
127 git fetch >../actual.out 2>../actual.err
129 test_must_be_empty actual.out &&
130 test_cmp expect.err actual.err
133 test_expect_success
"--no-recurse-submodules overrides .gitmodules config" '
134 add_upstream_commit &&
137 git fetch --no-recurse-submodules >../actual.out 2>../actual.err
139 test_must_be_empty actual.out &&
140 test_must_be_empty actual.err
143 test_expect_success
"using fetchRecurseSubmodules=false in .git/config overrides setting in .gitmodules" '
146 git config submodule.submodule.fetchRecurseSubmodules false &&
147 git fetch >../actual.out 2>../actual.err
149 test_must_be_empty actual.out &&
150 test_must_be_empty actual.err
153 test_expect_success
"--recurse-submodules overrides fetchRecurseSubmodules setting from .git/config" '
156 git fetch --recurse-submodules >../actual.out 2>../actual.err &&
157 git config --unset -f .gitmodules submodule.submodule.fetchRecurseSubmodules &&
158 git config --unset submodule.submodule.fetchRecurseSubmodules
160 test_must_be_empty actual.out &&
161 test_cmp expect.err actual.err
164 test_expect_success
"--quiet propagates to submodules" '
167 git fetch --recurse-submodules --quiet >../actual.out 2>../actual.err
169 test_must_be_empty actual.out &&
170 test_must_be_empty actual.err
173 test_expect_success
"--quiet propagates to parallel submodules" '
176 git fetch --recurse-submodules -j 2 --quiet >../actual.out 2>../actual.err
178 test_must_be_empty actual.out &&
179 test_must_be_empty actual.err
182 test_expect_success
"--dry-run propagates to submodules" '
183 add_upstream_commit &&
186 git fetch --recurse-submodules --dry-run >../actual.out 2>../actual.err
188 test_must_be_empty actual.out &&
189 test_cmp expect.err actual.err
192 test_expect_success
"Without --dry-run propagates to submodules" '
195 git fetch --recurse-submodules >../actual.out 2>../actual.err
197 test_must_be_empty actual.out &&
198 test_cmp expect.err actual.err
201 test_expect_success
"recurseSubmodules=true propagates into submodules" '
202 add_upstream_commit &&
205 git config fetch.recurseSubmodules true &&
206 git fetch >../actual.out 2>../actual.err
208 test_must_be_empty actual.out &&
209 test_cmp expect.err actual.err
212 test_expect_success
"--recurse-submodules overrides config in submodule" '
213 add_upstream_commit &&
218 git config fetch.recurseSubmodules false
220 git fetch --recurse-submodules >../actual.out 2>../actual.err
222 test_must_be_empty actual.out &&
223 test_cmp expect.err actual.err
226 test_expect_success
"--no-recurse-submodules overrides config setting" '
227 add_upstream_commit &&
230 git config fetch.recurseSubmodules true &&
231 git fetch --no-recurse-submodules >../actual.out 2>../actual.err
233 test_must_be_empty actual.out &&
234 test_must_be_empty actual.err
237 test_expect_success
"Recursion doesn't happen when no new commits are fetched in the superproject" '
242 git config --unset fetch.recurseSubmodules
244 git config --unset fetch.recurseSubmodules &&
245 git fetch >../actual.out 2>../actual.err
247 test_must_be_empty actual.out &&
248 test_must_be_empty actual.err
251 test_expect_success
"Recursion stops when no new submodule commits are fetched" '
252 head1=$(git rev-parse --short HEAD) &&
254 git commit -m "new submodule" &&
255 head2=$(git rev-parse --short HEAD) &&
256 echo "From $pwd/." > expect.err.sub &&
257 echo " $head1..$head2 super -> origin/super" >>expect.err.sub &&
258 head -3 expect.err >> expect.err.sub &&
261 git fetch >../actual.out 2>../actual.err
263 test_cmp expect.err.sub actual.err &&
264 test_must_be_empty actual.out
267 test_expect_success
"Recursion doesn't happen when new superproject commits don't change any submodules" '
268 add_upstream_commit &&
269 head1=$(git rev-parse --short HEAD) &&
272 git commit -m "new file" &&
273 head2=$(git rev-parse --short HEAD) &&
274 echo "From $pwd/." > expect.err.file &&
275 echo " $head1..$head2 super -> origin/super" >> expect.err.file &&
278 git fetch >../actual.out 2>../actual.err
280 test_must_be_empty actual.out &&
281 test_cmp expect.err.file actual.err
284 test_expect_success
"Recursion picks up config in submodule" '
287 git fetch --recurse-submodules &&
290 git config fetch.recurseSubmodules true
293 add_upstream_commit &&
294 head1=$(git rev-parse --short HEAD) &&
296 git commit -m "new submodule" &&
297 head2=$(git rev-parse --short HEAD) &&
298 echo "From $pwd/." > expect.err.sub &&
299 echo " $head1..$head2 super -> origin/super" >> expect.err.sub &&
300 cat expect.err >> expect.err.sub &&
303 git fetch >../actual.out 2>../actual.err &&
306 git config --unset fetch.recurseSubmodules
309 test_cmp expect.err.sub actual.err &&
310 test_must_be_empty actual.out
313 test_expect_success
"Recursion picks up all submodules when necessary" '
314 add_upstream_commit &&
318 cd subdir/deepsubmodule &&
320 git checkout -q FETCH_HEAD
322 head1=$(git rev-parse --short HEAD^) &&
323 git add subdir/deepsubmodule &&
324 git commit -m "new deepsubmodule" &&
325 head2=$(git rev-parse --short HEAD) &&
326 echo "Fetching submodule submodule" > ../expect.err.sub &&
327 echo "From $pwd/submodule" >> ../expect.err.sub &&
328 echo " $head1..$head2 sub -> origin/sub" >> ../expect.err.sub
330 head1=$(git rev-parse --short HEAD) &&
332 git commit -m "new submodule" &&
333 head2=$(git rev-parse --short HEAD) &&
334 echo "From $pwd/." > expect.err.2 &&
335 echo " $head1..$head2 super -> origin/super" >> expect.err.2 &&
336 cat expect.err.sub >> expect.err.2 &&
337 tail -3 expect.err >> expect.err.2 &&
340 git fetch >../actual.out 2>../actual.err
342 test_cmp expect.err.2 actual.err &&
343 test_must_be_empty actual.out
346 test_expect_success
"'--recurse-submodules=on-demand' doesn't recurse when no new commits are fetched in the superproject (and ignores config)" '
347 add_upstream_commit &&
351 cd subdir/deepsubmodule &&
353 git checkout -q FETCH_HEAD
355 head1=$(git rev-parse --short HEAD^) &&
356 git add subdir/deepsubmodule &&
357 git commit -m "new deepsubmodule" &&
358 head2=$(git rev-parse --short HEAD) &&
359 echo Fetching submodule submodule > ../expect.err.sub &&
360 echo "From $pwd/submodule" >> ../expect.err.sub &&
361 echo " $head1..$head2 sub -> origin/sub" >> ../expect.err.sub
365 git config fetch.recurseSubmodules true &&
366 git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err &&
367 git config --unset fetch.recurseSubmodules
369 test_must_be_empty actual.out &&
370 test_must_be_empty actual.err
373 test_expect_success
"'--recurse-submodules=on-demand' recurses as deep as necessary (and ignores config)" '
374 head1=$(git rev-parse --short HEAD) &&
376 git commit -m "new submodule" &&
377 head2=$(git rev-parse --short HEAD) &&
378 tail -3 expect.err > expect.err.deepsub &&
379 echo "From $pwd/." > expect.err &&
380 echo " $head1..$head2 super -> origin/super" >>expect.err &&
381 cat expect.err.sub >> expect.err &&
382 cat expect.err.deepsub >> expect.err &&
385 git config fetch.recurseSubmodules false &&
388 git config -f .gitmodules submodule.subdir/deepsubmodule.fetchRecursive false
390 git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err &&
391 git config --unset fetch.recurseSubmodules &&
394 git config --unset -f .gitmodules submodule.subdir/deepsubmodule.fetchRecursive
397 test_must_be_empty actual.out &&
398 test_cmp expect.err actual.err
401 test_expect_success
"'--recurse-submodules=on-demand' stops when no new submodule commits are found in the superproject (and ignores config)" '
402 add_upstream_commit &&
403 head1=$(git rev-parse --short HEAD) &&
406 git commit -m "new file" &&
407 head2=$(git rev-parse --short HEAD) &&
408 echo "From $pwd/." > expect.err.file &&
409 echo " $head1..$head2 super -> origin/super" >> expect.err.file &&
412 git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err
414 test_must_be_empty actual.out &&
415 test_cmp expect.err.file actual.err
418 test_expect_success
"'fetch.recurseSubmodules=on-demand' overrides global config" '
421 git fetch --recurse-submodules
423 add_upstream_commit &&
424 git config --global fetch.recurseSubmodules false &&
425 head1=$(git rev-parse --short HEAD) &&
427 git commit -m "new submodule" &&
428 head2=$(git rev-parse --short HEAD) &&
429 echo "From $pwd/." > expect.err.2 &&
430 echo " $head1..$head2 super -> origin/super" >>expect.err.2 &&
431 head -3 expect.err >> expect.err.2 &&
434 git config fetch.recurseSubmodules on-demand &&
435 git fetch >../actual.out 2>../actual.err
437 git config --global --unset fetch.recurseSubmodules &&
440 git config --unset fetch.recurseSubmodules
442 test_must_be_empty actual.out &&
443 test_cmp expect.err.2 actual.err
446 test_expect_success
"'submodule.<sub>.fetchRecurseSubmodules=on-demand' overrides fetch.recurseSubmodules" '
449 git fetch --recurse-submodules
451 add_upstream_commit &&
452 git config fetch.recurseSubmodules false &&
453 head1=$(git rev-parse --short HEAD) &&
455 git commit -m "new submodule" &&
456 head2=$(git rev-parse --short HEAD) &&
457 echo "From $pwd/." > expect.err.2 &&
458 echo " $head1..$head2 super -> origin/super" >>expect.err.2 &&
459 head -3 expect.err >> expect.err.2 &&
462 git config submodule.submodule.fetchRecurseSubmodules on-demand &&
463 git fetch >../actual.out 2>../actual.err
465 git config --unset fetch.recurseSubmodules &&
468 git config --unset submodule.submodule.fetchRecurseSubmodules
470 test_must_be_empty actual.out &&
471 test_cmp expect.err.2 actual.err
474 test_expect_success
"don't fetch submodule when newly recorded commits are already present" '
477 git checkout -q HEAD^^
479 head1=$(git rev-parse --short HEAD) &&
481 git commit -m "submodule rewound" &&
482 head2=$(git rev-parse --short HEAD) &&
483 echo "From $pwd/." > expect.err &&
484 echo " $head1..$head2 super -> origin/super" >> expect.err &&
487 git fetch >../actual.out 2>../actual.err
489 test_must_be_empty actual.out &&
490 test_cmp expect.err actual.err &&
497 test_expect_success
"'fetch.recurseSubmodules=on-demand' works also without .gitmodules entry" '
500 git fetch --recurse-submodules
502 add_upstream_commit &&
503 head1=$(git rev-parse --short HEAD) &&
505 git rm .gitmodules &&
506 git commit -m "new submodule without .gitmodules" &&
507 head2=$(git rev-parse --short HEAD) &&
508 echo "From $pwd/." >expect.err.2 &&
509 echo " $head1..$head2 super -> origin/super" >>expect.err.2 &&
510 head -3 expect.err >>expect.err.2 &&
514 git config fetch.recurseSubmodules on-demand &&
515 # fake submodule configuration to avoid skipping submodule handling
516 git config -f .gitmodules submodule.fake.path fake &&
517 git config -f .gitmodules submodule.fake.url fakeurl &&
518 git add .gitmodules &&
519 git config --unset submodule.submodule.url &&
520 git fetch >../actual.out 2>../actual.err &&
522 git config --unset fetch.recurseSubmodules &&
525 test_must_be_empty actual.out &&
526 test_cmp expect.err.2 actual.err &&
527 git checkout HEAD^ -- .gitmodules &&
528 git add .gitmodules &&
529 git commit -m "new submodule restored .gitmodules"
532 test_expect_success
'fetching submodules respects parallel settings' '
533 git config fetch.recurseSubmodules true &&
536 GIT_TRACE=$(pwd)/trace.out git fetch &&
537 grep "1 tasks" trace.out &&
538 GIT_TRACE=$(pwd)/trace.out git fetch --jobs 7 &&
539 grep "7 tasks" trace.out &&
540 git config submodule.fetchJobs 8 &&
541 GIT_TRACE=$(pwd)/trace.out git fetch &&
542 grep "8 tasks" trace.out &&
543 GIT_TRACE=$(pwd)/trace.out git fetch --jobs 9 &&
544 grep "9 tasks" trace.out
548 test_expect_success
'fetching submodule into a broken repository' '
549 # Prepare src and src/sub nested in it
554 git -C sub commit --allow-empty -m "initial in sub" &&
555 git submodule add -- ./sub sub &&
556 git commit -m "initial in top"
559 # Clone the old-fashoned way
561 git -C dst clone ../src/sub sub &&
563 # Make sure that old-fashoned layout is still supported
566 # "diff" would find no change
567 git -C dst diff --exit-code &&
569 # Recursive-fetch works fine
570 git -C dst fetch --recurse-submodules &&
572 # Break the receiving submodule
573 rm -f dst/sub/.git/HEAD &&
575 # NOTE: without the fix the following tests will recurse forever!
576 # They should terminate with an error.
578 test_must_fail git -C dst status &&
579 test_must_fail git -C dst diff &&
580 test_must_fail git -C dst fetch --recurse-submodules
583 test_expect_success
"fetch new commits when submodule got renamed" '
584 git clone . downstream_rename &&
586 cd downstream_rename &&
587 git submodule update --init --recursive &&
588 git checkout -b rename &&
589 git mv submodule submodule_renamed &&
591 cd submodule_renamed &&
592 git checkout -b rename_sub &&
596 git push origin rename_sub &&
597 git rev-parse HEAD >../../expect
599 git add submodule_renamed &&
600 git commit -m "update renamed submodule" &&
601 git push origin rename
605 git fetch --recurse-submodules=on-demand &&
608 git rev-parse origin/rename_sub >../../actual
611 test_cmp expect actual
614 test_expect_success
"fetch new submodule commits on-demand outside standard refspec" '
615 # add a second submodule and ensure it is around in downstream first
616 git clone submodule sub1 &&
617 git submodule add ./sub1 &&
618 git commit -m "adding a second submodule" &&
619 git -C downstream pull &&
620 git -C downstream submodule update --init --recursive &&
622 git checkout --detach &&
624 C=$(git -C submodule commit-tree -m "new change outside refs/heads" HEAD^{tree}) &&
625 git -C submodule update-ref refs/changes/1 $C &&
626 git update-index --cacheinfo 160000 $C submodule &&
629 D=$(git -C sub1 commit-tree -m "new change outside refs/heads" HEAD^{tree}) &&
630 git -C sub1 update-ref refs/changes/2 $D &&
631 git update-index --cacheinfo 160000 $D sub1 &&
633 git commit -m "updated submodules outside of refs/heads" &&
634 E=$(git rev-parse HEAD) &&
635 git update-ref refs/changes/3 $E &&
638 git fetch --recurse-submodules origin refs/changes/3:refs/heads/my_branch &&
639 git -C submodule cat-file -t $C &&
640 git -C sub1 cat-file -t $D &&
641 git checkout --recurse-submodules FETCH_HEAD
645 test_expect_success
'fetch new submodule commit on-demand in FETCH_HEAD' '
646 # depends on the previous test for setup
648 C=$(git -C submodule commit-tree -m "another change outside refs/heads" HEAD^{tree}) &&
649 git -C submodule update-ref refs/changes/4 $C &&
650 git update-index --cacheinfo 160000 $C submodule &&
653 D=$(git -C sub1 commit-tree -m "another change outside refs/heads" HEAD^{tree}) &&
654 git -C sub1 update-ref refs/changes/5 $D &&
655 git update-index --cacheinfo 160000 $D sub1 &&
657 git commit -m "updated submodules outside of refs/heads" &&
658 E=$(git rev-parse HEAD) &&
659 git update-ref refs/changes/6 $E &&
662 git fetch --recurse-submodules origin refs/changes/6 &&
663 git -C submodule cat-file -t $C &&
664 git -C sub1 cat-file -t $D &&
665 git checkout --recurse-submodules FETCH_HEAD
669 test_expect_success
'fetch new submodule commits on-demand without .gitmodules entry' '
670 # depends on the previous test for setup
672 git config -f .gitmodules --remove-section submodule.sub1 &&
673 git add .gitmodules &&
674 git commit -m "delete gitmodules file" &&
675 git checkout -B super &&
676 git -C downstream fetch &&
677 git -C downstream checkout origin/super &&
679 C=$(git -C submodule commit-tree -m "yet another change outside refs/heads" HEAD^{tree}) &&
680 git -C submodule update-ref refs/changes/7 $C &&
681 git update-index --cacheinfo 160000 $C submodule &&
684 D=$(git -C sub1 commit-tree -m "yet another change outside refs/heads" HEAD^{tree}) &&
685 git -C sub1 update-ref refs/changes/8 $D &&
686 git update-index --cacheinfo 160000 $D sub1 &&
688 git commit -m "updated submodules outside of refs/heads" &&
689 E=$(git rev-parse HEAD) &&
690 git update-ref refs/changes/9 $E &&
693 git fetch --recurse-submodules origin refs/changes/9 &&
694 git -C submodule cat-file -t $C &&
695 git -C sub1 cat-file -t $D &&
696 git checkout --recurse-submodules FETCH_HEAD
700 test_expect_success
'fetch new submodule commit intermittently referenced by superproject' '
701 # depends on the previous test for setup
703 D=$(git -C sub1 commit-tree -m "change 10 outside refs/heads" HEAD^{tree}) &&
704 E=$(git -C sub1 commit-tree -m "change 11 outside refs/heads" HEAD^{tree}) &&
705 F=$(git -C sub1 commit-tree -m "change 12 outside refs/heads" HEAD^{tree}) &&
707 git -C sub1 update-ref refs/changes/10 $D &&
708 git update-index --cacheinfo 160000 $D sub1 &&
709 git commit -m "updated submodules outside of refs/heads" &&
711 git -C sub1 update-ref refs/changes/11 $E &&
712 git update-index --cacheinfo 160000 $E sub1 &&
713 git commit -m "updated submodules outside of refs/heads" &&
715 git -C sub1 update-ref refs/changes/12 $F &&
716 git update-index --cacheinfo 160000 $F sub1 &&
717 git commit -m "updated submodules outside of refs/heads" &&
719 G=$(git rev-parse HEAD) &&
720 git update-ref refs/changes/13 $G &&
723 git fetch --recurse-submodules origin refs/changes/13 &&
725 git -C sub1 cat-file -t $D &&
726 git -C sub1 cat-file -t $E &&
727 git -C sub1 cat-file -t $F
735 git
-C "$dir" add
"$@" &&
736 git
-C "$dir" commit
-a -m "$msg" &&
740 compare_refs_in_dir
() {
747 git
-C "$1" rev-parse
--verify "$2" >expect
&&
748 git
-C "$3" rev-parse
--verify "$4" >actual
&&
749 eval $fail test_cmp expect actual
753 test_expect_success
'setup nested submodule fetch test' '
754 # does not depend on any previous test setups
756 for repo in outer middle inner
758 git init --bare $repo &&
759 git clone $repo ${repo}_content &&
760 echo "$repo" >"${repo}_content/file" &&
761 add_commit_push ${repo}_content "initial" file ||
766 git -C A submodule add "$pwd/middle" &&
767 git -C A/middle/ submodule add "$pwd/inner" &&
768 add_commit_push A/middle/ "adding inner sub" .gitmodules inner &&
769 add_commit_push A/ "adding middle sub" .gitmodules middle &&
772 git -C B/ submodule update --init middle &&
774 compare_refs_in_dir A HEAD B HEAD &&
775 compare_refs_in_dir A/middle HEAD B/middle HEAD &&
776 test_path_is_file B/file &&
777 test_path_is_file B/middle/file &&
778 test_path_is_missing B/middle/inner/file &&
780 echo "change on inner repo of A" >"A/middle/inner/file" &&
781 add_commit_push A/middle/inner "change on inner" file &&
782 add_commit_push A/middle "change on inner" inner &&
783 add_commit_push A "change on inner" middle
786 test_expect_success
'fetching a superproject containing an uninitialized sub/sub project' '
787 # depends on previous test for setup
790 compare_refs_in_dir A origin/HEAD B origin/HEAD
793 fetch_with_recursion_abort
() {
794 # In a regression the following git call will run into infinite recursion.
795 # To handle that, we connect the sed command to the git call by a pipe
796 # so that sed can kill the infinite recursion when detected.
797 # The recursion creates git output like:
798 # Fetching submodule sub
799 # Fetching submodule sub/sub <-- [1]
800 # Fetching submodule sub/sub/sub
802 # [1] sed will stop reading and cause git to eventually stop and die
804 git
-C "$1" fetch
--recurse-submodules 2>&1 |
805 sed "/Fetching submodule $2[^$]/q" >out
&&
806 ! grep "Fetching submodule $2[^$]" out
809 test_expect_success
'setup recursive fetch with uninit submodule' '
810 # does not depend on any previous test setups
812 test_create_repo super &&
813 test_commit -C super initial &&
814 test_create_repo sub &&
815 test_commit -C sub initial &&
816 git -C sub rev-parse HEAD >expect &&
818 git -C super submodule add ../sub &&
819 git -C super commit -m "add sub" &&
821 git clone super superclone &&
822 git -C superclone submodule status >out &&
823 sed -e "s/^-//" -e "s/ sub.*$//" out >actual &&
824 test_cmp expect actual
827 test_expect_success
'recursive fetch with uninit submodule' '
828 # depends on previous test for setup
830 fetch_with_recursion_abort superclone sub &&
831 git -C superclone submodule status >out &&
832 sed -e "s/^-//" -e "s/ sub$//" out >actual &&
833 test_cmp expect actual
836 test_expect_success
'recursive fetch after deinit a submodule' '
837 # depends on previous test for setup
839 git -C superclone submodule update --init sub &&
840 git -C superclone submodule deinit -f sub &&
842 fetch_with_recursion_abort superclone sub &&
843 git -C superclone submodule status >out &&
844 sed -e "s/^-//" -e "s/ sub$//" out >actual &&
845 test_cmp expect actual