@@ -18,7 +18,7 @@ add_upstream_commit() {
18
18
head2=$( git rev-parse --short HEAD) &&
19
19
echo " Fetching submodule submodule" > ../expect.err &&
20
20
echo " From $pwd /submodule" >> ../expect.err &&
21
- echo " $head1 ..$head2 main -> origin/main " >> ../expect.err
21
+ echo " $head1 ..$head2 sub -> origin/sub " >> ../expect.err
22
22
) &&
23
23
(
24
24
cd deepsubmodule &&
@@ -30,7 +30,7 @@ add_upstream_commit() {
30
30
head2=$( git rev-parse --short HEAD) &&
31
31
echo " Fetching submodule submodule/subdir/deepsubmodule" >> ../expect.err
32
32
echo " From $pwd /deepsubmodule" >> ../expect.err &&
33
- echo " $head1 ..$head2 main -> origin/main " >> ../expect.err
33
+ echo " $head1 ..$head2 deep -> origin/deep " >> ../expect.err
34
34
)
35
35
}
36
36
@@ -41,7 +41,8 @@ test_expect_success setup '
41
41
git init &&
42
42
echo deepsubcontent > deepsubfile &&
43
43
git add deepsubfile &&
44
- git commit -m new deepsubfile
44
+ git commit -m new deepsubfile &&
45
+ git branch -M deep
45
46
) &&
46
47
mkdir submodule &&
47
48
(
@@ -50,18 +51,20 @@ test_expect_success setup '
50
51
echo subcontent > subfile &&
51
52
git add subfile &&
52
53
git submodule add "$pwd/deepsubmodule" subdir/deepsubmodule &&
53
- git commit -a -m new
54
+ git commit -a -m new &&
55
+ git branch -M sub
54
56
) &&
55
57
git submodule add "$pwd/submodule" submodule &&
56
58
git commit -am initial &&
59
+ git branch -M super &&
57
60
git clone . downstream &&
58
61
(
59
62
cd downstream &&
60
63
git submodule update --init --recursive
61
64
)
62
65
'
63
66
64
- test_expect_success PREPARE_FOR_MAIN_BRANCH " fetch --recurse-submodules recurses into submodules" '
67
+ test_expect_success " fetch --recurse-submodules recurses into submodules" '
65
68
add_upstream_commit &&
66
69
(
67
70
cd downstream &&
@@ -71,7 +74,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "fetch --recurse-submodules recurses
71
74
test_i18ncmp expect.err actual.err
72
75
'
73
76
74
- test_expect_success PREPARE_FOR_MAIN_BRANCH " submodule.recurse option triggers recursive fetch" '
77
+ test_expect_success " submodule.recurse option triggers recursive fetch" '
75
78
add_upstream_commit &&
76
79
(
77
80
cd downstream &&
@@ -81,7 +84,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "submodule.recurse option triggers r
81
84
test_i18ncmp expect.err actual.err
82
85
'
83
86
84
- test_expect_success PREPARE_FOR_MAIN_BRANCH " fetch --recurse-submodules -j2 has the same output behaviour" '
87
+ test_expect_success " fetch --recurse-submodules -j2 has the same output behaviour" '
85
88
add_upstream_commit &&
86
89
(
87
90
cd downstream &&
@@ -111,7 +114,7 @@ test_expect_success "fetch --no-recurse-submodules only fetches superproject" '
111
114
test_must_be_empty actual.err
112
115
'
113
116
114
- test_expect_success PREPARE_FOR_MAIN_BRANCH " using fetchRecurseSubmodules=true in .gitmodules recurses into submodules" '
117
+ test_expect_success " using fetchRecurseSubmodules=true in .gitmodules recurses into submodules" '
115
118
(
116
119
cd downstream &&
117
120
git config -f .gitmodules submodule.submodule.fetchRecurseSubmodules true &&
@@ -141,7 +144,7 @@ test_expect_success "using fetchRecurseSubmodules=false in .git/config overrides
141
144
test_must_be_empty actual.err
142
145
'
143
146
144
- test_expect_success PREPARE_FOR_MAIN_BRANCH " --recurse-submodules overrides fetchRecurseSubmodules setting from .git/config" '
147
+ test_expect_success " --recurse-submodules overrides fetchRecurseSubmodules setting from .git/config" '
145
148
(
146
149
cd downstream &&
147
150
git fetch --recurse-submodules >../actual.out 2>../actual.err &&
@@ -170,7 +173,7 @@ test_expect_success "--quiet propagates to parallel submodules" '
170
173
test_must_be_empty actual.err
171
174
'
172
175
173
- test_expect_success PREPARE_FOR_MAIN_BRANCH " --dry-run propagates to submodules" '
176
+ test_expect_success " --dry-run propagates to submodules" '
174
177
add_upstream_commit &&
175
178
(
176
179
cd downstream &&
@@ -180,7 +183,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "--dry-run propagates to submodules"
180
183
test_i18ncmp expect.err actual.err
181
184
'
182
185
183
- test_expect_success PREPARE_FOR_MAIN_BRANCH " Without --dry-run propagates to submodules" '
186
+ test_expect_success " Without --dry-run propagates to submodules" '
184
187
(
185
188
cd downstream &&
186
189
git fetch --recurse-submodules >../actual.out 2>../actual.err
@@ -189,7 +192,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "Without --dry-run propagates to sub
189
192
test_i18ncmp expect.err actual.err
190
193
'
191
194
192
- test_expect_success PREPARE_FOR_MAIN_BRANCH " recurseSubmodules=true propagates into submodules" '
195
+ test_expect_success " recurseSubmodules=true propagates into submodules" '
193
196
add_upstream_commit &&
194
197
(
195
198
cd downstream &&
@@ -200,7 +203,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "recurseSubmodules=true propagates i
200
203
test_i18ncmp expect.err actual.err
201
204
'
202
205
203
- test_expect_success PREPARE_FOR_MAIN_BRANCH " --recurse-submodules overrides config in submodule" '
206
+ test_expect_success " --recurse-submodules overrides config in submodule" '
204
207
add_upstream_commit &&
205
208
(
206
209
cd downstream &&
@@ -225,7 +228,7 @@ test_expect_success "--no-recurse-submodules overrides config setting" '
225
228
test_must_be_empty actual.err
226
229
'
227
230
228
- test_expect_success PREPARE_FOR_MAIN_BRANCH " Recursion doesn't happen when no new commits are fetched in the superproject" '
231
+ test_expect_success " Recursion doesn't happen when no new commits are fetched in the superproject" '
229
232
(
230
233
cd downstream &&
231
234
(
@@ -239,13 +242,13 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "Recursion doesn't happen when no ne
239
242
test_must_be_empty actual.err
240
243
'
241
244
242
- test_expect_success PREPARE_FOR_MAIN_BRANCH " Recursion stops when no new submodule commits are fetched" '
245
+ test_expect_success " Recursion stops when no new submodule commits are fetched" '
243
246
head1=$(git rev-parse --short HEAD) &&
244
247
git add submodule &&
245
248
git commit -m "new submodule" &&
246
249
head2=$(git rev-parse --short HEAD) &&
247
250
echo "From $pwd/." > expect.err.sub &&
248
- echo " $head1..$head2 main -> origin/main " >>expect.err.sub &&
251
+ echo " $head1..$head2 super -> origin/super " >>expect.err.sub &&
249
252
head -3 expect.err >> expect.err.sub &&
250
253
(
251
254
cd downstream &&
@@ -255,15 +258,15 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "Recursion stops when no new submodu
255
258
test_must_be_empty actual.out
256
259
'
257
260
258
- test_expect_success PREPARE_FOR_MAIN_BRANCH " Recursion doesn't happen when new superproject commits don't change any submodules" '
261
+ test_expect_success " Recursion doesn't happen when new superproject commits don't change any submodules" '
259
262
add_upstream_commit &&
260
263
head1=$(git rev-parse --short HEAD) &&
261
264
echo a > file &&
262
265
git add file &&
263
266
git commit -m "new file" &&
264
267
head2=$(git rev-parse --short HEAD) &&
265
268
echo "From $pwd/." > expect.err.file &&
266
- echo " $head1..$head2 main -> origin/main " >> expect.err.file &&
269
+ echo " $head1..$head2 super -> origin/super " >> expect.err.file &&
267
270
(
268
271
cd downstream &&
269
272
git fetch >../actual.out 2>../actual.err
@@ -272,7 +275,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "Recursion doesn't happen when new s
272
275
test_i18ncmp expect.err.file actual.err
273
276
'
274
277
275
- test_expect_success PREPARE_FOR_MAIN_BRANCH " Recursion picks up config in submodule" '
278
+ test_expect_success " Recursion picks up config in submodule" '
276
279
(
277
280
cd downstream &&
278
281
git fetch --recurse-submodules &&
@@ -287,7 +290,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "Recursion picks up config in submod
287
290
git commit -m "new submodule" &&
288
291
head2=$(git rev-parse --short HEAD) &&
289
292
echo "From $pwd/." > expect.err.sub &&
290
- echo " $head1..$head2 main -> origin/main " >> expect.err.sub &&
293
+ echo " $head1..$head2 super -> origin/super " >> expect.err.sub &&
291
294
cat expect.err >> expect.err.sub &&
292
295
(
293
296
cd downstream &&
@@ -301,7 +304,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "Recursion picks up config in submod
301
304
test_must_be_empty actual.out
302
305
'
303
306
304
- test_expect_success PREPARE_FOR_MAIN_BRANCH " Recursion picks up all submodules when necessary" '
307
+ test_expect_success " Recursion picks up all submodules when necessary" '
305
308
add_upstream_commit &&
306
309
(
307
310
cd submodule &&
@@ -316,14 +319,14 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "Recursion picks up all submodules w
316
319
head2=$(git rev-parse --short HEAD) &&
317
320
echo "Fetching submodule submodule" > ../expect.err.sub &&
318
321
echo "From $pwd/submodule" >> ../expect.err.sub &&
319
- echo " $head1..$head2 main -> origin/main " >> ../expect.err.sub
322
+ echo " $head1..$head2 sub -> origin/sub " >> ../expect.err.sub
320
323
) &&
321
324
head1=$(git rev-parse --short HEAD) &&
322
325
git add submodule &&
323
326
git commit -m "new submodule" &&
324
327
head2=$(git rev-parse --short HEAD) &&
325
328
echo "From $pwd/." > expect.err.2 &&
326
- echo " $head1..$head2 main -> origin/main " >> expect.err.2 &&
329
+ echo " $head1..$head2 super -> origin/super " >> expect.err.2 &&
327
330
cat expect.err.sub >> expect.err.2 &&
328
331
tail -3 expect.err >> expect.err.2 &&
329
332
(
@@ -334,7 +337,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "Recursion picks up all submodules w
334
337
test_must_be_empty actual.out
335
338
'
336
339
337
- test_expect_success PREPARE_FOR_MAIN_BRANCH " '--recurse-submodules=on-demand' doesn't recurse when no new commits are fetched in the superproject (and ignores config)" '
340
+ test_expect_success " '--recurse-submodules=on-demand' doesn't recurse when no new commits are fetched in the superproject (and ignores config)" '
338
341
add_upstream_commit &&
339
342
(
340
343
cd submodule &&
@@ -349,7 +352,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "'--recurse-submodules=on-demand' do
349
352
head2=$(git rev-parse --short HEAD) &&
350
353
echo Fetching submodule submodule > ../expect.err.sub &&
351
354
echo "From $pwd/submodule" >> ../expect.err.sub &&
352
- echo " $head1..$head2 main -> origin/main " >> ../expect.err.sub
355
+ echo " $head1..$head2 sub -> origin/sub " >> ../expect.err.sub
353
356
) &&
354
357
(
355
358
cd downstream &&
@@ -361,14 +364,14 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "'--recurse-submodules=on-demand' do
361
364
test_must_be_empty actual.err
362
365
'
363
366
364
- test_expect_success PREPARE_FOR_MAIN_BRANCH " '--recurse-submodules=on-demand' recurses as deep as necessary (and ignores config)" '
367
+ test_expect_success " '--recurse-submodules=on-demand' recurses as deep as necessary (and ignores config)" '
365
368
head1=$(git rev-parse --short HEAD) &&
366
369
git add submodule &&
367
370
git commit -m "new submodule" &&
368
371
head2=$(git rev-parse --short HEAD) &&
369
372
tail -3 expect.err > expect.err.deepsub &&
370
373
echo "From $pwd/." > expect.err &&
371
- echo " $head1..$head2 main -> origin/main " >>expect.err &&
374
+ echo " $head1..$head2 super -> origin/super " >>expect.err &&
372
375
cat expect.err.sub >> expect.err &&
373
376
cat expect.err.deepsub >> expect.err &&
374
377
(
@@ -389,15 +392,15 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "'--recurse-submodules=on-demand' re
389
392
test_i18ncmp expect.err actual.err
390
393
'
391
394
392
- test_expect_success PREPARE_FOR_MAIN_BRANCH " '--recurse-submodules=on-demand' stops when no new submodule commits are found in the superproject (and ignores config)" '
395
+ test_expect_success " '--recurse-submodules=on-demand' stops when no new submodule commits are found in the superproject (and ignores config)" '
393
396
add_upstream_commit &&
394
397
head1=$(git rev-parse --short HEAD) &&
395
398
echo a >> file &&
396
399
git add file &&
397
400
git commit -m "new file" &&
398
401
head2=$(git rev-parse --short HEAD) &&
399
402
echo "From $pwd/." > expect.err.file &&
400
- echo " $head1..$head2 main -> origin/main " >> expect.err.file &&
403
+ echo " $head1..$head2 super -> origin/super " >> expect.err.file &&
401
404
(
402
405
cd downstream &&
403
406
git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err
@@ -406,7 +409,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "'--recurse-submodules=on-demand' st
406
409
test_i18ncmp expect.err.file actual.err
407
410
'
408
411
409
- test_expect_success PREPARE_FOR_MAIN_BRANCH " 'fetch.recurseSubmodules=on-demand' overrides global config" '
412
+ test_expect_success " 'fetch.recurseSubmodules=on-demand' overrides global config" '
410
413
(
411
414
cd downstream &&
412
415
git fetch --recurse-submodules
@@ -418,7 +421,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "'fetch.recurseSubmodules=on-demand'
418
421
git commit -m "new submodule" &&
419
422
head2=$(git rev-parse --short HEAD) &&
420
423
echo "From $pwd/." > expect.err.2 &&
421
- echo " $head1..$head2 main -> origin/main " >>expect.err.2 &&
424
+ echo " $head1..$head2 super -> origin/super " >>expect.err.2 &&
422
425
head -3 expect.err >> expect.err.2 &&
423
426
(
424
427
cd downstream &&
@@ -434,7 +437,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "'fetch.recurseSubmodules=on-demand'
434
437
test_i18ncmp expect.err.2 actual.err
435
438
'
436
439
437
- test_expect_success PREPARE_FOR_MAIN_BRANCH " 'submodule.<sub>.fetchRecurseSubmodules=on-demand' overrides fetch.recurseSubmodules" '
440
+ test_expect_success " 'submodule.<sub>.fetchRecurseSubmodules=on-demand' overrides fetch.recurseSubmodules" '
438
441
(
439
442
cd downstream &&
440
443
git fetch --recurse-submodules
@@ -446,7 +449,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "'submodule.<sub>.fetchRecurseSubmod
446
449
git commit -m "new submodule" &&
447
450
head2=$(git rev-parse --short HEAD) &&
448
451
echo "From $pwd/." > expect.err.2 &&
449
- echo " $head1..$head2 main -> origin/main " >>expect.err.2 &&
452
+ echo " $head1..$head2 super -> origin/super " >>expect.err.2 &&
450
453
head -3 expect.err >> expect.err.2 &&
451
454
(
452
455
cd downstream &&
@@ -462,7 +465,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "'submodule.<sub>.fetchRecurseSubmod
462
465
test_i18ncmp expect.err.2 actual.err
463
466
'
464
467
465
- test_expect_success PREPARE_FOR_MAIN_BRANCH " don't fetch submodule when newly recorded commits are already present" '
468
+ test_expect_success " don't fetch submodule when newly recorded commits are already present" '
466
469
(
467
470
cd submodule &&
468
471
git checkout -q HEAD^^
@@ -472,7 +475,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "don't fetch submodule when newly re
472
475
git commit -m "submodule rewound" &&
473
476
head2=$(git rev-parse --short HEAD) &&
474
477
echo "From $pwd/." > expect.err &&
475
- echo " $head1..$head2 main -> origin/main " >> expect.err &&
478
+ echo " $head1..$head2 super -> origin/super " >> expect.err &&
476
479
(
477
480
cd downstream &&
478
481
git fetch >../actual.out 2>../actual.err
@@ -481,11 +484,11 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "don't fetch submodule when newly re
481
484
test_i18ncmp expect.err actual.err &&
482
485
(
483
486
cd submodule &&
484
- git checkout -q master
487
+ git checkout -q sub
485
488
)
486
489
'
487
490
488
- test_expect_success PREPARE_FOR_MAIN_BRANCH " 'fetch.recurseSubmodules=on-demand' works also without .gitmodules entry" '
491
+ test_expect_success " 'fetch.recurseSubmodules=on-demand' works also without .gitmodules entry" '
489
492
(
490
493
cd downstream &&
491
494
git fetch --recurse-submodules
@@ -497,7 +500,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "'fetch.recurseSubmodules=on-demand'
497
500
git commit -m "new submodule without .gitmodules" &&
498
501
head2=$(git rev-parse --short HEAD) &&
499
502
echo "From $pwd/." >expect.err.2 &&
500
- echo " $head1..$head2 main -> origin/main " >>expect.err.2 &&
503
+ echo " $head1..$head2 super -> origin/super " >>expect.err.2 &&
501
504
head -3 expect.err >>expect.err.2 &&
502
505
(
503
506
cd downstream &&
@@ -663,9 +666,9 @@ test_expect_success 'fetch new submodule commits on-demand without .gitmodules e
663
666
git config -f .gitmodules --remove-section submodule.sub1 &&
664
667
git add .gitmodules &&
665
668
git commit -m "delete gitmodules file" &&
666
- git checkout -B master &&
669
+ git checkout -B super &&
667
670
git -C downstream fetch &&
668
- git -C downstream checkout origin/master &&
671
+ git -C downstream checkout origin/super &&
669
672
670
673
C=$(git -C submodule commit-tree -m "yet another change outside refs/heads" HEAD^{tree}) &&
671
674
git -C submodule update-ref refs/changes/7 $C &&
0 commit comments