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