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 mkdir deepsubmodule &&
42 echo deepsubcontent > deepsubfile &&
43 git add deepsubfile &&
44 git commit -m new deepsubfile &&
51 echo subcontent > subfile &&
53 git submodule add "$pwd/deepsubmodule" subdir/deepsubmodule &&
54 git commit -a -m new &&
57 git submodule add "$pwd/submodule" submodule &&
58 git commit -am initial &&
59 git branch -M super &&
60 git clone . downstream &&
63 git submodule update --init --recursive
67 test_expect_success
"fetch --recurse-submodules recurses into submodules" '
68 add_upstream_commit &&
71 git fetch --recurse-submodules >../actual.out 2>../actual.err
73 test_must_be_empty actual.out &&
74 test_i18ncmp expect.err actual.err
77 test_expect_success
"submodule.recurse option triggers recursive fetch" '
78 add_upstream_commit &&
81 git -c submodule.recurse fetch >../actual.out 2>../actual.err
83 test_must_be_empty actual.out &&
84 test_i18ncmp expect.err actual.err
87 test_expect_success
"fetch --recurse-submodules -j2 has the same output behaviour" '
88 add_upstream_commit &&
91 GIT_TRACE="$TRASH_DIRECTORY/trace.out" git fetch --recurse-submodules -j2 2>../actual.err
93 test_must_be_empty actual.out &&
94 test_i18ncmp expect.err actual.err &&
95 grep "2 tasks" trace.out
98 test_expect_success
"fetch alone only fetches superproject" '
99 add_upstream_commit &&
102 git fetch >../actual.out 2>../actual.err
104 test_must_be_empty actual.out &&
105 test_must_be_empty actual.err
108 test_expect_success
"fetch --no-recurse-submodules only fetches superproject" '
111 git fetch --no-recurse-submodules >../actual.out 2>../actual.err
113 test_must_be_empty actual.out &&
114 test_must_be_empty actual.err
117 test_expect_success
"using fetchRecurseSubmodules=true in .gitmodules recurses into submodules" '
120 git config -f .gitmodules submodule.submodule.fetchRecurseSubmodules true &&
121 git fetch >../actual.out 2>../actual.err
123 test_must_be_empty actual.out &&
124 test_i18ncmp expect.err actual.err
127 test_expect_success
"--no-recurse-submodules overrides .gitmodules config" '
128 add_upstream_commit &&
131 git fetch --no-recurse-submodules >../actual.out 2>../actual.err
133 test_must_be_empty actual.out &&
134 test_must_be_empty actual.err
137 test_expect_success
"using fetchRecurseSubmodules=false in .git/config overrides setting in .gitmodules" '
140 git config submodule.submodule.fetchRecurseSubmodules false &&
141 git fetch >../actual.out 2>../actual.err
143 test_must_be_empty actual.out &&
144 test_must_be_empty actual.err
147 test_expect_success
"--recurse-submodules overrides fetchRecurseSubmodules setting from .git/config" '
150 git fetch --recurse-submodules >../actual.out 2>../actual.err &&
151 git config --unset -f .gitmodules submodule.submodule.fetchRecurseSubmodules &&
152 git config --unset submodule.submodule.fetchRecurseSubmodules
154 test_must_be_empty actual.out &&
155 test_i18ncmp expect.err actual.err
158 test_expect_success
"--quiet propagates to submodules" '
161 git fetch --recurse-submodules --quiet >../actual.out 2>../actual.err
163 test_must_be_empty actual.out &&
164 test_must_be_empty actual.err
167 test_expect_success
"--quiet propagates to parallel submodules" '
170 git fetch --recurse-submodules -j 2 --quiet >../actual.out 2>../actual.err
172 test_must_be_empty actual.out &&
173 test_must_be_empty actual.err
176 test_expect_success
"--dry-run propagates to submodules" '
177 add_upstream_commit &&
180 git fetch --recurse-submodules --dry-run >../actual.out 2>../actual.err
182 test_must_be_empty actual.out &&
183 test_i18ncmp expect.err actual.err
186 test_expect_success
"Without --dry-run propagates to submodules" '
189 git fetch --recurse-submodules >../actual.out 2>../actual.err
191 test_must_be_empty actual.out &&
192 test_i18ncmp expect.err actual.err
195 test_expect_success
"recurseSubmodules=true propagates into submodules" '
196 add_upstream_commit &&
199 git config fetch.recurseSubmodules true &&
200 git fetch >../actual.out 2>../actual.err
202 test_must_be_empty actual.out &&
203 test_i18ncmp expect.err actual.err
206 test_expect_success
"--recurse-submodules overrides config in submodule" '
207 add_upstream_commit &&
212 git config fetch.recurseSubmodules false
214 git fetch --recurse-submodules >../actual.out 2>../actual.err
216 test_must_be_empty actual.out &&
217 test_i18ncmp expect.err actual.err
220 test_expect_success
"--no-recurse-submodules overrides config setting" '
221 add_upstream_commit &&
224 git config fetch.recurseSubmodules true &&
225 git fetch --no-recurse-submodules >../actual.out 2>../actual.err
227 test_must_be_empty actual.out &&
228 test_must_be_empty actual.err
231 test_expect_success
"Recursion doesn't happen when no new commits are fetched in the superproject" '
236 git config --unset fetch.recurseSubmodules
238 git config --unset fetch.recurseSubmodules &&
239 git fetch >../actual.out 2>../actual.err
241 test_must_be_empty actual.out &&
242 test_must_be_empty actual.err
245 test_expect_success
"Recursion stops when no new submodule commits are fetched" '
246 head1=$(git rev-parse --short HEAD) &&
248 git commit -m "new submodule" &&
249 head2=$(git rev-parse --short HEAD) &&
250 echo "From $pwd/." > expect.err.sub &&
251 echo " $head1..$head2 super -> origin/super" >>expect.err.sub &&
252 head -3 expect.err >> expect.err.sub &&
255 git fetch >../actual.out 2>../actual.err
257 test_i18ncmp expect.err.sub actual.err &&
258 test_must_be_empty actual.out
261 test_expect_success
"Recursion doesn't happen when new superproject commits don't change any submodules" '
262 add_upstream_commit &&
263 head1=$(git rev-parse --short HEAD) &&
266 git commit -m "new file" &&
267 head2=$(git rev-parse --short HEAD) &&
268 echo "From $pwd/." > expect.err.file &&
269 echo " $head1..$head2 super -> origin/super" >> expect.err.file &&
272 git fetch >../actual.out 2>../actual.err
274 test_must_be_empty actual.out &&
275 test_i18ncmp expect.err.file actual.err
278 test_expect_success
"Recursion picks up config in submodule" '
281 git fetch --recurse-submodules &&
284 git config fetch.recurseSubmodules true
287 add_upstream_commit &&
288 head1=$(git rev-parse --short HEAD) &&
290 git commit -m "new submodule" &&
291 head2=$(git rev-parse --short HEAD) &&
292 echo "From $pwd/." > expect.err.sub &&
293 echo " $head1..$head2 super -> origin/super" >> expect.err.sub &&
294 cat expect.err >> expect.err.sub &&
297 git fetch >../actual.out 2>../actual.err &&
300 git config --unset fetch.recurseSubmodules
303 test_i18ncmp expect.err.sub actual.err &&
304 test_must_be_empty actual.out
307 test_expect_success
"Recursion picks up all submodules when necessary" '
308 add_upstream_commit &&
312 cd subdir/deepsubmodule &&
314 git checkout -q FETCH_HEAD
316 head1=$(git rev-parse --short HEAD^) &&
317 git add subdir/deepsubmodule &&
318 git commit -m "new deepsubmodule" &&
319 head2=$(git rev-parse --short HEAD) &&
320 echo "Fetching submodule submodule" > ../expect.err.sub &&
321 echo "From $pwd/submodule" >> ../expect.err.sub &&
322 echo " $head1..$head2 sub -> origin/sub" >> ../expect.err.sub
324 head1=$(git rev-parse --short HEAD) &&
326 git commit -m "new submodule" &&
327 head2=$(git rev-parse --short HEAD) &&
328 echo "From $pwd/." > expect.err.2 &&
329 echo " $head1..$head2 super -> origin/super" >> expect.err.2 &&
330 cat expect.err.sub >> expect.err.2 &&
331 tail -3 expect.err >> expect.err.2 &&
334 git fetch >../actual.out 2>../actual.err
336 test_i18ncmp expect.err.2 actual.err &&
337 test_must_be_empty actual.out
340 test_expect_success
"'--recurse-submodules=on-demand' doesn't recurse when no new commits are fetched in the superproject (and ignores config)" '
341 add_upstream_commit &&
345 cd subdir/deepsubmodule &&
347 git checkout -q FETCH_HEAD
349 head1=$(git rev-parse --short HEAD^) &&
350 git add subdir/deepsubmodule &&
351 git commit -m "new deepsubmodule" &&
352 head2=$(git rev-parse --short HEAD) &&
353 echo Fetching submodule submodule > ../expect.err.sub &&
354 echo "From $pwd/submodule" >> ../expect.err.sub &&
355 echo " $head1..$head2 sub -> origin/sub" >> ../expect.err.sub
359 git config fetch.recurseSubmodules true &&
360 git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err &&
361 git config --unset fetch.recurseSubmodules
363 test_must_be_empty actual.out &&
364 test_must_be_empty actual.err
367 test_expect_success
"'--recurse-submodules=on-demand' recurses as deep as necessary (and ignores config)" '
368 head1=$(git rev-parse --short HEAD) &&
370 git commit -m "new submodule" &&
371 head2=$(git rev-parse --short HEAD) &&
372 tail -3 expect.err > expect.err.deepsub &&
373 echo "From $pwd/." > expect.err &&
374 echo " $head1..$head2 super -> origin/super" >>expect.err &&
375 cat expect.err.sub >> expect.err &&
376 cat expect.err.deepsub >> expect.err &&
379 git config fetch.recurseSubmodules false &&
382 git config -f .gitmodules submodule.subdir/deepsubmodule.fetchRecursive false
384 git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err &&
385 git config --unset fetch.recurseSubmodules &&
388 git config --unset -f .gitmodules submodule.subdir/deepsubmodule.fetchRecursive
391 test_must_be_empty actual.out &&
392 test_i18ncmp expect.err actual.err
395 test_expect_success
"'--recurse-submodules=on-demand' stops when no new submodule commits are found in the superproject (and ignores config)" '
396 add_upstream_commit &&
397 head1=$(git rev-parse --short HEAD) &&
400 git commit -m "new file" &&
401 head2=$(git rev-parse --short HEAD) &&
402 echo "From $pwd/." > expect.err.file &&
403 echo " $head1..$head2 super -> origin/super" >> expect.err.file &&
406 git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err
408 test_must_be_empty actual.out &&
409 test_i18ncmp expect.err.file actual.err
412 test_expect_success
"'fetch.recurseSubmodules=on-demand' overrides global config" '
415 git fetch --recurse-submodules
417 add_upstream_commit &&
418 git config --global fetch.recurseSubmodules false &&
419 head1=$(git rev-parse --short HEAD) &&
421 git commit -m "new submodule" &&
422 head2=$(git rev-parse --short HEAD) &&
423 echo "From $pwd/." > expect.err.2 &&
424 echo " $head1..$head2 super -> origin/super" >>expect.err.2 &&
425 head -3 expect.err >> expect.err.2 &&
428 git config fetch.recurseSubmodules on-demand &&
429 git fetch >../actual.out 2>../actual.err
431 git config --global --unset fetch.recurseSubmodules &&
434 git config --unset fetch.recurseSubmodules
436 test_must_be_empty actual.out &&
437 test_i18ncmp expect.err.2 actual.err
440 test_expect_success
"'submodule.<sub>.fetchRecurseSubmodules=on-demand' overrides fetch.recurseSubmodules" '
443 git fetch --recurse-submodules
445 add_upstream_commit &&
446 git config fetch.recurseSubmodules false &&
447 head1=$(git rev-parse --short HEAD) &&
449 git commit -m "new submodule" &&
450 head2=$(git rev-parse --short HEAD) &&
451 echo "From $pwd/." > expect.err.2 &&
452 echo " $head1..$head2 super -> origin/super" >>expect.err.2 &&
453 head -3 expect.err >> expect.err.2 &&
456 git config submodule.submodule.fetchRecurseSubmodules on-demand &&
457 git fetch >../actual.out 2>../actual.err
459 git config --unset fetch.recurseSubmodules &&
462 git config --unset submodule.submodule.fetchRecurseSubmodules
464 test_must_be_empty actual.out &&
465 test_i18ncmp expect.err.2 actual.err
468 test_expect_success
"don't fetch submodule when newly recorded commits are already present" '
471 git checkout -q HEAD^^
473 head1=$(git rev-parse --short HEAD) &&
475 git commit -m "submodule rewound" &&
476 head2=$(git rev-parse --short HEAD) &&
477 echo "From $pwd/." > expect.err &&
478 echo " $head1..$head2 super -> origin/super" >> expect.err &&
481 git fetch >../actual.out 2>../actual.err
483 test_must_be_empty actual.out &&
484 test_i18ncmp expect.err actual.err &&
491 test_expect_success
"'fetch.recurseSubmodules=on-demand' works also without .gitmodules entry" '
494 git fetch --recurse-submodules
496 add_upstream_commit &&
497 head1=$(git rev-parse --short HEAD) &&
499 git rm .gitmodules &&
500 git commit -m "new submodule without .gitmodules" &&
501 head2=$(git rev-parse --short HEAD) &&
502 echo "From $pwd/." >expect.err.2 &&
503 echo " $head1..$head2 super -> origin/super" >>expect.err.2 &&
504 head -3 expect.err >>expect.err.2 &&
508 git config fetch.recurseSubmodules on-demand &&
509 # fake submodule configuration to avoid skipping submodule handling
510 git config -f .gitmodules submodule.fake.path fake &&
511 git config -f .gitmodules submodule.fake.url fakeurl &&
512 git add .gitmodules &&
513 git config --unset submodule.submodule.url &&
514 git fetch >../actual.out 2>../actual.err &&
516 git config --unset fetch.recurseSubmodules &&
519 test_must_be_empty actual.out &&
520 test_i18ncmp expect.err.2 actual.err &&
521 git checkout HEAD^ -- .gitmodules &&
522 git add .gitmodules &&
523 git commit -m "new submodule restored .gitmodules"
526 test_expect_success
'fetching submodules respects parallel settings' '
527 git config fetch.recurseSubmodules true &&
530 GIT_TRACE=$(pwd)/trace.out git fetch &&
531 grep "1 tasks" trace.out &&
532 GIT_TRACE=$(pwd)/trace.out git fetch --jobs 7 &&
533 grep "7 tasks" trace.out &&
534 git config submodule.fetchJobs 8 &&
535 GIT_TRACE=$(pwd)/trace.out git fetch &&
536 grep "8 tasks" trace.out &&
537 GIT_TRACE=$(pwd)/trace.out git fetch --jobs 9 &&
538 grep "9 tasks" trace.out
542 test_expect_success
'fetching submodule into a broken repository' '
543 # Prepare src and src/sub nested in it
548 git -C sub commit --allow-empty -m "initial in sub" &&
549 git submodule add -- ./sub sub &&
550 git commit -m "initial in top"
553 # Clone the old-fashoned way
555 git -C dst clone ../src/sub sub &&
557 # Make sure that old-fashoned layout is still supported
560 # "diff" would find no change
561 git -C dst diff --exit-code &&
563 # Recursive-fetch works fine
564 git -C dst fetch --recurse-submodules &&
566 # Break the receiving submodule
567 rm -f dst/sub/.git/HEAD &&
569 # NOTE: without the fix the following tests will recurse forever!
570 # They should terminate with an error.
572 test_must_fail git -C dst status &&
573 test_must_fail git -C dst diff &&
574 test_must_fail git -C dst fetch --recurse-submodules
577 test_expect_success
"fetch new commits when submodule got renamed" '
578 git clone . downstream_rename &&
580 cd downstream_rename &&
581 git submodule update --init --recursive &&
582 git checkout -b rename &&
583 git mv submodule submodule_renamed &&
585 cd submodule_renamed &&
586 git checkout -b rename_sub &&
590 git push origin rename_sub &&
591 git rev-parse HEAD >../../expect
593 git add submodule_renamed &&
594 git commit -m "update renamed submodule" &&
595 git push origin rename
599 git fetch --recurse-submodules=on-demand &&
602 git rev-parse origin/rename_sub >../../actual
605 test_cmp expect actual
608 test_expect_success
"fetch new submodule commits on-demand outside standard refspec" '
609 # add a second submodule and ensure it is around in downstream first
610 git clone submodule sub1 &&
611 git submodule add ./sub1 &&
612 git commit -m "adding a second submodule" &&
613 git -C downstream pull &&
614 git -C downstream submodule update --init --recursive &&
616 git checkout --detach &&
618 C=$(git -C submodule commit-tree -m "new change outside refs/heads" HEAD^{tree}) &&
619 git -C submodule update-ref refs/changes/1 $C &&
620 git update-index --cacheinfo 160000 $C submodule &&
623 D=$(git -C sub1 commit-tree -m "new change outside refs/heads" HEAD^{tree}) &&
624 git -C sub1 update-ref refs/changes/2 $D &&
625 git update-index --cacheinfo 160000 $D sub1 &&
627 git commit -m "updated submodules outside of refs/heads" &&
628 E=$(git rev-parse HEAD) &&
629 git update-ref refs/changes/3 $E &&
632 git fetch --recurse-submodules origin refs/changes/3:refs/heads/my_branch &&
633 git -C submodule cat-file -t $C &&
634 git -C sub1 cat-file -t $D &&
635 git checkout --recurse-submodules FETCH_HEAD
639 test_expect_success
'fetch new submodule commit on-demand in FETCH_HEAD' '
640 # depends on the previous test for setup
642 C=$(git -C submodule commit-tree -m "another change outside refs/heads" HEAD^{tree}) &&
643 git -C submodule update-ref refs/changes/4 $C &&
644 git update-index --cacheinfo 160000 $C submodule &&
647 D=$(git -C sub1 commit-tree -m "another change outside refs/heads" HEAD^{tree}) &&
648 git -C sub1 update-ref refs/changes/5 $D &&
649 git update-index --cacheinfo 160000 $D sub1 &&
651 git commit -m "updated submodules outside of refs/heads" &&
652 E=$(git rev-parse HEAD) &&
653 git update-ref refs/changes/6 $E &&
656 git fetch --recurse-submodules origin refs/changes/6 &&
657 git -C submodule cat-file -t $C &&
658 git -C sub1 cat-file -t $D &&
659 git checkout --recurse-submodules FETCH_HEAD
663 test_expect_success
'fetch new submodule commits on-demand without .gitmodules entry' '
664 # depends on the previous test for setup
666 git config -f .gitmodules --remove-section submodule.sub1 &&
667 git add .gitmodules &&
668 git commit -m "delete gitmodules file" &&
669 git checkout -B super &&
670 git -C downstream fetch &&
671 git -C downstream checkout origin/super &&
673 C=$(git -C submodule commit-tree -m "yet another change outside refs/heads" HEAD^{tree}) &&
674 git -C submodule update-ref refs/changes/7 $C &&
675 git update-index --cacheinfo 160000 $C submodule &&
678 D=$(git -C sub1 commit-tree -m "yet another change outside refs/heads" HEAD^{tree}) &&
679 git -C sub1 update-ref refs/changes/8 $D &&
680 git update-index --cacheinfo 160000 $D sub1 &&
682 git commit -m "updated submodules outside of refs/heads" &&
683 E=$(git rev-parse HEAD) &&
684 git update-ref refs/changes/9 $E &&
687 git fetch --recurse-submodules origin refs/changes/9 &&
688 git -C submodule cat-file -t $C &&
689 git -C sub1 cat-file -t $D &&
690 git checkout --recurse-submodules FETCH_HEAD
694 test_expect_success
'fetch new submodule commit intermittently referenced by superproject' '
695 # depends on the previous test for setup
697 D=$(git -C sub1 commit-tree -m "change 10 outside refs/heads" HEAD^{tree}) &&
698 E=$(git -C sub1 commit-tree -m "change 11 outside refs/heads" HEAD^{tree}) &&
699 F=$(git -C sub1 commit-tree -m "change 12 outside refs/heads" HEAD^{tree}) &&
701 git -C sub1 update-ref refs/changes/10 $D &&
702 git update-index --cacheinfo 160000 $D sub1 &&
703 git commit -m "updated submodules outside of refs/heads" &&
705 git -C sub1 update-ref refs/changes/11 $E &&
706 git update-index --cacheinfo 160000 $E sub1 &&
707 git commit -m "updated submodules outside of refs/heads" &&
709 git -C sub1 update-ref refs/changes/12 $F &&
710 git update-index --cacheinfo 160000 $F sub1 &&
711 git commit -m "updated submodules outside of refs/heads" &&
713 G=$(git rev-parse HEAD) &&
714 git update-ref refs/changes/13 $G &&
717 git fetch --recurse-submodules origin refs/changes/13 &&
719 git -C sub1 cat-file -t $D &&
720 git -C sub1 cat-file -t $E &&
721 git -C sub1 cat-file -t $F
729 git
-C "$dir" add
"$@" &&
730 git
-C "$dir" commit
-a -m "$msg" &&
734 compare_refs_in_dir
() {
741 git
-C "$1" rev-parse
--verify "$2" >expect
&&
742 git
-C "$3" rev-parse
--verify "$4" >actual
&&
743 eval $fail test_cmp expect actual
747 test_expect_success
'setup nested submodule fetch test' '
748 # does not depend on any previous test setups
750 for repo in outer middle inner
752 git init --bare $repo &&
753 git clone $repo ${repo}_content &&
754 echo "$repo" >"${repo}_content/file" &&
755 add_commit_push ${repo}_content "initial" file ||
760 git -C A submodule add "$pwd/middle" &&
761 git -C A/middle/ submodule add "$pwd/inner" &&
762 add_commit_push A/middle/ "adding inner sub" .gitmodules inner &&
763 add_commit_push A/ "adding middle sub" .gitmodules middle &&
766 git -C B/ submodule update --init middle &&
768 compare_refs_in_dir A HEAD B HEAD &&
769 compare_refs_in_dir A/middle HEAD B/middle HEAD &&
770 test_path_is_file B/file &&
771 test_path_is_file B/middle/file &&
772 test_path_is_missing B/middle/inner/file &&
774 echo "change on inner repo of A" >"A/middle/inner/file" &&
775 add_commit_push A/middle/inner "change on inner" file &&
776 add_commit_push A/middle "change on inner" inner &&
777 add_commit_push A "change on inner" middle
780 test_expect_success
'fetching a superproject containing an uninitialized sub/sub project' '
781 # depends on previous test for setup
784 compare_refs_in_dir A origin/HEAD B origin/HEAD
787 fetch_with_recursion_abort
() {
788 # In a regression the following git call will run into infinite recursion.
789 # To handle that, we connect the sed command to the git call by a pipe
790 # so that sed can kill the infinite recursion when detected.
791 # The recursion creates git output like:
792 # Fetching submodule sub
793 # Fetching submodule sub/sub <-- [1]
794 # Fetching submodule sub/sub/sub
796 # [1] sed will stop reading and cause git to eventually stop and die
798 git
-C "$1" fetch
--recurse-submodules 2>&1 |
799 sed "/Fetching submodule $2[^$]/q" >out
&&
800 ! grep "Fetching submodule $2[^$]" out
803 test_expect_success
'setup recursive fetch with uninit submodule' '
804 # does not depend on any previous test setups
806 test_create_repo super &&
807 test_commit -C super initial &&
808 test_create_repo sub &&
809 test_commit -C sub initial &&
810 git -C sub rev-parse HEAD >expect &&
812 git -C super submodule add ../sub &&
813 git -C super commit -m "add sub" &&
815 git clone super superclone &&
816 git -C superclone submodule status >out &&
817 sed -e "s/^-//" -e "s/ sub.*$//" out >actual &&
818 test_cmp expect actual
821 test_expect_success
'recursive fetch with uninit submodule' '
822 # depends on previous test for setup
824 fetch_with_recursion_abort superclone sub &&
825 git -C superclone submodule status >out &&
826 sed -e "s/^-//" -e "s/ sub$//" out >actual &&
827 test_cmp expect actual
830 test_expect_success
'recursive fetch after deinit a submodule' '
831 # depends on previous test for setup
833 git -C superclone submodule update --init sub &&
834 git -C superclone submodule deinit -f sub &&
836 fetch_with_recursion_abort superclone sub &&
837 git -C superclone submodule status >out &&
838 sed -e "s/^-//" -e "s/ sub$//" out >actual &&
839 test_cmp expect actual