]> git.ipfire.org Git - thirdparty/git.git/blame - t/t7400-submodule-basic.sh
submodule: add --dissociate option to add/update commands
[thirdparty/git.git] / t / t7400-submodule-basic.sh
CommitLineData
88961ef2
LH
1#!/bin/sh
2#
3# Copyright (c) 2007 Lars Hjemli
4#
5
6test_description='Basic porcelain support for submodules
7
8This test tries to verify basic sanity of the init, update and status
47a528ad 9subcommands of git submodule.
88961ef2
LH
10'
11
12. ./test-lib.sh
13
f6a52799
SB
14test_expect_success 'submodule deinit works on empty repository' '
15 git submodule deinit --all
16'
17
fe454b13
JN
18test_expect_success 'setup - initial commit' '
19 >t &&
47a528ad
NS
20 git add t &&
21 git commit -m "initial commit" &&
fe454b13
JN
22 git branch initial
23'
24
d92028a5
SB
25test_expect_success 'submodule init aborts on missing .gitmodules file' '
26 test_when_finished "git update-index --remove sub" &&
27 git update-index --add --cacheinfo 160000,$(git rev-parse HEAD),sub &&
28 # missing the .gitmodules file here
29 test_must_fail git submodule init 2>actual &&
30 test_i18ngrep "No url found for submodule path" actual
31'
32
08fdbdb1
SB
33test_expect_success 'submodule update aborts on missing .gitmodules file' '
34 test_when_finished "git update-index --remove sub" &&
35 git update-index --add --cacheinfo 160000,$(git rev-parse HEAD),sub &&
36 # missing the .gitmodules file here
37 git submodule update sub 2>actual &&
38 test_i18ngrep "Submodule path .sub. not initialized" actual
39'
40
627fde10
JK
41test_expect_success 'submodule update aborts on missing gitmodules url' '
42 test_when_finished "git update-index --remove sub" &&
43 git update-index --add --cacheinfo 160000,$(git rev-parse HEAD),sub &&
44 test_when_finished "rm -f .gitmodules" &&
45 git config -f .gitmodules submodule.s.path sub &&
46 test_must_fail git submodule init
47'
48
fe454b13 49test_expect_success 'setup - repository in init subdirectory' '
a2d93aea 50 mkdir init &&
fe454b13
JN
51 (
52 cd init &&
53 git init &&
54 echo a >a &&
55 git add a &&
56 git commit -m "submodule commit 1" &&
57 git tag -a -m "rev-1" rev-1
58 )
fe454b13
JN
59'
60
61test_expect_success 'setup - commit with gitlink' '
88961ef2
LH
62 echo a >a &&
63 echo z >z &&
a2d93aea 64 git add a init z &&
fe454b13
JN
65 git commit -m "super commit 1"
66'
67
68test_expect_success 'setup - hide init subdirectory' '
69 mv init .subrepo
70'
71
a76c944b 72test_expect_success 'setup - repository to add submodules to' '
31991b02
ÆAB
73 git init addtest &&
74 git init addtest-ignore
a76c944b
JN
75'
76
77# The 'submodule add' tests need some repository to add as a submodule.
dd008b3b
JK
78# The trash directory is a good one as any. We need to canonicalize
79# the name, though, as some tests compare it to the absolute path git
80# generates, which will expand symbolic links.
81submodurl=$(pwd -P)
a76c944b
JN
82
83listbranches() {
84 git for-each-ref --format='%(refname)' 'refs/heads/*'
85}
86
87inspect() {
88 dir=$1 &&
89 dotdot="${2:-..}" &&
90
ac8463d2 91 (
a76c944b
JN
92 cd "$dir" &&
93 listbranches >"$dotdot/heads" &&
94 { git symbolic-ref HEAD || :; } >"$dotdot/head" &&
ce8b54d6 95 git rev-parse HEAD >"$dotdot/head-sha1" &&
a76c944b
JN
96 git update-index --refresh &&
97 git diff-files --exit-code &&
98 git clean -n -d -x >"$dotdot/untracked"
ac8463d2 99 )
a76c944b 100}
ac8463d2
MG
101
102test_expect_success 'submodule add' '
a76c944b
JN
103 echo "refs/heads/master" >expect &&
104 >empty &&
105
ac8463d2
MG
106 (
107 cd addtest &&
7e60407f 108 git submodule add -q "$submodurl" submod >actual &&
ca8d148d 109 test_must_be_empty actual &&
ea115a0d
JL
110 echo "gitdir: ../.git/modules/submod" >expect &&
111 test_cmp expect submod/.git &&
d75219b4
JL
112 (
113 cd submod &&
114 git config core.worktree >actual &&
115 echo "../../../submod" >expect &&
116 test_cmp expect actual &&
117 rm -f actual expect
118 ) &&
ac8463d2 119 git submodule init
a76c944b
JN
120 ) &&
121
122 rm -f heads head untracked &&
123 inspect addtest/submod ../.. &&
124 test_cmp expect heads &&
125 test_cmp expect head &&
126 test_cmp empty untracked
ac8463d2
MG
127'
128
6d33e1c2
CF
129test_create_repo parent &&
130test_commit -C parent one
131
132test_expect_success 'redirected submodule add does not show progress' '
133 git -C addtest submodule add "file://$submodurl/parent" submod-redirected \
134 2>err &&
135 ! grep % err &&
136 test_i18ngrep ! "Checking connectivity" err
137'
138
139test_expect_success 'redirected submodule add --progress does show progress' '
140 git -C addtest submodule add --progress "file://$submodurl/parent" \
141 submod-redirected-progress 2>err && \
142 grep % err
143'
144
d27b876b 145test_expect_success 'submodule add to .gitignored path fails' '
31991b02
ÆAB
146 (
147 cd addtest-ignore &&
d27b876b
JL
148 cat <<-\EOF >expect &&
149 The following path is ignored by one of your .gitignore files:
150 submod
151 Use -f if you really want to add it.
152 EOF
31991b02
ÆAB
153 # Does not use test_commit due to the ignore
154 echo "*" > .gitignore &&
155 git add --force .gitignore &&
156 git commit -m"Ignore everything" &&
d27b876b 157 ! git submodule add "$submodurl" submod >actual 2>&1 &&
3a4c3ed7 158 test_i18ncmp expect actual
d27b876b
JL
159 )
160'
31991b02 161
d27b876b
JL
162test_expect_success 'submodule add to .gitignored path with --force' '
163 (
164 cd addtest-ignore &&
165 git submodule add --force "$submodurl" submod
166 )
31991b02
ÆAB
167'
168
619acfc7
SB
169test_expect_success 'submodule add to reconfigure existing submodule with --force' '
170 (
171 cd addtest-ignore &&
172 git submodule add --force bogus-url submod &&
173 git submodule add -b initial "$submodurl" submod-branch &&
174 test "bogus-url" = "$(git config -f .gitmodules submodule.submod.url)" &&
175 test "bogus-url" = "$(git config submodule.submod.url)" &&
176 # Restore the url
177 git submodule add --force "$submodurl" submod
178 test "$submodurl" = "$(git config -f .gitmodules submodule.submod.url)" &&
179 test "$submodurl" = "$(git config submodule.submod.url)"
180 )
181'
182
ea10b60c 183test_expect_success 'submodule add --branch' '
a76c944b
JN
184 echo "refs/heads/initial" >expect-head &&
185 cat <<-\EOF >expect-heads &&
186 refs/heads/initial
187 refs/heads/master
188 EOF
189 >empty &&
190
ea10b60c
BJ
191 (
192 cd addtest &&
193 git submodule add -b initial "$submodurl" submod-branch &&
b9289227 194 test "initial" = "$(git config -f .gitmodules submodule.submod-branch.branch)" &&
a76c944b
JN
195 git submodule init
196 ) &&
197
198 rm -f heads head untracked &&
199 inspect addtest/submod-branch ../.. &&
200 test_cmp expect-heads heads &&
201 test_cmp expect-head head &&
202 test_cmp empty untracked
ea10b60c
BJ
203'
204
db75ada5 205test_expect_success 'submodule add with ./ in path' '
a76c944b
JN
206 echo "refs/heads/master" >expect &&
207 >empty &&
208
ac8463d2
MG
209 (
210 cd addtest &&
211 git submodule add "$submodurl" ././dotsubmod/./frotz/./ &&
212 git submodule init
a76c944b
JN
213 ) &&
214
215 rm -f heads head untracked &&
216 inspect addtest/dotsubmod/frotz ../../.. &&
217 test_cmp expect heads &&
218 test_cmp expect head &&
219 test_cmp empty untracked
ac8463d2
MG
220'
221
8196e728
PS
222test_expect_success 'submodule add with /././ in path' '
223 echo "refs/heads/master" >expect &&
224 >empty &&
225
226 (
227 cd addtest &&
228 git submodule add "$submodurl" dotslashdotsubmod/././frotz/./ &&
229 git submodule init
230 ) &&
231
232 rm -f heads head untracked &&
233 inspect addtest/dotslashdotsubmod/frotz ../../.. &&
234 test_cmp expect heads &&
235 test_cmp expect head &&
236 test_cmp empty untracked
237'
ac8463d2 238
db75ada5 239test_expect_success 'submodule add with // in path' '
a76c944b
JN
240 echo "refs/heads/master" >expect &&
241 >empty &&
242
ac8463d2
MG
243 (
244 cd addtest &&
245 git submodule add "$submodurl" slashslashsubmod///frotz// &&
246 git submodule init
a76c944b
JN
247 ) &&
248
249 rm -f heads head untracked &&
250 inspect addtest/slashslashsubmod/frotz ../../.. &&
251 test_cmp expect heads &&
252 test_cmp expect head &&
253 test_cmp empty untracked
ac8463d2
MG
254'
255
db75ada5 256test_expect_success 'submodule add with /.. in path' '
a76c944b
JN
257 echo "refs/heads/master" >expect &&
258 >empty &&
259
ac8463d2
MG
260 (
261 cd addtest &&
262 git submodule add "$submodurl" dotdotsubmod/../realsubmod/frotz/.. &&
263 git submodule init
a76c944b
JN
264 ) &&
265
266 rm -f heads head untracked &&
267 inspect addtest/realsubmod ../.. &&
268 test_cmp expect heads &&
269 test_cmp expect head &&
270 test_cmp empty untracked
ac8463d2
MG
271'
272
db75ada5 273test_expect_success 'submodule add with ./, /.. and // in path' '
a76c944b
JN
274 echo "refs/heads/master" >expect &&
275 >empty &&
276
ac8463d2
MG
277 (
278 cd addtest &&
279 git submodule add "$submodurl" dot/dotslashsubmod/./../..////realsubmod2/a/b/c/d/../../../../frotz//.. &&
280 git submodule init
a76c944b
JN
281 ) &&
282
283 rm -f heads head untracked &&
284 inspect addtest/realsubmod2 ../.. &&
285 test_cmp expect heads &&
286 test_cmp expect head &&
287 test_cmp empty untracked
ac8463d2
MG
288'
289
7f1b2251 290test_expect_success !CYGWIN 'submodule add with \\ in path' '
cf9e55f4
BW
291 test_when_finished "rm -rf parent sub\\with\\backslash" &&
292
293 # Initialize a repo with a backslash in its name
294 git init sub\\with\\backslash &&
295 touch sub\\with\\backslash/empty.file &&
296 git -C sub\\with\\backslash add empty.file &&
297 git -C sub\\with\\backslash commit -m "Added empty.file" &&
298
299 # Add that repository as a submodule
300 git init parent &&
301 git -C parent submodule add ../sub\\with\\backslash
302'
303
091a6eb0
JK
304test_expect_success 'submodule add in subdirectory' '
305 echo "refs/heads/master" >expect &&
306 >empty &&
307
308 mkdir addtest/sub &&
309 (
310 cd addtest/sub &&
311 git submodule add "$submodurl" ../realsubmod3 &&
312 git submodule init
313 ) &&
314
315 rm -f heads head untracked &&
316 inspect addtest/realsubmod3 ../.. &&
317 test_cmp expect heads &&
318 test_cmp expect head &&
319 test_cmp empty untracked
320'
321
322test_expect_success 'submodule add in subdirectory with relative path should fail' '
323 (
324 cd addtest/sub &&
325 test_must_fail git submodule add ../../ submod3 2>../../output.err
326 ) &&
327 test_i18ngrep toplevel output.err
328'
329
ce8b54d6 330test_expect_success 'setup - add an example entry to .gitmodules' '
f7e87141 331 git config --file=.gitmodules submodule.example.url git://example.com/init.git
ce8b54d6
JN
332'
333
941987a5 334test_expect_success 'status should fail for unmapped paths' '
ce8b54d6
JN
335 test_must_fail git submodule status
336'
337
338test_expect_success 'setup - map path in .gitmodules' '
339 cat <<\EOF >expect &&
340[submodule "example"]
341 url = git://example.com/init.git
342 path = init
343EOF
344
f7e87141 345 git config --file=.gitmodules submodule.example.path init &&
ce8b54d6
JN
346
347 test_cmp expect .gitmodules
88961ef2
LH
348'
349
350test_expect_success 'status should only print one line' '
ce8b54d6 351 git submodule status >lines &&
3fb0459b 352 test_line_count = 1 lines
ce8b54d6
JN
353'
354
355test_expect_success 'setup - fetch commit name from submodule' '
356 rev1=$(cd .subrepo && git rev-parse HEAD) &&
357 printf "rev1: %s\n" "$rev1" &&
358 test -n "$rev1"
88961ef2
LH
359'
360
361test_expect_success 'status should initially be "missing"' '
ce8b54d6
JN
362 git submodule status >lines &&
363 grep "^-$rev1" lines
88961ef2
LH
364'
365
211b7f19 366test_expect_success 'init should register submodule url in .git/config' '
ce8b54d6
JN
367 echo git://example.com/init.git >expect &&
368
47a528ad 369 git submodule init &&
ce8b54d6
JN
370 git config submodule.example.url >url &&
371 git config submodule.example.url ./.subrepo &&
372
373 test_cmp expect url
211b7f19
LH
374'
375
be9d0a3a
HV
376test_failure_with_unknown_submodule () {
377 test_must_fail git submodule $1 no-such-submodule 2>output.err &&
378 grep "^error: .*no-such-submodule" output.err
379}
380
381test_expect_success 'init should fail with unknown submodule' '
382 test_failure_with_unknown_submodule init
383'
384
385test_expect_success 'update should fail with unknown submodule' '
386 test_failure_with_unknown_submodule update
387'
388
389test_expect_success 'status should fail with unknown submodule' '
390 test_failure_with_unknown_submodule status
391'
392
393test_expect_success 'sync should fail with unknown submodule' '
394 test_failure_with_unknown_submodule sync
395'
396
211b7f19 397test_expect_success 'update should fail when path is used by a file' '
ce8b54d6
JN
398 echo hello >expect &&
399
a2d93aea 400 echo "hello" >init &&
ce8b54d6
JN
401 test_must_fail git submodule update &&
402
403 test_cmp expect init
88961ef2
LH
404'
405
211b7f19 406test_expect_success 'update should fail when path is used by a nonempty directory' '
ce8b54d6
JN
407 echo hello >expect &&
408
409 rm -fr init &&
a2d93aea
JH
410 mkdir init &&
411 echo "hello" >init/a &&
ce8b54d6
JN
412
413 test_must_fail git submodule update &&
414
415 test_cmp expect init/a
88961ef2
LH
416'
417
211b7f19 418test_expect_success 'update should work when path is an empty dir' '
ce8b54d6
JN
419 rm -fr init &&
420 rm -f head-sha1 &&
421 echo "$rev1" >expect &&
422
a2d93aea 423 mkdir init &&
7e60407f 424 git submodule update -q >update.out &&
ca8d148d 425 test_must_be_empty update.out &&
ce8b54d6
JN
426
427 inspect init &&
428 test_cmp expect head-sha1
88961ef2
LH
429'
430
211b7f19 431test_expect_success 'status should be "up-to-date" after update' '
ce8b54d6
JN
432 git submodule status >list &&
433 grep "^ $rev1" list
88961ef2
LH
434'
435
091a6eb0
JK
436test_expect_success 'status "up-to-date" from subdirectory' '
437 mkdir -p sub &&
438 (
439 cd sub &&
440 git submodule status >../list
441 ) &&
442 grep "^ $rev1" list &&
443 grep "\\.\\./init" list
444'
445
446test_expect_success 'status "up-to-date" from subdirectory with path' '
447 mkdir -p sub &&
448 (
449 cd sub &&
450 git submodule status ../init >../list
451 ) &&
452 grep "^ $rev1" list &&
453 grep "\\.\\./init" list
454'
455
88961ef2 456test_expect_success 'status should be "modified" after submodule commit' '
ce8b54d6
JN
457 (
458 cd init &&
459 echo b >b &&
460 git add b &&
461 git commit -m "submodule commit 2"
462 ) &&
463
464 rev2=$(cd init && git rev-parse HEAD) &&
465 test -n "$rev2" &&
466 git submodule status >list &&
467
468 grep "^+$rev2" list
88961ef2
LH
469'
470
471test_expect_success 'the --cached sha1 should be rev1' '
ce8b54d6
JN
472 git submodule --cached status >list &&
473 grep "^+$rev1" list
88961ef2
LH
474'
475
5701115a 476test_expect_success 'git diff should report the SHA1 of the new submodule commit' '
ce8b54d6
JN
477 git diff >diff &&
478 grep "^+Subproject commit $rev2" diff
5701115a
SV
479'
480
88961ef2 481test_expect_success 'update should checkout rev1' '
ce8b54d6
JN
482 rm -f head-sha1 &&
483 echo "$rev1" >expect &&
484
47a528ad 485 git submodule update init &&
ce8b54d6
JN
486 inspect init &&
487
488 test_cmp expect head-sha1
88961ef2
LH
489'
490
491test_expect_success 'status should be "up-to-date" after update' '
ce8b54d6
JN
492 git submodule status >list &&
493 grep "^ $rev1" list
88961ef2
LH
494'
495
0cf73755 496test_expect_success 'checkout superproject with subproject already present' '
47a528ad
NS
497 git checkout initial &&
498 git checkout master
0cf73755
SV
499'
500
e06c5a6c 501test_expect_success 'apply submodule diff' '
ce8b54d6
JN
502 >empty &&
503
e06c5a6c
SV
504 git branch second &&
505 (
a2d93aea 506 cd init &&
e06c5a6c
SV
507 echo s >s &&
508 git add s &&
509 git commit -m "change subproject"
510 ) &&
a2d93aea 511 git update-index --add init &&
47a528ad
NS
512 git commit -m "change init" &&
513 git format-patch -1 --stdout >P.diff &&
e06c5a6c
SV
514 git checkout second &&
515 git apply --index P.diff &&
ce8b54d6
JN
516
517 git diff --cached master >staged &&
518 test_cmp empty staged
e06c5a6c
SV
519'
520
be4d2c83 521test_expect_success 'update --init' '
be4d2c83
JS
522 mv init init2 &&
523 git config -f .gitmodules submodule.example.url "$(pwd)/init2" &&
ce8b54d6
JN
524 git config --remove-section submodule.example &&
525 test_must_fail git config submodule.example.url &&
526
8c6b5491 527 git submodule update init 2> update.out &&
ce8b54d6 528 cat update.out &&
1c2ef66f 529 test_i18ngrep "not initialized" update.out &&
abc06822 530 test_must_fail git rev-parse --resolve-git-dir init/.git &&
ce8b54d6 531
be4d2c83 532 git submodule update --init init &&
abc06822 533 git rev-parse --resolve-git-dir init/.git
be4d2c83
JS
534'
535
091a6eb0
JK
536test_expect_success 'update --init from subdirectory' '
537 mv init init2 &&
538 git config -f .gitmodules submodule.example.url "$(pwd)/init2" &&
539 git config --remove-section submodule.example &&
540 test_must_fail git config submodule.example.url &&
541
542 mkdir -p sub &&
543 (
544 cd sub &&
8c6b5491 545 git submodule update ../init 2>update.out &&
091a6eb0
JK
546 cat update.out &&
547 test_i18ngrep "not initialized" update.out &&
548 test_must_fail git rev-parse --resolve-git-dir ../init/.git &&
549
550 git submodule update --init ../init
551 ) &&
552 git rev-parse --resolve-git-dir init/.git
553'
554
2ce53f9b
JS
555test_expect_success 'do not add files from a submodule' '
556
557 git reset --hard &&
558 test_must_fail git add init/a
559
560'
561
2c63d6eb 562test_expect_success 'gracefully add/reset submodule with a trailing slash' '
2ce53f9b
JS
563
564 git reset --hard &&
565 git commit -m "commit subproject" init &&
566 (cd init &&
567 echo b > a) &&
568 git add init/ &&
569 git diff --exit-code --cached init &&
570 commit=$(cd init &&
571 git commit -m update a >/dev/null &&
572 git rev-parse HEAD) &&
573 git add init/ &&
574 test_must_fail git diff --exit-code --cached init &&
575 test $commit = $(git ls-files --stage |
2c63d6eb
JK
576 sed -n "s/^160000 \([^ ]*\).*/\1/p") &&
577 git reset init/ &&
578 git diff --exit-code --cached init
2ce53f9b
JS
579
580'
581
f3670a57
JS
582test_expect_success 'ls-files gracefully handles trailing slash' '
583
584 test "init" = "$(git ls-files init/)"
585
586'
587
c5e558a8
PC
588test_expect_success 'moving to a commit without submodule does not leave empty dir' '
589 rm -rf init &&
590 mkdir init &&
591 git reset --hard &&
592 git checkout initial &&
593 test ! -d init &&
594 git checkout second
595'
596
af9c9f97
RR
597test_expect_success 'submodule <invalid-subcommand> fails' '
598 test_must_fail git submodule no-such-subcommand
496917b7
JS
599'
600
1414e578
JL
601test_expect_success 'add submodules without specifying an explicit path' '
602 mkdir repo &&
18a82692
JN
603 (
604 cd repo &&
605 git init &&
606 echo r >r &&
607 git add r &&
608 git commit -m "repo commit 1"
fd4ec4f2 609 ) &&
1414e578 610 git clone --bare repo/ bare.git &&
69e7236c
JL
611 (
612 cd addtest &&
613 git submodule add "$submodurl/repo" &&
614 git config -f .gitmodules submodule.repo.path repo &&
615 git submodule add "$submodurl/bare.git" &&
616 git config -f .gitmodules submodule.bare.path bare
617 )
618'
619
620test_expect_success 'add should fail when path is used by a file' '
621 (
622 cd addtest &&
623 touch file &&
624 test_must_fail git submodule add "$submodurl/repo" file
625 )
626'
627
628test_expect_success 'add should fail when path is used by an existing directory' '
629 (
630 cd addtest &&
631 mkdir empty-dir &&
632 test_must_fail git submodule add "$submodurl/repo" empty-dir
633 )
1414e578
JL
634'
635
4d689320 636test_expect_success 'use superproject as upstream when path is relative and no url is set there' '
8537f0ef
JL
637 (
638 cd addtest &&
4d689320
JL
639 git submodule add ../repo relative &&
640 test "$(git config -f .gitmodules submodule.relative.url)" = ../repo &&
641 git submodule sync relative &&
642 test "$(git config submodule.relative.url)" = "$submodurl/repo"
8537f0ef
JL
643 )
644'
645
ea640cc6
TR
646test_expect_success 'set up for relative path tests' '
647 mkdir reltest &&
648 (
649 cd reltest &&
650 git init &&
651 mkdir sub &&
652 (
653 cd sub &&
654 git init &&
655 test_commit foo
656 ) &&
657 git add sub &&
658 git config -f .gitmodules submodule.sub.path sub &&
659 git config -f .gitmodules submodule.sub.url ../subrepo &&
712693e8
JS
660 cp .git/config pristine-.git-config &&
661 cp .gitmodules pristine-.gitmodules
ea640cc6
TR
662 )
663'
664
712693e8 665test_expect_success '../subrepo works with URL - ssh://hostname/repo' '
ea640cc6
TR
666 (
667 cd reltest &&
668 cp pristine-.git-config .git/config &&
712693e8 669 cp pristine-.gitmodules .gitmodules &&
ea640cc6
TR
670 git config remote.origin.url ssh://hostname/repo &&
671 git submodule init &&
672 test "$(git config submodule.sub.url)" = ssh://hostname/subrepo
673 )
674'
675
712693e8
JS
676test_expect_success '../subrepo works with port-qualified URL - ssh://hostname:22/repo' '
677 (
678 cd reltest &&
679 cp pristine-.git-config .git/config &&
680 cp pristine-.gitmodules .gitmodules &&
681 git config remote.origin.url ssh://hostname:22/repo &&
682 git submodule init &&
683 test "$(git config submodule.sub.url)" = ssh://hostname:22/subrepo
684 )
685'
686
c517e73d
JS
687# About the choice of the path in the next test:
688# - double-slash side-steps path mangling issues on Windows
689# - it is still an absolute local path
690# - there cannot be a server with a blank in its name just in case the
691# path is used erroneously to access a //server/share style path
692test_expect_success '../subrepo path works with local path - //somewhere else/repo' '
712693e8
JS
693 (
694 cd reltest &&
695 cp pristine-.git-config .git/config &&
696 cp pristine-.gitmodules .gitmodules &&
c517e73d 697 git config remote.origin.url "//somewhere else/repo" &&
712693e8 698 git submodule init &&
c517e73d 699 test "$(git config submodule.sub.url)" = "//somewhere else/subrepo"
712693e8
JS
700 )
701'
702
703test_expect_success '../subrepo works with file URL - file:///tmp/repo' '
704 (
705 cd reltest &&
706 cp pristine-.git-config .git/config &&
707 cp pristine-.gitmodules .gitmodules &&
708 git config remote.origin.url file:///tmp/repo &&
709 git submodule init &&
710 test "$(git config submodule.sub.url)" = file:///tmp/subrepo
711 )
712'
713
714test_expect_success '../subrepo works with helper URL- helper:://hostname/repo' '
715 (
716 cd reltest &&
717 cp pristine-.git-config .git/config &&
718 cp pristine-.gitmodules .gitmodules &&
719 git config remote.origin.url helper:://hostname/repo &&
720 git submodule init &&
721 test "$(git config submodule.sub.url)" = helper:://hostname/subrepo
722 )
723'
724
725test_expect_success '../subrepo works with scp-style URL - user@host:repo' '
ea640cc6
TR
726 (
727 cd reltest &&
728 cp pristine-.git-config .git/config &&
729 git config remote.origin.url user@host:repo &&
730 git submodule init &&
731 test "$(git config submodule.sub.url)" = user@host:subrepo
732 )
733'
734
712693e8
JS
735test_expect_success '../subrepo works with scp-style URL - user@host:path/to/repo' '
736 (
737 cd reltest &&
738 cp pristine-.git-config .git/config &&
739 cp pristine-.gitmodules .gitmodules &&
740 git config remote.origin.url user@host:path/to/repo &&
741 git submodule init &&
742 test "$(git config submodule.sub.url)" = user@host:path/to/subrepo
743 )
744'
745
758615e2 746test_expect_success '../subrepo works with relative local path - foo' '
49301c64
JS
747 (
748 cd reltest &&
749 cp pristine-.git-config .git/config &&
750 cp pristine-.gitmodules .gitmodules &&
751 git config remote.origin.url foo &&
752 # actual: fails with an error
753 git submodule init &&
754 test "$(git config submodule.sub.url)" = subrepo
755 )
756'
757
712693e8
JS
758test_expect_success '../subrepo works with relative local path - foo/bar' '
759 (
760 cd reltest &&
761 cp pristine-.git-config .git/config &&
762 cp pristine-.gitmodules .gitmodules &&
763 git config remote.origin.url foo/bar &&
764 git submodule init &&
765 test "$(git config submodule.sub.url)" = foo/subrepo
766 )
767'
768
758615e2 769test_expect_success '../subrepo works with relative local path - ./foo' '
49301c64
JS
770 (
771 cd reltest &&
772 cp pristine-.git-config .git/config &&
773 cp pristine-.gitmodules .gitmodules &&
774 git config remote.origin.url ./foo &&
775 git submodule init &&
776 test "$(git config submodule.sub.url)" = subrepo
777 )
778'
779
758615e2 780test_expect_success '../subrepo works with relative local path - ./foo/bar' '
49301c64
JS
781 (
782 cd reltest &&
783 cp pristine-.git-config .git/config &&
784 cp pristine-.gitmodules .gitmodules &&
785 git config remote.origin.url ./foo/bar &&
786 git submodule init &&
787 test "$(git config submodule.sub.url)" = foo/subrepo
788 )
789'
790
712693e8
JS
791test_expect_success '../subrepo works with relative local path - ../foo' '
792 (
793 cd reltest &&
794 cp pristine-.git-config .git/config &&
795 cp pristine-.gitmodules .gitmodules &&
796 git config remote.origin.url ../foo &&
797 git submodule init &&
798 test "$(git config submodule.sub.url)" = ../subrepo
799 )
800'
801
802test_expect_success '../subrepo works with relative local path - ../foo/bar' '
803 (
804 cd reltest &&
805 cp pristine-.git-config .git/config &&
806 cp pristine-.gitmodules .gitmodules &&
807 git config remote.origin.url ../foo/bar &&
808 git submodule init &&
809 test "$(git config submodule.sub.url)" = ../foo/subrepo
810 )
811'
812
813test_expect_success '../bar/a/b/c works with relative local path - ../foo/bar.git' '
814 (
815 cd reltest &&
816 cp pristine-.git-config .git/config &&
817 cp pristine-.gitmodules .gitmodules &&
818 mkdir -p a/b/c &&
819 (cd a/b/c; git init) &&
820 git config remote.origin.url ../foo/bar.git &&
821 git submodule add ../bar/a/b/c ./a/b/c &&
822 git submodule init &&
823 test "$(git config submodule.a/b/c.url)" = ../foo/bar/a/b/c
824 )
825'
826
d75219b4
JL
827test_expect_success 'moving the superproject does not break submodules' '
828 (
829 cd addtest &&
830 git submodule status >expect
99094a7a 831 ) &&
d75219b4
JL
832 mv addtest addtest2 &&
833 (
834 cd addtest2 &&
835 git submodule status >actual &&
836 test_cmp expect actual
837 )
838'
839
73b0898d
JL
840test_expect_success 'submodule add --name allows to replace a submodule with another at the same path' '
841 (
842 cd addtest2 &&
843 (
844 cd repo &&
845 echo "$submodurl/repo" >expect &&
846 git config remote.origin.url >actual &&
847 test_cmp expect actual &&
848 echo "gitdir: ../.git/modules/repo" >expect &&
849 test_cmp expect .git
850 ) &&
851 rm -rf repo &&
852 git rm repo &&
853 git submodule add -q --name repo_new "$submodurl/bare.git" repo >actual &&
ca8d148d 854 test_must_be_empty actual &&
73b0898d
JL
855 echo "gitdir: ../.git/modules/submod" >expect &&
856 test_cmp expect submod/.git &&
857 (
858 cd repo &&
859 echo "$submodurl/bare.git" >expect &&
860 git config remote.origin.url >actual &&
861 test_cmp expect actual &&
862 echo "gitdir: ../.git/modules/repo_new" >expect &&
863 test_cmp expect .git
864 ) &&
865 echo "repo" >expect &&
95c16418 866 test_must_fail git config -f .gitmodules submodule.repo.path &&
73b0898d
JL
867 git config -f .gitmodules submodule.repo_new.path >actual &&
868 test_cmp expect actual&&
869 echo "$submodurl/repo" >expect &&
95c16418 870 test_must_fail git config -f .gitmodules submodule.repo.url &&
73b0898d
JL
871 echo "$submodurl/bare.git" >expect &&
872 git config -f .gitmodules submodule.repo_new.url >actual &&
873 test_cmp expect actual &&
874 echo "$submodurl/repo" >expect &&
875 git config submodule.repo.url >actual &&
876 test_cmp expect actual &&
877 echo "$submodurl/bare.git" >expect &&
878 git config submodule.repo_new.url >actual &&
879 test_cmp expect actual
880 )
881'
882
f8eaa0ba 883test_expect_success 'recursive relative submodules stay relative' '
3fea121d
SB
884 test_when_finished "rm -rf super clone2 subsub sub3" &&
885 mkdir subsub &&
886 (
887 cd subsub &&
888 git init &&
889 >t &&
890 git add t &&
891 git commit -m "initial commit"
892 ) &&
893 mkdir sub3 &&
894 (
895 cd sub3 &&
896 git init &&
897 >t &&
898 git add t &&
899 git commit -m "initial commit" &&
900 git submodule add ../subsub dirdir/subsub &&
901 git commit -m "add submodule subsub"
902 ) &&
903 mkdir super &&
904 (
905 cd super &&
906 git init &&
907 >t &&
908 git add t &&
909 git commit -m "initial commit" &&
910 git submodule add ../sub3 &&
911 git commit -m "add submodule sub"
912 ) &&
913 git clone super clone2 &&
914 (
915 cd clone2 &&
916 git submodule update --init --recursive &&
917 echo "gitdir: ../.git/modules/sub3" >./sub3/.git_expect &&
918 echo "gitdir: ../../../.git/modules/sub3/modules/dirdir/subsub" >./sub3/dirdir/subsub/.git_expect
919 ) &&
920 test_cmp clone2/sub3/.git_expect clone2/sub3/.git &&
921 test_cmp clone2/sub3/dirdir/subsub/.git_expect clone2/sub3/dirdir/subsub/.git
73b0898d
JL
922'
923
4b7c286e
JL
924test_expect_success 'submodule add with an existing name fails unless forced' '
925 (
926 cd addtest2 &&
927 rm -rf repo &&
928 git rm repo &&
929 test_must_fail git submodule add -q --name repo_new "$submodurl/repo.git" repo &&
930 test ! -d repo &&
95c16418
JL
931 test_must_fail git config -f .gitmodules submodule.repo_new.path &&
932 test_must_fail git config -f .gitmodules submodule.repo_new.url &&
4b7c286e
JL
933 echo "$submodurl/bare.git" >expect &&
934 git config submodule.repo_new.url >actual &&
935 test_cmp expect actual &&
936 git submodule add -f -q --name repo_new "$submodurl/repo.git" repo &&
937 test -d repo &&
938 echo "repo" >expect &&
939 git config -f .gitmodules submodule.repo_new.path >actual &&
940 test_cmp expect actual&&
941 echo "$submodurl/repo.git" >expect &&
942 git config -f .gitmodules submodule.repo_new.url >actual &&
943 test_cmp expect actual &&
944 echo "$submodurl/repo.git" >expect &&
945 git config submodule.repo_new.url >actual &&
946 test_cmp expect actual
947 )
948'
949
cf419828
JL
950test_expect_success 'set up a second submodule' '
951 git submodule add ./init2 example2 &&
952 git commit -m "submodule example2 added"
953'
954
84ba959b
SB
955test_expect_success 'submodule deinit works on repository without submodules' '
956 test_when_finished "rm -rf newdirectory" &&
957 mkdir newdirectory &&
958 (
959 cd newdirectory &&
960 git init &&
961 >file &&
962 git add file &&
14544dd2 963 git commit -m "repo should not be empty" &&
f6a52799
SB
964 git submodule deinit . &&
965 git submodule deinit --all
84ba959b
SB
966 )
967'
968
cf419828
JL
969test_expect_success 'submodule deinit should remove the whole submodule section from .git/config' '
970 git config submodule.example.foo bar &&
971 git config submodule.example2.frotz nitfol &&
972 git submodule deinit init &&
973 test -z "$(git config --get-regexp "submodule\.example\.")" &&
974 test -n "$(git config --get-regexp "submodule\.example2\.")" &&
975 test -f example2/.git &&
976 rmdir init
977'
978
091a6eb0
JK
979test_expect_success 'submodule deinit from subdirectory' '
980 git submodule update --init &&
981 git config submodule.example.foo bar &&
982 mkdir -p sub &&
983 (
984 cd sub &&
985 git submodule deinit ../init >../output
986 ) &&
1edbaac3 987 test_i18ngrep "\\.\\./init" output &&
091a6eb0
JK
988 test -z "$(git config --get-regexp "submodule\.example\.")" &&
989 test -n "$(git config --get-regexp "submodule\.example2\.")" &&
990 test -f example2/.git &&
991 rmdir init
992'
993
cf419828
JL
994test_expect_success 'submodule deinit . deinits all initialized submodules' '
995 git submodule update --init &&
996 git config submodule.example.foo bar &&
997 git config submodule.example2.frotz nitfol &&
998 test_must_fail git submodule deinit &&
7b294bf4 999 git submodule deinit . >actual &&
cf419828
JL
1000 test -z "$(git config --get-regexp "submodule\.example\.")" &&
1001 test -z "$(git config --get-regexp "submodule\.example2\.")" &&
7b294bf4
JL
1002 test_i18ngrep "Cleared directory .init" actual &&
1003 test_i18ngrep "Cleared directory .example2" actual &&
cf419828
JL
1004 rmdir init example2
1005'
1006
f6a52799
SB
1007test_expect_success 'submodule deinit --all deinits all initialized submodules' '
1008 git submodule update --init &&
1009 git config submodule.example.foo bar &&
1010 git config submodule.example2.frotz nitfol &&
1011 test_must_fail git submodule deinit &&
1012 git submodule deinit --all >actual &&
1013 test -z "$(git config --get-regexp "submodule\.example\.")" &&
1014 test -z "$(git config --get-regexp "submodule\.example2\.")" &&
1015 test_i18ngrep "Cleared directory .init" actual &&
1016 test_i18ngrep "Cleared directory .example2" actual &&
1017 rmdir init example2
1018'
1019
cf419828
JL
1020test_expect_success 'submodule deinit deinits a submodule when its work tree is missing or empty' '
1021 git submodule update --init &&
1022 rm -rf init example2/* example2/.git &&
7b294bf4 1023 git submodule deinit init example2 >actual &&
cf419828
JL
1024 test -z "$(git config --get-regexp "submodule\.example\.")" &&
1025 test -z "$(git config --get-regexp "submodule\.example2\.")" &&
7b294bf4
JL
1026 test_i18ngrep ! "Cleared directory .init" actual &&
1027 test_i18ngrep "Cleared directory .example2" actual &&
cf419828
JL
1028 rmdir init
1029'
1030
1031test_expect_success 'submodule deinit fails when the submodule contains modifications unless forced' '
1032 git submodule update --init &&
1033 echo X >>init/s &&
1034 test_must_fail git submodule deinit init &&
1035 test -n "$(git config --get-regexp "submodule\.example\.")" &&
1036 test -f example2/.git &&
7b294bf4 1037 git submodule deinit -f init >actual &&
cf419828 1038 test -z "$(git config --get-regexp "submodule\.example\.")" &&
7b294bf4 1039 test_i18ngrep "Cleared directory .init" actual &&
cf419828
JL
1040 rmdir init
1041'
1042
1043test_expect_success 'submodule deinit fails when the submodule contains untracked files unless forced' '
1044 git submodule update --init &&
1045 echo X >>init/untracked &&
1046 test_must_fail git submodule deinit init &&
1047 test -n "$(git config --get-regexp "submodule\.example\.")" &&
1048 test -f example2/.git &&
7b294bf4 1049 git submodule deinit -f init >actual &&
cf419828 1050 test -z "$(git config --get-regexp "submodule\.example\.")" &&
7b294bf4 1051 test_i18ngrep "Cleared directory .init" actual &&
cf419828
JL
1052 rmdir init
1053'
1054
1055test_expect_success 'submodule deinit fails when the submodule HEAD does not match unless forced' '
1056 git submodule update --init &&
1057 (
1058 cd init &&
1059 git checkout HEAD^
1060 ) &&
1061 test_must_fail git submodule deinit init &&
1062 test -n "$(git config --get-regexp "submodule\.example\.")" &&
1063 test -f example2/.git &&
7b294bf4 1064 git submodule deinit -f init >actual &&
cf419828 1065 test -z "$(git config --get-regexp "submodule\.example\.")" &&
7b294bf4 1066 test_i18ngrep "Cleared directory .init" actual &&
cf419828
JL
1067 rmdir init
1068'
1069
1070test_expect_success 'submodule deinit is silent when used on an uninitialized submodule' '
1071 git submodule update --init &&
1072 git submodule deinit init >actual &&
1073 test_i18ngrep "Submodule .example. (.*) unregistered for path .init" actual &&
7b294bf4 1074 test_i18ngrep "Cleared directory .init" actual &&
cf419828
JL
1075 git submodule deinit init >actual &&
1076 test_i18ngrep ! "Submodule .example. (.*) unregistered for path .init" actual &&
7b294bf4 1077 test_i18ngrep "Cleared directory .init" actual &&
cf419828
JL
1078 git submodule deinit . >actual &&
1079 test_i18ngrep ! "Submodule .example. (.*) unregistered for path .init" actual &&
1080 test_i18ngrep "Submodule .example2. (.*) unregistered for path .example2" actual &&
7b294bf4 1081 test_i18ngrep "Cleared directory .init" actual &&
cf419828
JL
1082 git submodule deinit . >actual &&
1083 test_i18ngrep ! "Submodule .example. (.*) unregistered for path .init" actual &&
1084 test_i18ngrep ! "Submodule .example2. (.*) unregistered for path .example2" actual &&
7b294bf4 1085 test_i18ngrep "Cleared directory .init" actual &&
f6a52799
SB
1086 git submodule deinit --all >actual &&
1087 test_i18ngrep ! "Submodule .example. (.*) unregistered for path .init" actual &&
1088 test_i18ngrep ! "Submodule .example2. (.*) unregistered for path .example2" actual &&
1089 test_i18ngrep "Cleared directory .init" actual &&
cf419828
JL
1090 rmdir init example2
1091'
1092
1093test_expect_success 'submodule deinit fails when submodule has a .git directory even when forced' '
1094 git submodule update --init &&
1095 (
1096 cd init &&
1097 rm .git &&
1098 cp -R ../.git/modules/example .git &&
1099 GIT_WORK_TREE=. git config --unset core.worktree
1100 ) &&
1101 test_must_fail git submodule deinit init &&
1102 test_must_fail git submodule deinit -f init &&
1103 test -d init/.git &&
1104 test -n "$(git config --get-regexp "submodule\.example\.")"
1105'
1106
bed94704
TB
1107test_expect_success 'submodule with UTF-8 name' '
1108 svname=$(printf "\303\245 \303\244\303\266") &&
1109 mkdir "$svname" &&
74671241 1110 (
bed94704 1111 cd "$svname" &&
74671241 1112 git init &&
bed94704
TB
1113 >sub &&
1114 git add sub &&
74671241 1115 git commit -m "init sub"
bed94704 1116 ) &&
bed94704
TB
1117 git submodule add ./"$svname" &&
1118 git submodule >&2 &&
1119 test -n "$(git submodule | grep "$svname")"
74671241 1120'
2bb7afac 1121
275cd184
FG
1122test_expect_success 'submodule add clone shallow submodule' '
1123 mkdir super &&
99094a7a 1124 pwd=$(pwd) &&
275cd184
FG
1125 (
1126 cd super &&
1127 git init &&
1128 git submodule add --depth=1 file://"$pwd"/example2 submodule &&
1129 (
1130 cd submodule &&
1131 test 1 = $(git log --oneline | wc -l)
1132 )
1133 )
1134'
1135
2b56bb7a
SB
1136test_expect_success 'submodule helper list is not confused by common prefixes' '
1137 mkdir -p dir1/b &&
1138 (
1139 cd dir1/b &&
1140 git init &&
1141 echo hi >testfile2 &&
1142 git add . &&
1143 git commit -m "test1"
1144 ) &&
1145 mkdir -p dir2/b &&
1146 (
1147 cd dir2/b &&
1148 git init &&
1149 echo hello >testfile1 &&
1150 git add . &&
1151 git commit -m "test2"
1152 ) &&
1153 git submodule add /dir1/b dir1/b &&
1154 git submodule add /dir2/b dir2/b &&
1155 git commit -m "first submodule commit" &&
1156 git submodule--helper list dir1/b |cut -c51- >actual &&
1157 echo "dir1/b" >expect &&
1158 test_cmp expect actual
1159'
1160
3e7eaed0
BW
1161test_expect_success 'setup superproject with submodules' '
1162 git init sub1 &&
1163 test_commit -C sub1 test &&
1164 test_commit -C sub1 test2 &&
1165 git init multisuper &&
1166 git -C multisuper submodule add ../sub1 sub0 &&
1167 git -C multisuper submodule add ../sub1 sub1 &&
1168 git -C multisuper submodule add ../sub1 sub2 &&
1169 git -C multisuper submodule add ../sub1 sub3 &&
1170 git -C multisuper commit -m "add some submodules"
1171'
1172
1173cat >expect <<-EOF
1174-sub0
1175 sub1 (test2)
1176 sub2 (test2)
1177 sub3 (test2)
1178EOF
1179
1180test_expect_success 'submodule update --init with a specification' '
1181 test_when_finished "rm -rf multisuper_clone" &&
1182 pwd=$(pwd) &&
1183 git clone file://"$pwd"/multisuper multisuper_clone &&
1184 git -C multisuper_clone submodule update --init . ":(exclude)sub0" &&
1185 git -C multisuper_clone submodule status |cut -c 1,43- >actual &&
1186 test_cmp expect actual
1187'
1188
1189test_expect_success 'submodule update --init with submodule.active set' '
1190 test_when_finished "rm -rf multisuper_clone" &&
1191 pwd=$(pwd) &&
1192 git clone file://"$pwd"/multisuper multisuper_clone &&
1193 git -C multisuper_clone config submodule.active "." &&
1194 git -C multisuper_clone config --add submodule.active ":(exclude)sub0" &&
1195 git -C multisuper_clone submodule update --init &&
1196 git -C multisuper_clone submodule status |cut -c 1,43- >actual &&
1197 test_cmp expect actual
1198'
1199
1200test_expect_success 'submodule update and setting submodule.<name>.active' '
1201 test_when_finished "rm -rf multisuper_clone" &&
1202 pwd=$(pwd) &&
1203 git clone file://"$pwd"/multisuper multisuper_clone &&
1204 git -C multisuper_clone config --bool submodule.sub0.active "true" &&
1205 git -C multisuper_clone config --bool submodule.sub1.active "false" &&
1206 git -C multisuper_clone config --bool submodule.sub2.active "true" &&
1207
1208 cat >expect <<-\EOF &&
1209 sub0 (test2)
1210 -sub1
1211 sub2 (test2)
1212 -sub3
1213 EOF
1214 git -C multisuper_clone submodule update &&
1215 git -C multisuper_clone submodule status |cut -c 1,43- >actual &&
1216 test_cmp expect actual
1217'
275cd184 1218
bb62e0a9
BW
1219test_expect_success 'clone --recurse-submodules with a pathspec works' '
1220 test_when_finished "rm -rf multisuper_clone" &&
1221 cat >expected <<-\EOF &&
1222 sub0 (test2)
1223 -sub1
1224 -sub2
1225 -sub3
1226 EOF
1227
1228 git clone --recurse-submodules="sub0" multisuper multisuper_clone &&
1229 git -C multisuper_clone submodule status |cut -c1,43- >actual &&
9c5b2fab 1230 test_cmp expected actual
bb62e0a9
BW
1231'
1232
1233test_expect_success 'clone with multiple --recurse-submodules options' '
1234 test_when_finished "rm -rf multisuper_clone" &&
1235 cat >expect <<-\EOF &&
1236 -sub0
1237 sub1 (test2)
1238 -sub2
1239 sub3 (test2)
1240 EOF
1241
1242 git clone --recurse-submodules="." \
1243 --recurse-submodules=":(exclude)sub0" \
1244 --recurse-submodules=":(exclude)sub2" \
1245 multisuper multisuper_clone &&
1246 git -C multisuper_clone submodule status |cut -c1,43- >actual &&
1247 test_cmp expect actual
1248'
1249
1250test_expect_success 'clone and subsequent updates correctly auto-initialize submodules' '
1251 test_when_finished "rm -rf multisuper_clone" &&
1252 cat <<-\EOF >expect &&
1253 -sub0
1254 sub1 (test2)
1255 -sub2
1256 sub3 (test2)
1257 EOF
1258
1259 cat <<-\EOF >expect2 &&
1260 -sub0
1261 sub1 (test2)
1262 -sub2
1263 sub3 (test2)
1264 -sub4
1265 sub5 (test2)
1266 EOF
1267
1268 git clone --recurse-submodules="." \
1269 --recurse-submodules=":(exclude)sub0" \
1270 --recurse-submodules=":(exclude)sub2" \
1271 --recurse-submodules=":(exclude)sub4" \
1272 multisuper multisuper_clone &&
1273
1274 git -C multisuper_clone submodule status |cut -c1,43- >actual &&
1275 test_cmp expect actual &&
1276
1277 git -C multisuper submodule add ../sub1 sub4 &&
1278 git -C multisuper submodule add ../sub1 sub5 &&
1279 git -C multisuper commit -m "add more submodules" &&
1280 # obtain the new superproject
1281 git -C multisuper_clone pull &&
1282 git -C multisuper_clone submodule update --init &&
1283 git -C multisuper_clone submodule status |cut -c1,43- >actual &&
1284 test_cmp expect2 actual
1285'
1286
1f8d7115
BW
1287test_expect_success 'init properly sets the config' '
1288 test_when_finished "rm -rf multisuper_clone" &&
1289 git clone --recurse-submodules="." \
1290 --recurse-submodules=":(exclude)sub0" \
1291 multisuper multisuper_clone &&
1292
1293 git -C multisuper_clone submodule init -- sub0 sub1 &&
1294 git -C multisuper_clone config --get submodule.sub0.active &&
1295 test_must_fail git -C multisuper_clone config --get submodule.sub1.active
1296'
1297
03c004c5
BW
1298test_expect_success 'recursive clone respects -q' '
1299 test_when_finished "rm -rf multisuper_clone" &&
1300 git clone -q --recurse-submodules multisuper multisuper_clone >actual &&
1301 test_must_be_empty actual
1302'
1303
88961ef2 1304test_done