2 # Copyright (c) 2010, Jens Lehmann
4 test_description
='Recursive "git fetch" for submodules'
10 add_upstream_commit
() {
13 head1
=$
(git rev-parse
--short HEAD
) &&
14 echo new
>> subfile
&&
17 git commit
-m new subfile
&&
18 head2
=$
(git rev-parse
--short HEAD
) &&
19 echo "Fetching submodule submodule" > ..
/expect.err
&&
20 echo "From $pwd/submodule" >> ..
/expect.err
&&
21 echo " $head1..$head2 sub -> origin/sub" >> ..
/expect.err
25 head1
=$
(git rev-parse
--short HEAD
) &&
26 echo new
>> deepsubfile
&&
28 git add deepsubfile
&&
29 git commit
-m new deepsubfile
&&
30 head2
=$
(git rev-parse
--short HEAD
) &&
31 echo "Fetching submodule submodule/subdir/deepsubmodule" >> ..
/expect.err
32 echo "From $pwd/deepsubmodule" >> ..
/expect.err
&&
33 echo " $head1..$head2 deep -> origin/deep" >> ..
/expect.err
37 test_expect_success setup
'
38 git config --global protocol.file.allow always &&
39 mkdir deepsubmodule &&
43 echo deepsubcontent > deepsubfile &&
44 git add deepsubfile &&
45 git commit -m new deepsubfile &&
52 echo subcontent > subfile &&
54 git submodule add "$pwd/deepsubmodule" subdir/deepsubmodule &&
55 git commit -a -m new &&
58 git submodule add "$pwd/submodule" submodule &&
59 git commit -am initial &&
60 git branch -M super &&
61 git clone . downstream &&
64 git submodule update --init --recursive
68 test_expect_success
"fetch --recurse-submodules recurses into submodules" '
69 add_upstream_commit &&
72 git fetch --recurse-submodules >../actual.out 2>../actual.err
74 test_must_be_empty actual.out &&
75 test_i18ncmp expect.err actual.err
78 test_expect_success
"submodule.recurse option triggers recursive fetch" '
79 add_upstream_commit &&
82 git -c submodule.recurse fetch >../actual.out 2>../actual.err
84 test_must_be_empty actual.out &&
85 test_i18ncmp expect.err actual.err
88 test_expect_success
"fetch --recurse-submodules -j2 has the same output behaviour" '
89 add_upstream_commit &&
92 GIT_TRACE="$TRASH_DIRECTORY/trace.out" git fetch --recurse-submodules -j2 2>../actual.err
94 test_must_be_empty actual.out &&
95 test_i18ncmp expect.err actual.err &&
96 grep "2 tasks" trace.out
99 test_expect_success
"fetch alone only fetches superproject" '
100 add_upstream_commit &&
103 git fetch >../actual.out 2>../actual.err
105 test_must_be_empty actual.out &&
106 test_must_be_empty actual.err
109 test_expect_success
"fetch --no-recurse-submodules only fetches superproject" '
112 git fetch --no-recurse-submodules >../actual.out 2>../actual.err
114 test_must_be_empty actual.out &&
115 test_must_be_empty actual.err
118 test_expect_success
"using fetchRecurseSubmodules=true in .gitmodules recurses into submodules" '
121 git config -f .gitmodules submodule.submodule.fetchRecurseSubmodules true &&
122 git fetch >../actual.out 2>../actual.err
124 test_must_be_empty actual.out &&
125 test_i18ncmp expect.err actual.err
128 test_expect_success
"--no-recurse-submodules overrides .gitmodules config" '
129 add_upstream_commit &&
132 git fetch --no-recurse-submodules >../actual.out 2>../actual.err
134 test_must_be_empty actual.out &&
135 test_must_be_empty actual.err
138 test_expect_success
"using fetchRecurseSubmodules=false in .git/config overrides setting in .gitmodules" '
141 git config submodule.submodule.fetchRecurseSubmodules false &&
142 git fetch >../actual.out 2>../actual.err
144 test_must_be_empty actual.out &&
145 test_must_be_empty actual.err
148 test_expect_success
"--recurse-submodules overrides fetchRecurseSubmodules setting from .git/config" '
151 git fetch --recurse-submodules >../actual.out 2>../actual.err &&
152 git config --unset -f .gitmodules submodule.submodule.fetchRecurseSubmodules &&
153 git config --unset submodule.submodule.fetchRecurseSubmodules
155 test_must_be_empty actual.out &&
156 test_i18ncmp expect.err actual.err
159 test_expect_success
"--quiet propagates to submodules" '
162 git fetch --recurse-submodules --quiet >../actual.out 2>../actual.err
164 test_must_be_empty actual.out &&
165 test_must_be_empty actual.err
168 test_expect_success
"--quiet propagates to parallel submodules" '
171 git fetch --recurse-submodules -j 2 --quiet >../actual.out 2>../actual.err
173 test_must_be_empty actual.out &&
174 test_must_be_empty actual.err
177 test_expect_success
"--dry-run propagates to submodules" '
178 add_upstream_commit &&
181 git fetch --recurse-submodules --dry-run >../actual.out 2>../actual.err
183 test_must_be_empty actual.out &&
184 test_i18ncmp expect.err actual.err
187 test_expect_success
"Without --dry-run propagates to submodules" '
190 git fetch --recurse-submodules >../actual.out 2>../actual.err
192 test_must_be_empty actual.out &&
193 test_i18ncmp expect.err actual.err
196 test_expect_success
"recurseSubmodules=true propagates into submodules" '
197 add_upstream_commit &&
200 git config fetch.recurseSubmodules true &&
201 git fetch >../actual.out 2>../actual.err
203 test_must_be_empty actual.out &&
204 test_i18ncmp expect.err actual.err
207 test_expect_success
"--recurse-submodules overrides config in submodule" '
208 add_upstream_commit &&
213 git config fetch.recurseSubmodules false
215 git fetch --recurse-submodules >../actual.out 2>../actual.err
217 test_must_be_empty actual.out &&
218 test_i18ncmp expect.err actual.err
221 test_expect_success
"--no-recurse-submodules overrides config setting" '
222 add_upstream_commit &&
225 git config fetch.recurseSubmodules true &&
226 git fetch --no-recurse-submodules >../actual.out 2>../actual.err
228 test_must_be_empty actual.out &&
229 test_must_be_empty actual.err
232 test_expect_success
"Recursion doesn't happen when no new commits are fetched in the superproject" '
237 git config --unset fetch.recurseSubmodules
239 git config --unset fetch.recurseSubmodules &&
240 git fetch >../actual.out 2>../actual.err
242 test_must_be_empty actual.out &&
243 test_must_be_empty actual.err
246 test_expect_success
"Recursion stops when no new submodule commits are fetched" '
247 head1=$(git rev-parse --short HEAD) &&
249 git commit -m "new submodule" &&
250 head2=$(git rev-parse --short HEAD) &&
251 echo "From $pwd/." > expect.err.sub &&
252 echo " $head1..$head2 super -> origin/super" >>expect.err.sub &&
253 head -3 expect.err >> expect.err.sub &&
256 git fetch >../actual.out 2>../actual.err
258 test_i18ncmp expect.err.sub actual.err &&
259 test_must_be_empty actual.out
262 test_expect_success
"Recursion doesn't happen when new superproject commits don't change any submodules" '
263 add_upstream_commit &&
264 head1=$(git rev-parse --short HEAD) &&
267 git commit -m "new file" &&
268 head2=$(git rev-parse --short HEAD) &&
269 echo "From $pwd/." > expect.err.file &&
270 echo " $head1..$head2 super -> origin/super" >> expect.err.file &&
273 git fetch >../actual.out 2>../actual.err
275 test_must_be_empty actual.out &&
276 test_i18ncmp expect.err.file actual.err
279 test_expect_success
"Recursion picks up config in submodule" '
282 git fetch --recurse-submodules &&
285 git config fetch.recurseSubmodules true
288 add_upstream_commit &&
289 head1=$(git rev-parse --short HEAD) &&
291 git commit -m "new submodule" &&
292 head2=$(git rev-parse --short HEAD) &&
293 echo "From $pwd/." > expect.err.sub &&
294 echo " $head1..$head2 super -> origin/super" >> expect.err.sub &&
295 cat expect.err >> expect.err.sub &&
298 git fetch >../actual.out 2>../actual.err &&
301 git config --unset fetch.recurseSubmodules
304 test_i18ncmp expect.err.sub actual.err &&
305 test_must_be_empty actual.out
308 test_expect_success
"Recursion picks up all submodules when necessary" '
309 add_upstream_commit &&
313 cd subdir/deepsubmodule &&
315 git checkout -q FETCH_HEAD
317 head1=$(git rev-parse --short HEAD^) &&
318 git add subdir/deepsubmodule &&
319 git commit -m "new deepsubmodule" &&
320 head2=$(git rev-parse --short HEAD) &&
321 echo "Fetching submodule submodule" > ../expect.err.sub &&
322 echo "From $pwd/submodule" >> ../expect.err.sub &&
323 echo " $head1..$head2 sub -> origin/sub" >> ../expect.err.sub
325 head1=$(git rev-parse --short HEAD) &&
327 git commit -m "new submodule" &&
328 head2=$(git rev-parse --short HEAD) &&
329 echo "From $pwd/." > expect.err.2 &&
330 echo " $head1..$head2 super -> origin/super" >> expect.err.2 &&
331 cat expect.err.sub >> expect.err.2 &&
332 tail -3 expect.err >> expect.err.2 &&
335 git fetch >../actual.out 2>../actual.err
337 test_i18ncmp expect.err.2 actual.err &&
338 test_must_be_empty actual.out
341 test_expect_success
"'--recurse-submodules=on-demand' doesn't recurse when no new commits are fetched in the superproject (and ignores config)" '
342 add_upstream_commit &&
346 cd subdir/deepsubmodule &&
348 git checkout -q FETCH_HEAD
350 head1=$(git rev-parse --short HEAD^) &&
351 git add subdir/deepsubmodule &&
352 git commit -m "new deepsubmodule" &&
353 head2=$(git rev-parse --short HEAD) &&
354 echo Fetching submodule submodule > ../expect.err.sub &&
355 echo "From $pwd/submodule" >> ../expect.err.sub &&
356 echo " $head1..$head2 sub -> origin/sub" >> ../expect.err.sub
360 git config fetch.recurseSubmodules true &&
361 git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err &&
362 git config --unset fetch.recurseSubmodules
364 test_must_be_empty actual.out &&
365 test_must_be_empty actual.err
368 test_expect_success
"'--recurse-submodules=on-demand' recurses as deep as necessary (and ignores config)" '
369 head1=$(git rev-parse --short HEAD) &&
371 git commit -m "new submodule" &&
372 head2=$(git rev-parse --short HEAD) &&
373 tail -3 expect.err > expect.err.deepsub &&
374 echo "From $pwd/." > expect.err &&
375 echo " $head1..$head2 super -> origin/super" >>expect.err &&
376 cat expect.err.sub >> expect.err &&
377 cat expect.err.deepsub >> expect.err &&
380 git config fetch.recurseSubmodules false &&
383 git config -f .gitmodules submodule.subdir/deepsubmodule.fetchRecursive false
385 git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err &&
386 git config --unset fetch.recurseSubmodules &&
389 git config --unset -f .gitmodules submodule.subdir/deepsubmodule.fetchRecursive
392 test_must_be_empty actual.out &&
393 test_i18ncmp expect.err actual.err
396 test_expect_success
"'--recurse-submodules=on-demand' stops when no new submodule commits are found in the superproject (and ignores config)" '
397 add_upstream_commit &&
398 head1=$(git rev-parse --short HEAD) &&
401 git commit -m "new file" &&
402 head2=$(git rev-parse --short HEAD) &&
403 echo "From $pwd/." > expect.err.file &&
404 echo " $head1..$head2 super -> origin/super" >> expect.err.file &&
407 git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err
409 test_must_be_empty actual.out &&
410 test_i18ncmp expect.err.file actual.err
413 test_expect_success
"'fetch.recurseSubmodules=on-demand' overrides global config" '
416 git fetch --recurse-submodules
418 add_upstream_commit &&
419 git config --global fetch.recurseSubmodules false &&
420 head1=$(git rev-parse --short HEAD) &&
422 git commit -m "new submodule" &&
423 head2=$(git rev-parse --short HEAD) &&
424 echo "From $pwd/." > expect.err.2 &&
425 echo " $head1..$head2 super -> origin/super" >>expect.err.2 &&
426 head -3 expect.err >> expect.err.2 &&
429 git config fetch.recurseSubmodules on-demand &&
430 git fetch >../actual.out 2>../actual.err
432 git config --global --unset fetch.recurseSubmodules &&
435 git config --unset fetch.recurseSubmodules
437 test_must_be_empty actual.out &&
438 test_i18ncmp expect.err.2 actual.err
441 test_expect_success
"'submodule.<sub>.fetchRecurseSubmodules=on-demand' overrides fetch.recurseSubmodules" '
444 git fetch --recurse-submodules
446 add_upstream_commit &&
447 git config fetch.recurseSubmodules false &&
448 head1=$(git rev-parse --short HEAD) &&
450 git commit -m "new submodule" &&
451 head2=$(git rev-parse --short HEAD) &&
452 echo "From $pwd/." > expect.err.2 &&
453 echo " $head1..$head2 super -> origin/super" >>expect.err.2 &&
454 head -3 expect.err >> expect.err.2 &&
457 git config submodule.submodule.fetchRecurseSubmodules on-demand &&
458 git fetch >../actual.out 2>../actual.err
460 git config --unset fetch.recurseSubmodules &&
463 git config --unset submodule.submodule.fetchRecurseSubmodules
465 test_must_be_empty actual.out &&
466 test_i18ncmp expect.err.2 actual.err
469 test_expect_success
"don't fetch submodule when newly recorded commits are already present" '
472 git checkout -q HEAD^^
474 head1=$(git rev-parse --short HEAD) &&
476 git commit -m "submodule rewound" &&
477 head2=$(git rev-parse --short HEAD) &&
478 echo "From $pwd/." > expect.err &&
479 echo " $head1..$head2 super -> origin/super" >> expect.err &&
482 git fetch >../actual.out 2>../actual.err
484 test_must_be_empty actual.out &&
485 test_i18ncmp expect.err actual.err &&
492 test_expect_success
"'fetch.recurseSubmodules=on-demand' works also without .gitmodules entry" '
495 git fetch --recurse-submodules
497 add_upstream_commit &&
498 head1=$(git rev-parse --short HEAD) &&
500 git rm .gitmodules &&
501 git commit -m "new submodule without .gitmodules" &&
502 head2=$(git rev-parse --short HEAD) &&
503 echo "From $pwd/." >expect.err.2 &&
504 echo " $head1..$head2 super -> origin/super" >>expect.err.2 &&
505 head -3 expect.err >>expect.err.2 &&
509 git config fetch.recurseSubmodules on-demand &&
510 # fake submodule configuration to avoid skipping submodule handling
511 git config -f .gitmodules submodule.fake.path fake &&
512 git config -f .gitmodules submodule.fake.url fakeurl &&
513 git add .gitmodules &&
514 git config --unset submodule.submodule.url &&
515 git fetch >../actual.out 2>../actual.err &&
517 git config --unset fetch.recurseSubmodules &&
520 test_must_be_empty actual.out &&
521 test_i18ncmp expect.err.2 actual.err &&
522 git checkout HEAD^ -- .gitmodules &&
523 git add .gitmodules &&
524 git commit -m "new submodule restored .gitmodules"
527 test_expect_success
'fetching submodules respects parallel settings' '
528 git config fetch.recurseSubmodules true &&
531 GIT_TRACE=$(pwd)/trace.out git fetch &&
532 grep "1 tasks" trace.out &&
533 GIT_TRACE=$(pwd)/trace.out git fetch --jobs 7 &&
534 grep "7 tasks" trace.out &&
535 git config submodule.fetchJobs 8 &&
536 GIT_TRACE=$(pwd)/trace.out git fetch &&
537 grep "8 tasks" trace.out &&
538 GIT_TRACE=$(pwd)/trace.out git fetch --jobs 9 &&
539 grep "9 tasks" trace.out
543 test_expect_success
'fetching submodule into a broken repository' '
544 # Prepare src and src/sub nested in it
549 git -C sub commit --allow-empty -m "initial in sub" &&
550 git submodule add -- ./sub sub &&
551 git commit -m "initial in top"
554 # Clone the old-fashoned way
556 git -C dst clone ../src/sub sub &&
558 # Make sure that old-fashoned layout is still supported
561 # "diff" would find no change
562 git -C dst diff --exit-code &&
564 # Recursive-fetch works fine
565 git -C dst fetch --recurse-submodules &&
567 # Break the receiving submodule
568 rm -f dst/sub/.git/HEAD &&
570 # NOTE: without the fix the following tests will recurse forever!
571 # They should terminate with an error.
573 test_must_fail git -C dst status &&
574 test_must_fail git -C dst diff &&
575 test_must_fail git -C dst fetch --recurse-submodules
578 test_expect_success
"fetch new commits when submodule got renamed" '
579 git clone . downstream_rename &&
581 cd downstream_rename &&
582 git submodule update --init --recursive &&
583 git checkout -b rename &&
584 git mv submodule submodule_renamed &&
586 cd submodule_renamed &&
587 git checkout -b rename_sub &&
591 git push origin rename_sub &&
592 git rev-parse HEAD >../../expect
594 git add submodule_renamed &&
595 git commit -m "update renamed submodule" &&
596 git push origin rename
600 git fetch --recurse-submodules=on-demand &&
603 git rev-parse origin/rename_sub >../../actual
606 test_cmp expect actual
609 test_expect_success
"fetch new submodule commits on-demand outside standard refspec" '
610 # add a second submodule and ensure it is around in downstream first
611 git clone submodule sub1 &&
612 git submodule add ./sub1 &&
613 git commit -m "adding a second submodule" &&
614 git -C downstream pull &&
615 git -C downstream submodule update --init --recursive &&
617 git checkout --detach &&
619 C=$(git -C submodule commit-tree -m "new change outside refs/heads" HEAD^{tree}) &&
620 git -C submodule update-ref refs/changes/1 $C &&
621 git update-index --cacheinfo 160000 $C submodule &&
624 D=$(git -C sub1 commit-tree -m "new change outside refs/heads" HEAD^{tree}) &&
625 git -C sub1 update-ref refs/changes/2 $D &&
626 git update-index --cacheinfo 160000 $D sub1 &&
628 git commit -m "updated submodules outside of refs/heads" &&
629 E=$(git rev-parse HEAD) &&
630 git update-ref refs/changes/3 $E &&
633 git fetch --recurse-submodules origin refs/changes/3:refs/heads/my_branch &&
634 git -C submodule cat-file -t $C &&
635 git -C sub1 cat-file -t $D &&
636 git checkout --recurse-submodules FETCH_HEAD
640 test_expect_success
'fetch new submodule commit on-demand in FETCH_HEAD' '
641 # depends on the previous test for setup
643 C=$(git -C submodule commit-tree -m "another change outside refs/heads" HEAD^{tree}) &&
644 git -C submodule update-ref refs/changes/4 $C &&
645 git update-index --cacheinfo 160000 $C submodule &&
648 D=$(git -C sub1 commit-tree -m "another change outside refs/heads" HEAD^{tree}) &&
649 git -C sub1 update-ref refs/changes/5 $D &&
650 git update-index --cacheinfo 160000 $D sub1 &&
652 git commit -m "updated submodules outside of refs/heads" &&
653 E=$(git rev-parse HEAD) &&
654 git update-ref refs/changes/6 $E &&
657 git fetch --recurse-submodules origin refs/changes/6 &&
658 git -C submodule cat-file -t $C &&
659 git -C sub1 cat-file -t $D &&
660 git checkout --recurse-submodules FETCH_HEAD
664 test_expect_success
'fetch new submodule commits on-demand without .gitmodules entry' '
665 # depends on the previous test for setup
667 git config -f .gitmodules --remove-section submodule.sub1 &&
668 git add .gitmodules &&
669 git commit -m "delete gitmodules file" &&
670 git checkout -B super &&
671 git -C downstream fetch &&
672 git -C downstream checkout origin/super &&
674 C=$(git -C submodule commit-tree -m "yet another change outside refs/heads" HEAD^{tree}) &&
675 git -C submodule update-ref refs/changes/7 $C &&
676 git update-index --cacheinfo 160000 $C submodule &&
679 D=$(git -C sub1 commit-tree -m "yet another change outside refs/heads" HEAD^{tree}) &&
680 git -C sub1 update-ref refs/changes/8 $D &&
681 git update-index --cacheinfo 160000 $D sub1 &&
683 git commit -m "updated submodules outside of refs/heads" &&
684 E=$(git rev-parse HEAD) &&
685 git update-ref refs/changes/9 $E &&
688 git fetch --recurse-submodules origin refs/changes/9 &&
689 git -C submodule cat-file -t $C &&
690 git -C sub1 cat-file -t $D &&
691 git checkout --recurse-submodules FETCH_HEAD
695 test_expect_success
'fetch new submodule commit intermittently referenced by superproject' '
696 # depends on the previous test for setup
698 D=$(git -C sub1 commit-tree -m "change 10 outside refs/heads" HEAD^{tree}) &&
699 E=$(git -C sub1 commit-tree -m "change 11 outside refs/heads" HEAD^{tree}) &&
700 F=$(git -C sub1 commit-tree -m "change 12 outside refs/heads" HEAD^{tree}) &&
702 git -C sub1 update-ref refs/changes/10 $D &&
703 git update-index --cacheinfo 160000 $D sub1 &&
704 git commit -m "updated submodules outside of refs/heads" &&
706 git -C sub1 update-ref refs/changes/11 $E &&
707 git update-index --cacheinfo 160000 $E sub1 &&
708 git commit -m "updated submodules outside of refs/heads" &&
710 git -C sub1 update-ref refs/changes/12 $F &&
711 git update-index --cacheinfo 160000 $F sub1 &&
712 git commit -m "updated submodules outside of refs/heads" &&
714 G=$(git rev-parse HEAD) &&
715 git update-ref refs/changes/13 $G &&
718 git fetch --recurse-submodules origin refs/changes/13 &&
720 git -C sub1 cat-file -t $D &&
721 git -C sub1 cat-file -t $E &&
722 git -C sub1 cat-file -t $F
730 git
-C "$dir" add
"$@" &&
731 git
-C "$dir" commit
-a -m "$msg" &&
735 compare_refs_in_dir
() {
742 git
-C "$1" rev-parse
--verify "$2" >expect
&&
743 git
-C "$3" rev-parse
--verify "$4" >actual
&&
744 eval $fail test_cmp expect actual
748 test_expect_success
'setup nested submodule fetch test' '
749 # does not depend on any previous test setups
751 for repo in outer middle inner
753 git init --bare $repo &&
754 git clone $repo ${repo}_content &&
755 echo "$repo" >"${repo}_content/file" &&
756 add_commit_push ${repo}_content "initial" file ||
761 git -C A submodule add "$pwd/middle" &&
762 git -C A/middle/ submodule add "$pwd/inner" &&
763 add_commit_push A/middle/ "adding inner sub" .gitmodules inner &&
764 add_commit_push A/ "adding middle sub" .gitmodules middle &&
767 git -C B/ submodule update --init middle &&
769 compare_refs_in_dir A HEAD B HEAD &&
770 compare_refs_in_dir A/middle HEAD B/middle HEAD &&
771 test_path_is_file B/file &&
772 test_path_is_file B/middle/file &&
773 test_path_is_missing B/middle/inner/file &&
775 echo "change on inner repo of A" >"A/middle/inner/file" &&
776 add_commit_push A/middle/inner "change on inner" file &&
777 add_commit_push A/middle "change on inner" inner &&
778 add_commit_push A "change on inner" middle
781 test_expect_success
'fetching a superproject containing an uninitialized sub/sub project' '
782 # depends on previous test for setup
785 compare_refs_in_dir A origin/HEAD B origin/HEAD
788 fetch_with_recursion_abort
() {
789 # In a regression the following git call will run into infinite recursion.
790 # To handle that, we connect the sed command to the git call by a pipe
791 # so that sed can kill the infinite recursion when detected.
792 # The recursion creates git output like:
793 # Fetching submodule sub
794 # Fetching submodule sub/sub <-- [1]
795 # Fetching submodule sub/sub/sub
797 # [1] sed will stop reading and cause git to eventually stop and die
799 git
-C "$1" fetch
--recurse-submodules 2>&1 |
800 sed "/Fetching submodule $2[^$]/q" >out
&&
801 ! grep "Fetching submodule $2[^$]" out
804 test_expect_success
'setup recursive fetch with uninit submodule' '
805 # does not depend on any previous test setups
807 test_create_repo super &&
808 test_commit -C super initial &&
809 test_create_repo sub &&
810 test_commit -C sub initial &&
811 git -C sub rev-parse HEAD >expect &&
813 git -C super submodule add ../sub &&
814 git -C super commit -m "add sub" &&
816 git clone super superclone &&
817 git -C superclone submodule status >out &&
818 sed -e "s/^-//" -e "s/ sub.*$//" out >actual &&
819 test_cmp expect actual
822 test_expect_success
'recursive fetch with uninit submodule' '
823 # depends on previous test for setup
825 fetch_with_recursion_abort superclone sub &&
826 git -C superclone submodule status >out &&
827 sed -e "s/^-//" -e "s/ sub$//" out >actual &&
828 test_cmp expect actual
831 test_expect_success
'recursive fetch after deinit a submodule' '
832 # depends on previous test for setup
834 git -C superclone submodule update --init sub &&
835 git -C superclone submodule deinit -f sub &&
837 fetch_with_recursion_abort superclone sub &&
838 git -C superclone submodule status >out &&
839 sed -e "s/^-//" -e "s/ sub$//" out >actual &&
840 test_cmp expect actual