9
10
11
test_expect_success setup '
12
+ git checkout -f --orphan initial-branch &&
13
test_tick &&
14
git config core.autocrlf false &&
15
echo x >file_x &&
23
test_expect_success 'before initial commit, nothing added, only untracked' '
24
cat >expect <<-EOF &&
25
# branch.oid (initial)
25
- # branch.head master
26
+ # branch.head initial-branch
27
? actual
28
? dir1/
29
? expect
46
47
cat >expect <<-EOF &&
48
# branch.oid (initial)
48
- # branch.head master
49
+ # branch.head initial-branch
50
1 A. N... 000000 100644 100644 $ZERO_OID $OID_A dir1/file_a
51
1 A. N... 000000 100644 100644 $ZERO_OID $OID_B dir1/file_b
52
1 A. N... 000000 100644 100644 $ZERO_OID $OID_X file_x
63
test_expect_success 'before initial commit, things added (-z)' '
64
lf_to_nul >expect <<-EOF &&
65
# branch.oid (initial)
65
- # branch.head master
66
+ # branch.head initial-branch
67
1 A. N... 000000 100644 100644 $ZERO_OID $OID_A dir1/file_a
68
1 A. N... 000000 100644 100644 $ZERO_OID $OID_B dir1/file_b
69
1 A. N... 000000 100644 100644 $ZERO_OID $OID_X file_x
82
H0=$(git rev-parse HEAD) &&
83
cat >expect <<-EOF &&
84
# branch.oid $H0
84
- # branch.head master
85
+ # branch.head initial-branch
86
? actual
87
? expect
88
EOF
99
100
cat >expect <<-EOF &&
101
# branch.oid $H0
101
- # branch.head master
102
+ # branch.head initial-branch
103
1 .M N... 100644 100644 100644 $OID_X $OID_X file_x
104
1 .D N... 100644 100644 000000 $OID_Z $OID_Z file_z
105
? actual
127
128
cat >expect <<-EOF &&
129
# branch.oid $H0
129
- # branch.head master
130
+ # branch.head initial-branch
131
1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x
132
1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z
133
? actual
144
145
q_to_tab >expect <<-EOF &&
146
# branch.oid $H0
146
- # branch.head master
147
+ # branch.head initial-branch
148
1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x
149
1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z
150
2 R. N... 100644 100644 100644 $OID_Y $OID_Y R100 renamed_yQfile_y
162
## Lines use NUL path separator and line terminator, so double transform here.
163
q_to_nul <<-EOF | lf_to_nul >expect &&
164
# branch.oid $H0
164
- # branch.head master
165
+ # branch.head initial-branch
166
1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x
167
1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z
168
2 R. N... 100644 100644 100644 $OID_Y $OID_Y R100 renamed_yQfile_y
180
181
cat >expect <<-EOF &&
182
# branch.oid $H1
182
- # branch.head master
183
+ # branch.head initial-branch
184
? actual
185
? expect
186
EOF
232
233
cat >expect <<-EOF &&
234
# branch.oid $H1
234
- # branch.head master
235
+ # branch.head initial-branch
236
EOF
237
238
git status --porcelain=v2 --branch >actual &&
258
test_expect_success 'verify AA (add-add) conflict' '
259
test_when_finished "git reset --hard" &&
260
260
- git branch AA_A master &&
261
+ git branch AA_A initial-branch &&
262
git checkout AA_A &&
263
echo "Branch AA_A" >conflict.txt &&
264
OID_AA_A=$(git hash-object -t blob -- conflict.txt) &&
265
git add conflict.txt &&
266
git commit -m "branch aa_a" &&
267
267
- git branch AA_B master &&
268
+ git branch AA_B initial-branch &&
269
git checkout AA_B &&
270
echo "Branch AA_B" >conflict.txt &&
271
OID_AA_B=$(git hash-object -t blob -- conflict.txt) &&
291
test_expect_success 'verify UU (edit-edit) conflict' '
292
test_when_finished "git reset --hard" &&
293
293
- git branch UU_ANC master &&
294
+ git branch UU_ANC initial-branch &&
295
git checkout UU_ANC &&
296
echo "Ancestor" >conflict.txt &&
297
OID_UU_ANC=$(git hash-object -t blob -- conflict.txt) &&
329
'
330
331
test_expect_success 'verify upstream fields in branch header' '
331
- git checkout master &&
332
+ git checkout initial-branch &&
333
test_when_finished "rm -rf sub_repo" &&
334
git clone . sub_repo &&
335
(
335
- ## Confirm local master tracks remote master.
336
+ ## Confirm local initial-branch tracks remote initial-branch.
337
cd sub_repo &&
338
HUF=$(git rev-parse HEAD) &&
339
340
cat >expect <<-EOF &&
341
# branch.oid $HUF
341
- # branch.head master
342
- # branch.upstream origin/master
342
+ # branch.head initial-branch
343
+ # branch.upstream origin/initial-branch
344
# branch.ab +0 -0
345
EOF
346
356
357
cat >expect <<-EOF &&
358
# branch.oid $HUF
358
- # branch.head master
359
- # branch.upstream origin/master
359
+ # branch.head initial-branch
360
+ # branch.upstream origin/initial-branch
361
# branch.ab +1 -0
362
EOF
363
368
git status --porcelain=v2 --untracked-files=all >actual &&
369
test_must_be_empty actual &&
370
370
- ## Test upstream-gone case. Fake this by pointing origin/master at
371
- ## a non-existing commit.
372
- OLD=$(git rev-parse origin/master) &&
371
+ ## Test upstream-gone case. Fake this by pointing
372
+ ## origin/initial-branch at a non-existing commit.
373
+ OLD=$(git rev-parse origin/initial-branch) &&
374
NEW=$ZERO_OID &&
375
mv .git/packed-refs .git/old-packed-refs &&
376
sed "s/$OLD/$NEW/g" <.git/old-packed-refs >.git/packed-refs &&
379
380
cat >expect <<-EOF &&
381
# branch.oid $HUF
381
- # branch.head master
382
- # branch.upstream origin/master
382
+ # branch.head initial-branch
383
+ # branch.upstream origin/initial-branch
384
EOF
385
386
git status --porcelain=v2 --branch --untracked-files=all >actual &&
389
'
390
391
test_expect_success 'verify --[no-]ahead-behind with V2 format' '
391
- git checkout master &&
392
+ git checkout initial-branch &&
393
test_when_finished "rm -rf sub_repo" &&
394
git clone . sub_repo &&
395
(
395
- ## Confirm local master tracks remote master.
396
+ ## Confirm local initial-branch tracks remote initial-branch.
397
cd sub_repo &&
398
HUF=$(git rev-parse HEAD) &&
399
400
# Confirm --no-ahead-behind reports traditional branch.ab with 0/0 for equal branches.
401
cat >expect <<-EOF &&
402
# branch.oid $HUF
402
- # branch.head master
403
- # branch.upstream origin/master
403
+ # branch.head initial-branch
404
+ # branch.upstream origin/initial-branch
405
# branch.ab +0 -0
406
EOF
407
411
# Confirm --ahead-behind reports traditional branch.ab with 0/0.
412
cat >expect <<-EOF &&
413
# branch.oid $HUF
413
- # branch.head master
414
- # branch.upstream origin/master
414
+ # branch.head initial-branch
415
+ # branch.upstream origin/initial-branch
416
# branch.ab +0 -0
417
EOF
418
429
# Confirm --no-ahead-behind reports branch.ab with ?/? for non-equal branches.
430
cat >expect <<-EOF &&
431
# branch.oid $HUF
431
- # branch.head master
432
- # branch.upstream origin/master
432
+ # branch.head initial-branch
433
+ # branch.upstream origin/initial-branch
434
# branch.ab +? -?
435
EOF
436
440
# Confirm --ahead-behind reports traditional branch.ab with 1/0.
441
cat >expect <<-EOF &&
442
# branch.oid $HUF
442
- # branch.head master
443
- # branch.upstream origin/master
443
+ # branch.head initial-branch
444
+ # branch.upstream origin/initial-branch
445
# branch.ab +1 -0
446
EOF
447
459
'
460
461
test_expect_success 'create and add submodule, submodule appears clean (A. S...)' '
461
- git checkout master &&
462
+ git checkout initial-branch &&
463
git clone . sub_repo &&
464
git clone . super_repo &&
465
( cd super_repo &&
472
473
cat >expect <<-EOF &&
474
# branch.oid $HSUP
474
- # branch.head master
475
- # branch.upstream origin/master
475
+ # branch.head initial-branch
476
+ # branch.upstream origin/initial-branch
477
# branch.ab +0 -0
478
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
479
1 A. S... 000000 160000 160000 $ZERO_OID $HSUB sub1
497
498
cat >expect <<-EOF &&
499
# branch.oid $HSUP
499
- # branch.head master
500
- # branch.upstream origin/master
500
+ # branch.head initial-branch
501
+ # branch.upstream origin/initial-branch
502
# branch.ab +0 -0
503
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
504
1 AM S..U 000000 160000 160000 $ZERO_OID $HSUB sub1
522
523
cat >expect <<-EOF &&
524
# branch.oid $HSUP
524
- # branch.head master
525
- # branch.upstream origin/master
525
+ # branch.head initial-branch
526
+ # branch.upstream origin/initial-branch
527
# branch.ab +0 -0
528
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
529
1 AM S.M. 000000 160000 160000 $ZERO_OID $HSUB sub1
549
550
cat >expect <<-EOF &&
551
# branch.oid $HSUP
551
- # branch.head master
552
- # branch.upstream origin/master
552
+ # branch.head initial-branch
553
+ # branch.upstream origin/initial-branch
554
# branch.ab +0 -0
555
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
556
1 AM S.M. 000000 160000 160000 $ZERO_OID $HSUB sub1
576
577
cat >expect <<-EOF &&
578
# branch.oid $HSUP
578
- # branch.head master
579
- # branch.upstream origin/master
579
+ # branch.head initial-branch
580
+ # branch.upstream origin/initial-branch
581
# branch.ab +0 -0
582
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
583
1 AM S.MU 000000 160000 160000 $ZERO_OID $HSUB sub1
603
604
cat >expect <<-EOF &&
605
# branch.oid $HSUP
605
- # branch.head master
606
- # branch.upstream origin/master
606
+ # branch.head initial-branch
607
+ # branch.upstream origin/initial-branch
608
# branch.ab +0 -0
609
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
610
1 AM SC.. 000000 160000 160000 $ZERO_OID $HSUB sub1
626
627
cat >expect <<-EOF &&
628
# branch.oid $HSUP
628
- # branch.head master
629
- # branch.upstream origin/master
629
+ # branch.head initial-branch
630
+ # branch.upstream origin/initial-branch
631
# branch.ab +1 -0
632
EOF
633
647
648
cat >expect <<-EOF &&
649
# branch.oid $HSUP
649
- # branch.head master
650
- # branch.upstream origin/master
650
+ # branch.head initial-branch
651
+ # branch.upstream origin/initial-branch
652
# branch.ab +1 -0
653
1 .M S.M. 160000 160000 160000 $HSUB $HSUB sub1
654
EOF