t3[0-3]*: adjust the references to the default branch name "main"
Carefully excluding t3040, which sees independent development elsewhere at the time of writing, we transition above-mentioned tests to the default branch name `main`. This trick was performed via $ (cd t && sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \ -e 's/Master/Main/g' -- t3[0-3]*.sh t3206/* && git checkout HEAD -- t3040\*) This allows us to define `GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main` for those tests. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Nov 18, 2020 at 23:44 UTC
d6c6b10817409ed93d3c1f65b3d0d2b0875165d4
16 files changed
+240
-240
t/t3200-branch.sh
+122
-122
@@ -5,7 +5,7 @@
5
6
test_description='git branch assorted tests'
7
8
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
8
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
9
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
10
11
. ./test-lib.sh
@@ -31,7 +31,7 @@ test_expect_success 'branch -h in broken repository' '
31
(
32
cd broken &&
33
git init &&
34
- >.git/refs/heads/master &&
34
+ >.git/refs/heads/main &&
35
test_expect_code 129 git branch -h >usage 2>&1
36
) &&
37
test_i18ngrep "[Uu]sage" broken/usage
@@ -45,8 +45,8 @@ test_expect_success 'git branch a/b/c should create a branch' '
45
git branch a/b/c && test_path_is_file .git/refs/heads/a/b/c
46
'
47
48
-test_expect_success 'git branch mb master... should create a branch' '
49
- git branch mb master... && test_path_is_file .git/refs/heads/mb
48
+test_expect_success 'git branch mb main... should create a branch' '
49
+ git branch mb main... && test_path_is_file .git/refs/heads/mb
50
'
51
52
test_expect_success 'git branch HEAD should fail' '
@@ -54,7 +54,7 @@ test_expect_success 'git branch HEAD should fail' '
54
'
55
56
cat >expect <<EOF
57
-$ZERO_OID $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
57
+$ZERO_OID $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from main
58
EOF
59
test_expect_success 'git branch --create-reflog d/e/f should create a branch and a log' '
60
GIT_COMMITTER_DATE="2005-05-26 23:30" \
@@ -113,7 +113,7 @@ test_expect_success 'git branch -m n/n n should work' '
113
114
test_expect_success 'git branch -m bbb should rename checked out branch' '
115
test_when_finished git branch -D bbb &&
116
- test_when_finished git checkout master &&
116
+ test_when_finished git checkout main &&
117
git checkout -b aaa &&
118
git commit --allow-empty -m "a new commit" &&
119
git rev-parse aaa@{0} >expect &&
@@ -127,7 +127,7 @@ test_expect_success 'git branch -m bbb should rename checked out branch' '
127
128
test_expect_success 'renaming checked out branch works with d/f conflict' '
129
test_when_finished "git branch -D foo/bar || git branch -D foo" &&
130
- test_when_finished git checkout master &&
130
+ test_when_finished git checkout main &&
131
git checkout -b foo &&
132
git branch -m foo/bar &&
133
git symbolic-ref HEAD >actual &&
@@ -188,7 +188,7 @@ test_expect_success 'git branch -M should leave orphaned HEAD alone' '
188
git checkout --orphan lonely &&
189
grep lonely .git/HEAD &&
190
test_path_is_missing .git/refs/head/lonely &&
191
- git branch -M master mistress &&
191
+ git branch -M main mistress &&
192
grep lonely .git/HEAD
193
)
194
'
@@ -204,7 +204,7 @@ test_expect_success 'resulting reflog can be shown by log -g' '
204
'
205
206
test_expect_success 'git branch -M baz bam should succeed when baz is checked out as linked working tree' '
207
- git checkout master &&
207
+ git checkout main &&
208
git worktree add -b baz bazdir &&
209
git worktree add -f bazdir2 baz &&
210
git branch -M baz bam &&
@@ -227,18 +227,18 @@ test_expect_success 'git branch -M baz bam should succeed within a worktree in w
227
git worktree prune
228
'
229
230
-test_expect_success 'git branch -M master should work when master is checked out' '
231
- git checkout master &&
232
- git branch -M master
230
+test_expect_success 'git branch -M main should work when main is checked out' '
231
+ git checkout main &&
232
+ git branch -M main
233
'
234
235
-test_expect_success 'git branch -M master master should work when master is checked out' '
236
- git checkout master &&
237
- git branch -M master master
235
+test_expect_success 'git branch -M main main should work when main is checked out' '
236
+ git checkout main &&
237
+ git branch -M main main
238
'
239
240
-test_expect_success 'git branch -M topic topic should work when master is checked out' '
241
- git checkout master &&
240
+test_expect_success 'git branch -M topic topic should work when main is checked out' '
241
+ git checkout main &&
242
git branch topic &&
243
git branch -M topic topic
244
'
@@ -295,8 +295,8 @@ test_expect_success 'bare main worktree has HEAD at branch deleted by secondary
295
git init nonbare &&
296
test_commit -C nonbare x &&
297
git clone --bare nonbare bare &&
298
- git -C bare worktree add --detach ../secondary master &&
299
- git -C secondary branch -D master
298
+ git -C bare worktree add --detach ../secondary main &&
299
+ git -C secondary branch -D main
300
'
301
302
test_expect_success 'git branch --list -v with --abbrev' '
@@ -348,7 +348,7 @@ test_expect_success 'git branch --column with an extremely long branch name' '
348
j/k
349
l
350
m/m
351
-* master
351
+* main
352
mb
353
n
354
o/o
@@ -391,7 +391,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH 'git branch -v with column.ui ignore
391
j/k
392
l
393
m/m
394
-* master
394
+* main
395
mb
396
n
397
o/o
@@ -430,8 +430,8 @@ test_expect_success 'config information was renamed, too' '
430
'
431
432
test_expect_success 'git branch -m correctly renames multiple config sections' '
433
- test_when_finished "git checkout master" &&
434
- git checkout -b source master &&
433
+ test_when_finished "git checkout main" &&
434
+ git checkout -b source main &&
435
436
# Assert that a config file with multiple config sections has
437
# those sections preserved...
@@ -590,18 +590,18 @@ test_expect_success 'git branch -C c1 c2 should never touch HEAD' '
590
! grep "$msg$" .git/logs/HEAD
591
'
592
593
-test_expect_success 'git branch -C master should work when master is checked out' '
594
- git checkout master &&
595
- git branch -C master
593
+test_expect_success 'git branch -C main should work when main is checked out' '
594
+ git checkout main &&
595
+ git branch -C main
596
'
597
598
-test_expect_success 'git branch -C master master should work when master is checked out' '
599
- git checkout master &&
600
- git branch -C master master
598
+test_expect_success 'git branch -C main main should work when main is checked out' '
599
+ git checkout main &&
600
+ git branch -C main main
601
'
602
603
-test_expect_success 'git branch -C main5 main5 should work when master is checked out' '
604
- git checkout master &&
603
+test_expect_success 'git branch -C main5 main5 should work when main is checked out' '
604
+ git checkout main &&
605
git branch main5 &&
606
git branch -C main5 main5
607
'
@@ -623,8 +623,8 @@ test_expect_success 'git branch -C ab cd should overwrite existing config for cd
623
test_expect_success 'git branch -c correctly copies multiple config sections' '
624
FOO=1 &&
625
export FOO &&
626
- test_when_finished "git checkout master" &&
627
- git checkout -b source2 master &&
626
+ test_when_finished "git checkout main" &&
627
+ git checkout -b source2 main &&
628
629
# Assert that a config file with multiple config sections has
630
# those sections preserved...
@@ -714,10 +714,10 @@ test_expect_success 'deleting a self-referential symref' '
714
'
715
716
test_expect_success 'renaming a symref is not allowed' '
717
- git symbolic-ref refs/heads/topic refs/heads/master &&
717
+ git symbolic-ref refs/heads/topic refs/heads/main &&
718
test_must_fail git branch -m topic new-topic &&
719
git symbolic-ref refs/heads/topic &&
720
- test_path_is_file .git/refs/heads/master &&
720
+ test_path_is_file .git/refs/heads/main &&
721
test_path_is_missing .git/refs/heads/new-topic
722
'
723
@@ -731,27 +731,27 @@ test_expect_success SYMLINKS 'git branch -m u v should fail when the reflog for
731
test_expect_success 'test tracking setup via --track' '
732
git config remote.local.url . &&
733
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
734
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
735
- git branch --track my1 local/master &&
734
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
735
+ git branch --track my1 local/main &&
736
test $(git config branch.my1.remote) = local &&
737
- test $(git config branch.my1.merge) = refs/heads/master
737
+ test $(git config branch.my1.merge) = refs/heads/main
738
'
739
740
test_expect_success 'test tracking setup (non-wildcard, matching)' '
741
git config remote.local.url . &&
742
- git config remote.local.fetch refs/heads/master:refs/remotes/local/master &&
743
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
744
- git branch --track my4 local/master &&
742
+ git config remote.local.fetch refs/heads/main:refs/remotes/local/main &&
743
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
744
+ git branch --track my4 local/main &&
745
test $(git config branch.my4.remote) = local &&
746
- test $(git config branch.my4.merge) = refs/heads/master
746
+ test $(git config branch.my4.merge) = refs/heads/main
747
'
748
749
test_expect_success 'tracking setup fails on non-matching refspec' '
750
git config remote.local.url . &&
751
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
752
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
752
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
753
git config remote.local.fetch refs/heads/s:refs/remotes/local/s &&
754
- test_must_fail git branch --track my5 local/master &&
754
+ test_must_fail git branch --track my5 local/main &&
755
test_must_fail git config branch.my5.remote &&
756
test_must_fail git config branch.my5.merge
757
'
@@ -760,21 +760,21 @@ test_expect_success 'test tracking setup via config' '
760
git config branch.autosetupmerge true &&
761
git config remote.local.url . &&
762
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
763
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
764
- git branch my3 local/master &&
763
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
764
+ git branch my3 local/main &&
765
test $(git config branch.my3.remote) = local &&
766
- test $(git config branch.my3.merge) = refs/heads/master
766
+ test $(git config branch.my3.merge) = refs/heads/main
767
'
768
769
test_expect_success 'test overriding tracking setup via --no-track' '
770
git config branch.autosetupmerge true &&
771
git config remote.local.url . &&
772
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
773
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
774
- git branch --no-track my2 local/master &&
773
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
774
+ git branch --no-track my2 local/main &&
775
git config branch.autosetupmerge false &&
776
! test "$(git config branch.my2.remote)" = local &&
777
- ! test "$(git config branch.my2.merge)" = refs/heads/master
777
+ ! test "$(git config branch.my2.merge)" = refs/heads/main
778
'
779
780
test_expect_success 'no tracking without .fetch entries' '
@@ -839,26 +839,26 @@ test_expect_success 'branch from tag w/--track causes failure' '
839
840
test_expect_success '--set-upstream-to fails on multiple branches' '
841
echo "fatal: too many arguments to set new upstream" >expect &&
842
- test_must_fail git branch --set-upstream-to master a b c 2>err &&
842
+ test_must_fail git branch --set-upstream-to main a b c 2>err &&
843
test_i18ncmp expect err
844
'
845
846
test_expect_success '--set-upstream-to fails on detached HEAD' '
847
git checkout HEAD^{} &&
848
test_when_finished git checkout - &&
849
- echo "fatal: could not set upstream of HEAD to master when it does not point to any branch." >expect &&
850
- test_must_fail git branch --set-upstream-to master 2>err &&
849
+ echo "fatal: could not set upstream of HEAD to main when it does not point to any branch." >expect &&
850
+ test_must_fail git branch --set-upstream-to main 2>err &&
851
test_i18ncmp expect err
852
'
853
854
test_expect_success '--set-upstream-to fails on a missing dst branch' '
855
echo "fatal: branch '"'"'does-not-exist'"'"' does not exist" >expect &&
856
- test_must_fail git branch --set-upstream-to master does-not-exist 2>err &&
856
+ test_must_fail git branch --set-upstream-to main does-not-exist 2>err &&
857
test_i18ncmp expect err
858
'
859
860
test_expect_success '--set-upstream-to fails on a missing src branch' '
861
- test_must_fail git branch --set-upstream-to does-not-exist master 2>err &&
861
+ test_must_fail git branch --set-upstream-to does-not-exist main 2>err &&
862
test_i18ngrep "the requested upstream branch '"'"'does-not-exist'"'"' does not exist" err
863
'
864
@@ -877,20 +877,20 @@ test_expect_success '--set-upstream-to fails on locked config' '
877
'
878
879
test_expect_success 'use --set-upstream-to modify HEAD' '
880
- test_config branch.master.remote foo &&
881
- test_config branch.master.merge foo &&
880
+ test_config branch.main.remote foo &&
881
+ test_config branch.main.merge foo &&
882
git branch my12 &&
883
git branch --set-upstream-to my12 &&
884
- test "$(git config branch.master.remote)" = "." &&
885
- test "$(git config branch.master.merge)" = "refs/heads/my12"
884
+ test "$(git config branch.main.remote)" = "." &&
885
+ test "$(git config branch.main.merge)" = "refs/heads/my12"
886
'
887
888
test_expect_success 'use --set-upstream-to modify a particular branch' '
889
git branch my13 &&
890
- git branch --set-upstream-to master my13 &&
890
+ git branch --set-upstream-to main my13 &&
891
test_when_finished "git branch --unset-upstream my13" &&
892
test "$(git config branch.my13.remote)" = "." &&
893
- test "$(git config branch.my13.merge)" = "refs/heads/master"
893
+ test "$(git config branch.my13.merge)" = "refs/heads/main"
894
'
895
896
test_expect_success '--unset-upstream should fail if given a non-existent branch' '
@@ -909,14 +909,14 @@ test_expect_success '--unset-upstream should fail if config is locked' '
909
910
test_expect_success 'test --unset-upstream on HEAD' '
911
git branch my14 &&
912
- test_config branch.master.remote foo &&
913
- test_config branch.master.merge foo &&
912
+ test_config branch.main.remote foo &&
913
+ test_config branch.main.merge foo &&
914
git branch --set-upstream-to my14 &&
915
git branch --unset-upstream &&
916
- test_must_fail git config branch.master.remote &&
917
- test_must_fail git config branch.master.merge &&
916
+ test_must_fail git config branch.main.remote &&
917
+ test_must_fail git config branch.main.merge &&
918
# fail for a branch without upstream set
919
- echo "fatal: Branch '"'"'master'"'"' has no upstream information" >expect &&
919
+ echo "fatal: Branch '"'"'main'"'"' has no upstream information" >expect &&
920
test_must_fail git branch --unset-upstream 2>err &&
921
test_i18ncmp expect err
922
'
@@ -937,14 +937,14 @@ test_expect_success '--unset-upstream should fail on detached HEAD' '
937
938
test_expect_success 'test --unset-upstream on a particular branch' '
939
git branch my15 &&
940
- git branch --set-upstream-to master my14 &&
940
+ git branch --set-upstream-to main my14 &&
941
git branch --unset-upstream my14 &&
942
test_must_fail git config branch.my14.remote &&
943
test_must_fail git config branch.my14.merge
944
'
945
946
test_expect_success 'disabled option --set-upstream fails' '
947
- test_must_fail git branch --set-upstream origin/master
947
+ test_must_fail git branch --set-upstream origin/main
948
'
949
950
test_expect_success '--set-upstream-to notices an error to set branch as own upstream' '
@@ -959,32 +959,32 @@ test_expect_success '--set-upstream-to notices an error to set branch as own ups
959
960
# Keep this test last, as it changes the current branch
961
cat >expect <<EOF
962
-$ZERO_OID $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
962
+$ZERO_OID $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from main
963
EOF
964
test_expect_success 'git checkout -b g/h/i -l should create a branch and a log' '
965
GIT_COMMITTER_DATE="2005-05-26 23:30" \
966
- git checkout -b g/h/i -l master &&
966
+ git checkout -b g/h/i -l main &&
967
test_path_is_file .git/refs/heads/g/h/i &&
968
test_path_is_file .git/logs/refs/heads/g/h/i &&
969
test_cmp expect .git/logs/refs/heads/g/h/i
970
'
971
972
test_expect_success 'checkout -b makes reflog by default' '
973
- git checkout master &&
973
+ git checkout main &&
974
git config --unset core.logAllRefUpdates &&
975
git checkout -b alpha &&
976
git rev-parse --verify alpha@{0}
977
'
978
979
test_expect_success 'checkout -b does not make reflog when core.logAllRefUpdates = false' '
980
- git checkout master &&
980
+ git checkout main &&
981
git config core.logAllRefUpdates false &&
982
git checkout -b beta &&
983
test_must_fail git rev-parse --verify beta@{0}
984
'
985
986
test_expect_success 'checkout -b with -l makes reflog when core.logAllRefUpdates = false' '
987
- git checkout master &&
987
+ git checkout main &&
988
git checkout -lb gamma &&
989
git config --unset core.logAllRefUpdates &&
990
git rev-parse --verify gamma@{0}
@@ -993,10 +993,10 @@ test_expect_success 'checkout -b with -l makes reflog when core.logAllRefUpdates
993
test_expect_success 'avoid ambiguous track' '
994
git config branch.autosetupmerge true &&
995
git config remote.ambi1.url lalala &&
996
- git config remote.ambi1.fetch refs/heads/lalala:refs/heads/master &&
996
+ git config remote.ambi1.fetch refs/heads/lalala:refs/heads/main &&
997
git config remote.ambi2.url lilili &&
998
- git config remote.ambi2.fetch refs/heads/lilili:refs/heads/master &&
999
- test_must_fail git branch all1 master &&
998
+ git config remote.ambi2.fetch refs/heads/lilili:refs/heads/main &&
999
+ test_must_fail git branch all1 main &&
1000
test -z "$(git config branch.all1.merge)"
1001
'
1002
@@ -1052,10 +1052,10 @@ test_expect_success 'autosetuprebase local on a tracked remote branch' '
1052
git config remote.local.url . &&
1053
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
1054
git config branch.autosetuprebase local &&
1055
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
1056
- git branch --track myr5 local/master &&
1055
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
1056
+ git branch --track myr5 local/main &&
1057
test "$(git config branch.myr5.remote)" = local &&
1058
- test "$(git config branch.myr5.merge)" = refs/heads/master &&
1058
+ test "$(git config branch.myr5.merge)" = refs/heads/main &&
1059
! test "$(git config branch.myr5.rebase)" = true
1060
'
1061
@@ -1063,10 +1063,10 @@ test_expect_success 'autosetuprebase never on a tracked remote branch' '
1063
git config remote.local.url . &&
1064
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
1065
git config branch.autosetuprebase never &&
1066
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
1067
- git branch --track myr6 local/master &&
1066
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
1067
+ git branch --track myr6 local/main &&
1068
test "$(git config branch.myr6.remote)" = local &&
1069
- test "$(git config branch.myr6.merge)" = refs/heads/master &&
1069
+ test "$(git config branch.myr6.merge)" = refs/heads/main &&
1070
! test "$(git config branch.myr6.rebase)" = true
1071
'
1072
@@ -1074,10 +1074,10 @@ test_expect_success 'autosetuprebase remote on a tracked remote branch' '
1074
git config remote.local.url . &&
1075
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
1076
git config branch.autosetuprebase remote &&
1077
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
1078
- git branch --track myr7 local/master &&
1077
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
1078
+ git branch --track myr7 local/main &&
1079
test "$(git config branch.myr7.remote)" = local &&
1080
- test "$(git config branch.myr7.merge)" = refs/heads/master &&
1080
+ test "$(git config branch.myr7.merge)" = refs/heads/main &&
1081
test "$(git config branch.myr7.rebase)" = true
1082
'
1083
@@ -1085,10 +1085,10 @@ test_expect_success 'autosetuprebase always on a tracked remote branch' '
1085
git config remote.local.url . &&
1086
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
1087
git config branch.autosetuprebase remote &&
1088
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
1089
- git branch --track myr8 local/master &&
1088
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
1089
+ git branch --track myr8 local/main &&
1090
test "$(git config branch.myr8.remote)" = local &&
1091
- test "$(git config branch.myr8.merge)" = refs/heads/master &&
1091
+ test "$(git config branch.myr8.merge)" = refs/heads/main &&
1092
test "$(git config branch.myr8.rebase)" = true
1093
'
1094
@@ -1096,10 +1096,10 @@ test_expect_success 'autosetuprebase unconfigured on a tracked remote branch' '
1096
git config --unset branch.autosetuprebase &&
1097
git config remote.local.url . &&
1098
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
1099
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
1100
- git branch --track myr9 local/master &&
1099
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
1100
+ git branch --track myr9 local/main &&
1101
test "$(git config branch.myr9.remote)" = local &&
1102
- test "$(git config branch.myr9.merge)" = refs/heads/master &&
1102
+ test "$(git config branch.myr9.merge)" = refs/heads/main &&
1103
test "z$(git config branch.myr9.rebase)" = z
1104
'
1105
@@ -1117,7 +1117,7 @@ test_expect_success 'autosetuprebase unconfigured on a tracked local branch' '
1117
test_expect_success 'autosetuprebase unconfigured on untracked local branch' '
1118
git config remote.local.url . &&
1119
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
1120
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
1120
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
1121
git branch --no-track myr11 mybase2 &&
1122
test "z$(git config branch.myr11.remote)" = z &&
1123
test "z$(git config branch.myr11.merge)" = z &&
@@ -1127,8 +1127,8 @@ test_expect_success 'autosetuprebase unconfigured on untracked local branch' '
1127
test_expect_success 'autosetuprebase unconfigured on untracked remote branch' '
1128
git config remote.local.url . &&
1129
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
1130
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
1131
- git branch --no-track myr12 local/master &&
1130
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
1131
+ git branch --no-track myr12 local/main &&
1132
test "z$(git config branch.myr12.remote)" = z &&
1133
test "z$(git config branch.myr12.merge)" = z &&
1134
test "z$(git config branch.myr12.rebase)" = z
@@ -1138,7 +1138,7 @@ test_expect_success 'autosetuprebase never on an untracked local branch' '
1138
git config branch.autosetuprebase never &&
1139
git config remote.local.url . &&
1140
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
1141
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
1141
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
1142
git branch --no-track myr13 mybase2 &&
1143
test "z$(git config branch.myr13.remote)" = z &&
1144
test "z$(git config branch.myr13.merge)" = z &&
@@ -1149,7 +1149,7 @@ test_expect_success 'autosetuprebase local on an untracked local branch' '
1149
git config branch.autosetuprebase local &&
1150
git config remote.local.url . &&
1151
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
1152
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
1152
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
1153
git branch --no-track myr14 mybase2 &&
1154
test "z$(git config branch.myr14.remote)" = z &&
1155
test "z$(git config branch.myr14.merge)" = z &&
@@ -1160,7 +1160,7 @@ test_expect_success 'autosetuprebase remote on an untracked local branch' '
1160
git config branch.autosetuprebase remote &&
1161
git config remote.local.url . &&
1162
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
1163
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
1163
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
1164
git branch --no-track myr15 mybase2 &&
1165
test "z$(git config branch.myr15.remote)" = z &&
1166
test "z$(git config branch.myr15.merge)" = z &&
@@ -1171,7 +1171,7 @@ test_expect_success 'autosetuprebase always on an untracked local branch' '
1171
git config branch.autosetuprebase always &&
1172
git config remote.local.url . &&
1173
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
1174
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
1174
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
1175
git branch --no-track myr16 mybase2 &&
1176
test "z$(git config branch.myr16.remote)" = z &&
1177
test "z$(git config branch.myr16.merge)" = z &&
@@ -1182,8 +1182,8 @@ test_expect_success 'autosetuprebase never on an untracked remote branch' '
1182
git config branch.autosetuprebase never &&
1183
git config remote.local.url . &&
1184
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
1185
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
1186
- git branch --no-track myr17 local/master &&
1185
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
1186
+ git branch --no-track myr17 local/main &&
1187
test "z$(git config branch.myr17.remote)" = z &&
1188
test "z$(git config branch.myr17.merge)" = z &&
1189
test "z$(git config branch.myr17.rebase)" = z
@@ -1193,8 +1193,8 @@ test_expect_success 'autosetuprebase local on an untracked remote branch' '
1193
git config branch.autosetuprebase local &&
1194
git config remote.local.url . &&
1195
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
1196
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
1197
- git branch --no-track myr18 local/master &&
1196
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
1197
+ git branch --no-track myr18 local/main &&
1198
test "z$(git config branch.myr18.remote)" = z &&
1199
test "z$(git config branch.myr18.merge)" = z &&
1200
test "z$(git config branch.myr18.rebase)" = z
@@ -1204,8 +1204,8 @@ test_expect_success 'autosetuprebase remote on an untracked remote branch' '
1204
git config branch.autosetuprebase remote &&
1205
git config remote.local.url . &&
1206
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
1207
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
1208
- git branch --no-track myr19 local/master &&
1207
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
1208
+ git branch --no-track myr19 local/main &&
1209
test "z$(git config branch.myr19.remote)" = z &&
1210
test "z$(git config branch.myr19.merge)" = z &&
1211
test "z$(git config branch.myr19.rebase)" = z
@@ -1215,8 +1215,8 @@ test_expect_success 'autosetuprebase always on an untracked remote branch' '
1215
git config branch.autosetuprebase always &&
1216
git config remote.local.url . &&
1217
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
1218
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
1219
- git branch --no-track myr20 local/master &&
1218
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
1219
+ git branch --no-track myr20 local/main &&
1220
test "z$(git config branch.myr20.remote)" = z &&
1221
test "z$(git config branch.myr20.merge)" = z &&
1222
test "z$(git config branch.myr20.rebase)" = z
@@ -1224,7 +1224,7 @@ test_expect_success 'autosetuprebase always on an untracked remote branch' '
1224
1225
test_expect_success 'autosetuprebase always on detached HEAD' '
1226
git config branch.autosetupmerge always &&
1227
- test_when_finished git checkout master &&
1227
+ test_when_finished git checkout main &&
1228
git checkout HEAD^0 &&
1229
git branch my11 &&
1230
test -z "$(git config branch.my11.remote)" &&
@@ -1252,18 +1252,18 @@ test_expect_success 'attempt to delete a branch without base and unmerged to HEA
1252
test_expect_success 'attempt to delete a branch merged to its base' '
1253
# we are on my9 which is the initial commit; traditionally
1254
# we would not have allowed deleting my8 that is not merged
1255
- # to my9, but it is set to track master that already has my8
1256
- git config branch.my8.merge refs/heads/master &&
1255
+ # to my9, but it is set to track main that already has my8
1256
+ git config branch.my8.merge refs/heads/main &&
1257
git branch -d my8
1258
'
1259
1260
test_expect_success 'attempt to delete a branch merged to its base' '
1261
- git checkout master &&
1261
+ git checkout main &&
1262
echo Third >>A &&
1263
git commit -m "Third commit" A &&
1264
git branch -t my10 my9 &&
1265
git branch -f my10 HEAD^ &&
1266
- # we are on master which is at the third commit, and my10
1266
+ # we are on main which is at the third commit, and my10
1267
# is behind us, so traditionally we would have allowed deleting
1268
# it; but my10 is set to track my9 that is further behind.
1269
test_must_fail git branch -d my10
@@ -1290,7 +1290,7 @@ test_expect_success 'detect typo in branch name when using --edit-description' '
1290
'
1291
1292
test_expect_success 'refuse --edit-description on unborn branch for now' '
1293
- test_when_finished "git checkout master" &&
1293
+ test_when_finished "git checkout main" &&
1294
write_script editor <<-\EOF &&
1295
echo "New contents" >"$1"
1296
EOF
@@ -1304,18 +1304,18 @@ test_expect_success '--merged catches invalid object names' '
1304
1305
test_expect_success '--list during rebase' '
1306
test_when_finished "reset_rebase" &&
1307
- git checkout master &&
1307
+ git checkout main &&
1308
FAKE_LINES="1 edit 2" &&
1309
export FAKE_LINES &&
1310
set_fake_editor &&
1311
git rebase -i HEAD~2 &&
1312
git branch --list >actual &&
1313
- test_i18ngrep "rebasing master" actual
1313
+ test_i18ngrep "rebasing main" actual
1314
'
1315
1316
test_expect_success '--list during rebase from detached HEAD' '
1317
- test_when_finished "reset_rebase && git checkout master" &&
1318
- git checkout master^0 &&
1317
+ test_when_finished "reset_rebase && git checkout main" &&
1318
+ git checkout main^0 &&
1319
oid=$(git rev-parse --short HEAD) &&
1320
FAKE_LINES="1 edit 2" &&
1321
export FAKE_LINES &&
@@ -1351,11 +1351,11 @@ test_expect_success 'tracking with unexpected .fetch refspec' '
1351
git remote add c ../c &&
1352
git config remote.c.fetch "+refs/remotes/*:refs/remotes/*" &&
1353
git fetch c &&
1354
- git branch --track local/a/master remotes/a/master &&
1355
- test "$(git config branch.local/a/master.remote)" = "c" &&
1356
- test "$(git config branch.local/a/master.merge)" = "refs/remotes/a/master" &&
1354
+ git branch --track local/a/main remotes/a/main &&
1355
+ test "$(git config branch.local/a/main.remote)" = "c" &&
1356
+ test "$(git config branch.local/a/main.merge)" = "refs/remotes/a/main" &&
1357
git rev-parse --verify a >expect &&
1358
- git rev-parse --verify local/a/master >actual &&
1358
+ git rev-parse --verify local/a/main >actual &&
1359
test_cmp expect actual
1360
)
1361
'
@@ -1374,7 +1374,7 @@ test_expect_success 'configured committerdate sort' '
1374
test_commit b &&
1375
git branch >actual &&
1376
cat >expect <<-\EOF &&
1377
- master
1377
+ main
1378
a
1379
c
1380
* b
@@ -1392,7 +1392,7 @@ test_expect_success 'option override configured sort' '
1392
a
1393
* b
1394
c
1395
- master
1395
+ main
1396
EOF
1397
test_cmp expect actual
1398
)
t/t3201-branch-contains.sh
+41
-41
@@ -2,7 +2,7 @@
2
3
test_description='branch --contains <commit>, --no-contains <commit> --merged, and --no-merged'
4
5
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
5
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8
. ./test-lib.sh
@@ -17,47 +17,47 @@ test_expect_success setup '
17
18
echo 1 >file &&
19
test_tick &&
20
- git commit -a -m "second on master" &&
20
+ git commit -a -m "second on main" &&
21
22
git checkout side &&
23
echo 1 >file &&
24
test_tick &&
25
git commit -a -m "second on side" &&
26
27
- git merge master
27
+ git merge main
28
29
'
30
31
-test_expect_success 'branch --contains=master' '
31
+test_expect_success 'branch --contains=main' '
32
33
- git branch --contains=master >actual &&
33
+ git branch --contains=main >actual &&
34
{
35
- echo " master" && echo "* side"
35
+ echo " main" && echo "* side"
36
} >expect &&
37
test_cmp expect actual
38
39
'
40
41
-test_expect_success 'branch --contains master' '
41
+test_expect_success 'branch --contains main' '
42
43
- git branch --contains master >actual &&
43
+ git branch --contains main >actual &&
44
{
45
- echo " master" && echo "* side"
45
+ echo " main" && echo "* side"
46
} >expect &&
47
test_cmp expect actual
48
49
'
50
51
-test_expect_success 'branch --no-contains=master' '
51
+test_expect_success 'branch --no-contains=main' '
52
53
- git branch --no-contains=master >actual &&
53
+ git branch --no-contains=main >actual &&
54
test_must_be_empty actual
55
56
'
57
58
-test_expect_success 'branch --no-contains master' '
58
+test_expect_success 'branch --no-contains main' '
59
60
- git branch --no-contains master >actual &&
60
+ git branch --no-contains main >actual &&
61
test_must_be_empty actual
62
63
'
@@ -76,7 +76,7 @@ test_expect_success 'branch --no-contains=side' '
76
77
git branch --no-contains=side >actual &&
78
{
79
- echo " master"
79
+ echo " main"
80
} >expect &&
81
test_cmp expect actual
82
@@ -84,9 +84,9 @@ test_expect_success 'branch --no-contains=side' '
84
85
test_expect_success 'branch --contains with pattern implies --list' '
86
87
- git branch --contains=master master >actual &&
87
+ git branch --contains=main main >actual &&
88
{
89
- echo " master"
89
+ echo " main"
90
} >expect &&
91
test_cmp expect actual
92
@@ -94,7 +94,7 @@ test_expect_success 'branch --contains with pattern implies --list' '
94
95
test_expect_success 'branch --no-contains with pattern implies --list' '
96
97
- git branch --no-contains=master master >actual &&
97
+ git branch --no-contains=main main >actual &&
98
test_must_be_empty actual
99
100
'
@@ -103,7 +103,7 @@ test_expect_success 'side: branch --merged' '
103
104
git branch --merged >actual &&
105
{
106
- echo " master" &&
106
+ echo " main" &&
107
echo "* side"
108
} >expect &&
109
test_cmp expect actual
@@ -112,9 +112,9 @@ test_expect_success 'side: branch --merged' '
112
113
test_expect_success 'branch --merged with pattern implies --list' '
114
115
- git branch --merged=side master >actual &&
115
+ git branch --merged=side main >actual &&
116
{
117
- echo " master"
117
+ echo " main"
118
} >expect &&
119
test_cmp expect actual
120
@@ -127,18 +127,18 @@ test_expect_success 'side: branch --no-merged' '
127
128
'
129
130
-test_expect_success 'master: branch --merged' '
130
+test_expect_success 'main: branch --merged' '
131
132
- git checkout master &&
132
+ git checkout main &&
133
git branch --merged >actual &&
134
{
135
- echo "* master"
135
+ echo "* main"
136
} >expect &&
137
test_cmp expect actual
138
139
'
140
141
-test_expect_success 'master: branch --no-merged' '
141
+test_expect_success 'main: branch --no-merged' '
142
143
git branch --no-merged >actual &&
144
{
@@ -150,22 +150,22 @@ test_expect_success 'master: branch --no-merged' '
150
151
test_expect_success 'branch --no-merged with pattern implies --list' '
152
153
- git branch --no-merged=master master >actual &&
153
+ git branch --no-merged=main main >actual &&
154
test_must_be_empty actual
155
156
'
157
158
test_expect_success 'implicit --list conflicts with modification options' '
159
160
- test_must_fail git branch --contains=master -d &&
161
- test_must_fail git branch --contains=master -m foo &&
162
- test_must_fail git branch --no-contains=master -d &&
163
- test_must_fail git branch --no-contains=master -m foo
160
+ test_must_fail git branch --contains=main -d &&
161
+ test_must_fail git branch --contains=main -m foo &&
162
+ test_must_fail git branch --no-contains=main -d &&
163
+ test_must_fail git branch --no-contains=main -m foo
164
165
'
166
167
test_expect_success 'Assert that --contains only works on commits, not trees & blobs' '
168
- test_must_fail git branch --contains master^{tree} &&
168
+ test_must_fail git branch --contains main^{tree} &&
169
blob=$(git hash-object -w --stdin <<-\EOF
170
Some blob
171
EOF
@@ -175,11 +175,11 @@ test_expect_success 'Assert that --contains only works on commits, not trees & b
175
'
176
177
test_expect_success 'multiple branch --contains' '
178
- git checkout -b side2 master &&
178
+ git checkout -b side2 main &&
179
>feature &&
180
git add feature &&
181
git commit -m "add feature" &&
182
- git checkout -b next master &&
182
+ git checkout -b next main &&
183
git merge side &&
184
git branch --contains side --contains side2 >actual &&
185
cat >expect <<-\EOF &&
@@ -191,9 +191,9 @@ test_expect_success 'multiple branch --contains' '
191
'
192
193
test_expect_success 'multiple branch --merged' '
194
- git branch --merged next --merged master >actual &&
194
+ git branch --merged next --merged main >actual &&
195
cat >expect <<-\EOF &&
196
- master
196
+ main
197
* next
198
side
199
EOF
@@ -203,13 +203,13 @@ test_expect_success 'multiple branch --merged' '
203
test_expect_success 'multiple branch --no-contains' '
204
git branch --no-contains side --no-contains side2 >actual &&
205
cat >expect <<-\EOF &&
206
- master
206
+ main
207
EOF
208
test_cmp expect actual
209
'
210
211
test_expect_success 'multiple branch --no-merged' '
212
- git branch --no-merged next --no-merged master >actual &&
212
+ git branch --no-merged next --no-merged main >actual &&
213
cat >expect <<-\EOF &&
214
side2
215
EOF
@@ -217,7 +217,7 @@ test_expect_success 'multiple branch --no-merged' '
217
'
218
219
test_expect_success 'branch --contains combined with --no-contains' '
220
- git checkout -b seen master &&
220
+ git checkout -b seen main &&
221
git merge side &&
222
git merge side2 &&
223
git branch --contains side --no-contains side2 >actual &&
@@ -242,17 +242,17 @@ test_expect_success 'branch --merged combined with --no-merged' '
242
# that the latter walk does not mess up our flag to see if it was
243
# merged).
244
#
245
-# Here "topic" tracks "master" with one extra commit, and "zzz" points to the
246
-# same tip as master The name "zzz" must come alphabetically after "topic"
245
+# Here "topic" tracks "main" with one extra commit, and "zzz" points to the
246
+# same tip as main The name "zzz" must come alphabetically after "topic"
247
# as we process them in that order.
248
test_expect_success PREPARE_FOR_MAIN_BRANCH 'branch --merged with --verbose' '
249
- git branch --track topic master &&
249
+ git branch --track topic main &&
250
git branch zzz topic &&
251
git checkout topic &&
252
test_commit foo &&
253
git branch --merged topic >actual &&
254
cat >expect <<-\EOF &&
255
- master
255
+ main
256
* topic
257
zzz
258
EOF
t/t3202-show-branch-octopus.sh
+2
-2
@@ -2,7 +2,7 @@
2
3
test_description='test show-branch with more than 8 heads'
4
5
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
5
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8
. ./test-lib.sh
@@ -18,7 +18,7 @@ test_expect_success 'setup' '
18
19
for i in $numbers
20
do
21
- git checkout -b branch$i master &&
21
+ git checkout -b branch$i main &&
22
> file$i &&
23
git add file$i &&
24
test_tick &&
t/t3203-branch-output.sh
+20
-20
@@ -1,7 +1,7 @@
1
#!/bin/sh
2
3
test_description='git branch display tests'
4
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
4
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
5
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
6
7
. ./test-lib.sh
@@ -29,7 +29,7 @@ test_expect_success 'make remote branches' '
29
cat >expect <<'EOF'
30
branch-one
31
branch-two
32
-* master
32
+* main
33
EOF
34
test_expect_success 'git branch shows local branches' '
35
git branch >actual &&
@@ -63,7 +63,7 @@ test_expect_success 'git branch -r shows remote branches' '
63
cat >expect <<'EOF'
64
branch-one
65
branch-two
66
-* master
66
+* main
67
remotes/origin/HEAD -> origin/branch-one
68
remotes/origin/branch-one
69
remotes/origin/branch-two
@@ -155,7 +155,7 @@ test_expect_success 'git branch shows detached HEAD properly' '
155
* (HEAD detached at $(git rev-parse --short HEAD^0))
156
branch-one
157
branch-two
158
- master
158
+ main
159
EOF
160
git checkout HEAD^0 &&
161
git branch >actual &&
@@ -163,12 +163,12 @@ EOF
163
'
164
165
test_expect_success 'git branch shows detached HEAD properly after checkout --detach' '
166
- git checkout master &&
166
+ git checkout main &&
167
cat >expect <<EOF &&
168
* (HEAD detached at $(git rev-parse --short HEAD^0))
169
branch-one
170
branch-two
171
- master
171
+ main
172
EOF
173
git checkout --detach &&
174
git branch >actual &&
@@ -180,7 +180,7 @@ test_expect_success 'git branch shows detached HEAD properly after moving' '
180
* (HEAD detached from $(git rev-parse --short HEAD))
181
branch-one
182
branch-two
183
- master
183
+ main
184
EOF
185
git reset --hard HEAD^1 &&
186
git branch >actual &&
@@ -192,9 +192,9 @@ test_expect_success 'git branch shows detached HEAD properly from tag' '
192
* (HEAD detached at fromtag)
193
branch-one
194
branch-two
195
- master
195
+ main
196
EOF
197
- git tag fromtag master &&
197
+ git tag fromtag main &&
198
git checkout fromtag &&
199
git branch >actual &&
200
test_i18ncmp expect actual
@@ -205,7 +205,7 @@ test_expect_success 'git branch shows detached HEAD properly after moving from t
205
* (HEAD detached from fromtag)
206
branch-one
207
branch-two
208
- master
208
+ main
209
EOF
210
git reset --hard HEAD^1 &&
211
git branch >actual &&
@@ -217,7 +217,7 @@ test_expect_success 'git branch `--sort` option' '
217
* (HEAD detached from fromtag)
218
branch-two
219
branch-one
220
- master
220
+ main
221
EOF
222
git branch --sort=objectsize >actual &&
223
test_i18ncmp expect actual
@@ -226,7 +226,7 @@ test_expect_success 'git branch `--sort` option' '
226
test_expect_success 'git branch --points-at option' '
227
cat >expect <<-\EOF &&
228
branch-one
229
- master
229
+ main
230
EOF
231
git branch --points-at=branch-one >actual &&
232
test_cmp expect actual
@@ -263,14 +263,14 @@ test_expect_success 'sort branches, ignore case' '
263
cat >expected <<-\EOF &&
264
BRANCH-two
265
branch-one
266
- master
266
+ main
267
EOF
268
test_cmp expected actual &&
269
git branch --list -i | awk "{print \$NF}" >actual &&
270
cat >expected <<-\EOF &&
271
branch-one
272
BRANCH-two
273
- master
273
+ main
274
EOF
275
test_cmp expected actual
276
)
@@ -282,7 +282,7 @@ test_expect_success 'git branch --format option' '
282
Refname is refs/heads/ambiguous
283
Refname is refs/heads/branch-one
284
Refname is refs/heads/branch-two
285
- Refname is refs/heads/master
285
+ Refname is refs/heads/main
286
Refname is refs/heads/ref-to-branch
287
Refname is refs/heads/ref-to-remote
288
EOF
@@ -296,7 +296,7 @@ test_expect_success 'worktree colors correct' '
296
ambiguous<RESET>
297
branch-one<RESET>
298
+ <CYAN>branch-two<RESET>
299
- master<RESET>
299
+ main<RESET>
300
ref-to-branch<RESET> -> branch-one
301
ref-to-remote<RESET> -> origin/branch-one
302
EOF
@@ -309,9 +309,9 @@ test_expect_success 'worktree colors correct' '
309
'
310
311
test_expect_success "set up color tests" '
312
- echo "<RED>master<RESET>" >expect.color &&
313
- echo "master" >expect.bare &&
314
- color_args="--format=%(color:red)%(refname:short) --list master"
312
+ echo "<RED>main<RESET>" >expect.color &&
313
+ echo "main" >expect.bare &&
314
+ color_args="--format=%(color:red)%(refname:short) --list main"
315
'
316
317
test_expect_success '%(color) omitted without tty' '
@@ -334,7 +334,7 @@ test_expect_success '--color overrides auto-color' '
334
335
test_expect_success PREPARE_FOR_MAIN_BRANCH 'verbose output lists worktree path' '
336
one=$(git rev-parse --short HEAD) &&
337
- two=$(git rev-parse --short master) &&
337
+ two=$(git rev-parse --short main) &&
338
cat >expect <<-EOF &&
339
* (HEAD detached from fromtag) $one one
340
ambiguous $one one
t/t3204-branch-name-interpretation.sh
+4
-4
@@ -6,7 +6,7 @@ Branch name arguments are usually names which are taken to be inside of
6
refs/heads/, but we interpret some magic syntax like @{-1}, @{upstream}, etc.
7
This script aims to check the behavior of those corner cases.
8
'
9
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
9
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
10
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
11
12
. ./test-lib.sh
@@ -31,7 +31,7 @@ test_expect_success 'update branch via @{-1}' '
31
git branch previous one &&
32
33
git checkout previous &&
34
- git checkout master &&
34
+ git checkout main &&
35
36
git branch -f @{-1} two &&
37
expect_branch previous two
@@ -61,7 +61,7 @@ test_expect_success 'delete branch via @{-1}' '
61
git branch previous-del &&
62
63
git checkout previous-del &&
64
- git checkout master &&
64
+ git checkout main &&
65
66
git branch -D @{-1} &&
67
expect_deleted previous-del
@@ -101,7 +101,7 @@ test_expect_success 'disallow deleting remote branch via @{-1}' '
101
git update-ref refs/remotes/origin/previous one &&
102
103
git checkout -b origin/previous two &&
104
- git checkout master &&
104
+ git checkout main &&
105
106
test_must_fail git branch -r -D @{-1} &&
107
expect_branch refs/remotes/origin/previous one &&
t/t3205-branch-color.sh
+4
-4
@@ -1,14 +1,14 @@
1
#!/bin/sh
2
3
test_description='basic branch output coloring'
4
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
4
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
5
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
6
7
. ./test-lib.sh
8
9
test_expect_success 'set up some sample branches' '
10
test_commit foo &&
11
- git update-ref refs/remotes/origin/master HEAD &&
11
+ git update-ref refs/remotes/origin/main HEAD &&
12
git update-ref refs/heads/other HEAD
13
'
14
@@ -22,9 +22,9 @@ test_expect_success 'set up some color config' '
22
23
test_expect_success 'regular output shows colors' '
24
cat >expect <<-\EOF &&
25
- * <CYAN>master<RESET>
25
+ * <CYAN>main<RESET>
26
<BLUE>other<RESET>
27
- <YELLOW>remotes/origin/master<RESET>
27
+ <YELLOW>remotes/origin/main<RESET>
28
EOF
29
git branch --color -a >actual.raw &&
30
test_decode_color <actual.raw >actual &&
t/t3206-range-diff.sh
+21
-21
@@ -2,7 +2,7 @@
2
3
test_description='range-diff tests'
4
5
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
5
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8
. ./test-lib.sh
@@ -130,7 +130,7 @@ test_expect_success 'setup' '
130
'
131
132
test_expect_success 'simple A..B A..C (unmodified)' '
133
- git range-diff --no-color master..topic master..unmodified \
133
+ git range-diff --no-color main..topic main..unmodified \
134
>actual &&
135
cat >expect <<-EOF &&
136
1: $(test_oid t1) = 1: $(test_oid u1) s/5/A/
@@ -148,13 +148,13 @@ test_expect_success 'simple B...C (unmodified)' '
148
'
149
150
test_expect_success 'simple A B C (unmodified)' '
151
- git range-diff --no-color master topic unmodified >actual &&
151
+ git range-diff --no-color main topic unmodified >actual &&
152
# same "expect" as above
153
test_cmp expect actual
154
'
155
156
test_expect_success 'trivial reordering' '
157
- git range-diff --no-color master topic reordered >actual &&
157
+ git range-diff --no-color main topic reordered >actual &&
158
cat >expect <<-EOF &&
159
1: $(test_oid t1) = 1: $(test_oid r1) s/5/A/
160
3: $(test_oid t3) = 2: $(test_oid r2) s/11/B/
@@ -165,7 +165,7 @@ test_expect_success 'trivial reordering' '
165
'
166
167
test_expect_success 'removed a commit' '
168
- git range-diff --no-color master topic removed >actual &&
168
+ git range-diff --no-color main topic removed >actual &&
169
cat >expect <<-EOF &&
170
1: $(test_oid t1) = 1: $(test_oid d1) s/5/A/
171
2: $(test_oid t2) < -: $(test_oid __) s/4/A/
@@ -176,7 +176,7 @@ test_expect_success 'removed a commit' '
176
'
177
178
test_expect_success 'added a commit' '
179
- git range-diff --no-color master topic added >actual &&
179
+ git range-diff --no-color main topic added >actual &&
180
cat >expect <<-EOF &&
181
1: $(test_oid t1) = 1: $(test_oid a1) s/5/A/
182
2: $(test_oid t2) = 2: $(test_oid a2) s/4/A/
@@ -188,7 +188,7 @@ test_expect_success 'added a commit' '
188
'
189
190
test_expect_success 'new base, A B C' '
191
- git range-diff --no-color master topic rebased >actual &&
191
+ git range-diff --no-color main topic rebased >actual &&
192
cat >expect <<-EOF &&
193
1: $(test_oid t1) = 1: $(test_oid b1) s/5/A/
194
2: $(test_oid t2) = 2: $(test_oid b2) s/4/A/
@@ -199,7 +199,7 @@ test_expect_success 'new base, A B C' '
199
'
200
201
test_expect_success 'new base, B...C' '
202
- # this syntax includes the commits from master!
202
+ # this syntax includes the commits from main!
203
git range-diff --no-color topic...rebased >actual &&
204
cat >expect <<-EOF &&
205
-: $(test_oid __) > 1: $(test_oid b5) unrelated
@@ -423,7 +423,7 @@ test_expect_success 'file added and later removed' '
423
424
test_expect_success 'no commits on one side' '
425
git commit --amend -m "new message" &&
426
- git range-diff master HEAD@{1} HEAD
426
+ git range-diff main HEAD@{1} HEAD
427
'
428
429
test_expect_success 'changed message' '
@@ -485,11 +485,11 @@ test_expect_success 'dual-coloring' '
485
test_cmp expect actual
486
'
487
488
-for prev in topic master..topic
488
+for prev in topic main..topic
489
do
490
test_expect_success "format-patch --range-diff=$prev" '
491
git format-patch --cover-letter --range-diff=$prev \
492
- master..unmodified >actual &&
492
+ main..unmodified >actual &&
493
test_when_finished "rm 000?-*" &&
494
test_line_count = 5 actual &&
495
test_i18ngrep "^Range-diff:$" 0000-* &&
@@ -514,19 +514,19 @@ test_expect_success 'range-diff overrides diff.noprefix internally' '
514
515
test_expect_success 'basic with modified format.pretty with suffix' '
516
git -c format.pretty="format:commit %H%d%n" range-diff \
517
- master..topic master..unmodified
517
+ main..topic main..unmodified
518
'
519
520
test_expect_success 'basic with modified format.pretty without "commit "' '
521
git -c format.pretty="format:%H%n" range-diff \
522
- master..topic master..unmodified
522
+ main..topic main..unmodified
523
'
524
525
test_expect_success 'range-diff compares notes by default' '
526
git notes add -m "topic note" topic &&
527
git notes add -m "unmodified note" unmodified &&
528
test_when_finished git notes remove topic unmodified &&
529
- git range-diff --no-color master..topic master..unmodified \
529
+ git range-diff --no-color main..topic main..unmodified \
530
>actual &&
531
sed s/Z/\ /g >expect <<-EOF &&
532
1: $(test_oid t1) = 1: $(test_oid u1) s/5/A/
@@ -550,7 +550,7 @@ test_expect_success 'range-diff with --no-notes' '
550
git notes add -m "topic note" topic &&
551
git notes add -m "unmodified note" unmodified &&
552
test_when_finished git notes remove topic unmodified &&
553
- git range-diff --no-color --no-notes master..topic master..unmodified \
553
+ git range-diff --no-color --no-notes main..topic main..unmodified \
554
>actual &&
555
cat >expect <<-EOF &&
556
1: $(test_oid t1) = 1: $(test_oid u1) s/5/A/
@@ -568,7 +568,7 @@ test_expect_success 'range-diff with multiple --notes' '
568
git notes --ref=note2 add -m "topic note2" topic &&
569
git notes --ref=note2 add -m "unmodified note2" unmodified &&
570
test_when_finished git notes --ref=note2 remove topic unmodified &&
571
- git range-diff --no-color --notes=note1 --notes=note2 master..topic master..unmodified \
571
+ git range-diff --no-color --notes=note1 --notes=note2 main..topic main..unmodified \
572
>actual &&
573
sed s/Z/\ /g >expect <<-EOF &&
574
1: $(test_oid t1) = 1: $(test_oid u1) s/5/A/
@@ -598,7 +598,7 @@ test_expect_success 'format-patch --range-diff does not compare notes by default
598
git notes add -m "unmodified note" unmodified &&
599
test_when_finished git notes remove topic unmodified &&
600
git format-patch --cover-letter --range-diff=$prev \
601
- master..unmodified >actual &&
601
+ main..unmodified >actual &&
602
test_when_finished "rm 000?-*" &&
603
test_line_count = 5 actual &&
604
test_i18ngrep "^Range-diff:$" 0000-* &&
@@ -615,7 +615,7 @@ test_expect_success 'format-patch --range-diff with --no-notes' '
615
git notes add -m "unmodified note" unmodified &&
616
test_when_finished git notes remove topic unmodified &&
617
git format-patch --no-notes --cover-letter --range-diff=$prev \
618
- master..unmodified >actual &&
618
+ main..unmodified >actual &&
619
test_when_finished "rm 000?-*" &&
620
test_line_count = 5 actual &&
621
test_i18ngrep "^Range-diff:$" 0000-* &&
@@ -632,7 +632,7 @@ test_expect_success 'format-patch --range-diff with --notes' '
632
git notes add -m "unmodified note" unmodified &&
633
test_when_finished git notes remove topic unmodified &&
634
git format-patch --notes --cover-letter --range-diff=$prev \
635
- master..unmodified >actual &&
635
+ main..unmodified >actual &&
636
test_when_finished "rm 000?-*" &&
637
test_line_count = 5 actual &&
638
test_i18ngrep "^Range-diff:$" 0000-* &&
@@ -661,7 +661,7 @@ test_expect_success 'format-patch --range-diff with format.notes config' '
661
test_when_finished git notes remove topic unmodified &&
662
test_config format.notes true &&
663
git format-patch --cover-letter --range-diff=$prev \
664
- master..unmodified >actual &&
664
+ main..unmodified >actual &&
665
test_when_finished "rm 000?-*" &&
666
test_line_count = 5 actual &&
667
test_i18ngrep "^Range-diff:$" 0000-* &&
@@ -692,7 +692,7 @@ test_expect_success 'format-patch --range-diff with multiple notes' '
692
git notes --ref=note2 add -m "unmodified note2" unmodified &&
693
test_when_finished git notes --ref=note2 remove topic unmodified &&
694
git format-patch --notes=note1 --notes=note2 --cover-letter --range-diff=$prev \
695
- master..unmodified >actual &&
695
+ main..unmodified >actual &&
696
test_when_finished "rm 000?-*" &&
697
test_line_count = 5 actual &&
698
test_i18ngrep "^Range-diff:$" 0000-* &&
t/t3206/history.export
+1
-1
@@ -168,7 +168,7 @@ mark :11
168
data 10
169
unrelated
170
171
-commit refs/heads/master
171
+commit refs/heads/main
172
mark :12
173
author Thomas Rast <trast@inf.ethz.ch> 1374485127 +0200
174
committer Thomas Rast <trast@inf.ethz.ch> 1374485127 +0200
t/t3210-pack-refs.sh
+3
-3
@@ -9,7 +9,7 @@ test_description='git pack-refs should not change the branch semantic
9
This test runs git pack-refs and git show-ref and checks that the branch
10
semantic is still the same.
11
'
12
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
12
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
13
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
14
15
. ./test-lib.sh
@@ -138,7 +138,7 @@ test_expect_success 'delete ref with dangling packed version' '
138
git commit --allow-empty -m "future garbage" &&
139
git pack-refs --all &&
140
git reset --hard HEAD^ &&
141
- git checkout master &&
141
+ git checkout main &&
142
git reflog expire --expire=all --all &&
143
git prune --expire=all &&
144
git branch -d lamb 2>result &&
@@ -243,7 +243,7 @@ test_expect_success 'retry acquiring packed-refs.lock' '
243
244
test_expect_success SYMLINKS 'pack symlinked packed-refs' '
245
# First make sure that symlinking works when reading:
246
- git update-ref refs/heads/lossy refs/heads/master &&
246
+ git update-ref refs/heads/lossy refs/heads/main &&
247
git for-each-ref >all-refs-before &&
248
mv .git/packed-refs .git/my-deviant-packed-refs &&
249
ln -s my-deviant-packed-refs .git/packed-refs &&
t/t3211-peel-ref.sh
+3
-3
@@ -1,7 +1,7 @@
1
#!/bin/sh
2
3
test_description='tests for the peel_ref optimization of packed-refs'
4
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
4
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
5
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
6
7
. ./test-lib.sh
@@ -22,7 +22,7 @@ print_ref() {
22
23
test_expect_success 'set up expected show-ref output' '
24
{
25
- print_ref "refs/heads/master" &&
25
+ print_ref "refs/heads/main" &&
26
print_ref "refs/outside/foo" &&
27
print_ref "refs/outside/foo^{}" &&
28
print_ref "refs/tags/base" &&
@@ -50,7 +50,7 @@ test_expect_success 'create old-style pack-refs without fully-peeled' '
50
# know we are emulating exactly what an older git would have written.
51
{
52
echo "# pack-refs with: peeled " &&
53
- print_ref "refs/heads/master" &&
53
+ print_ref "refs/heads/main" &&
54
print_ref "refs/outside/foo" &&
55
print_ref "refs/tags/base" &&
56
print_ref "refs/tags/foo" &&
t/t3301-notes.sh
+3
-3
@@ -1295,11 +1295,11 @@ test_expect_success 'git notes copy diagnoses too many or too few parameters' '
1295
test_i18ngrep "too many parameters" error
1296
'
1297
1298
-test_expect_success 'git notes get-ref expands refs/heads/master to refs/notes/refs/heads/master' '
1298
+test_expect_success 'git notes get-ref expands refs/heads/main to refs/notes/refs/heads/main' '
1299
test_unconfig core.notesRef &&
1300
sane_unset GIT_NOTES_REF &&
1301
- echo refs/notes/refs/heads/master >expect &&
1302
- git notes --ref=refs/heads/master get-ref >actual &&
1301
+ echo refs/notes/refs/heads/main >expect &&
1302
+ git notes --ref=refs/heads/main get-ref >actual &&
1303
test_cmp expect actual
1304
'
1305
t/t3302-notes-index-expensive.sh
+2
-2
@@ -5,7 +5,7 @@
5
6
test_description='Test commit notes index (expensive!)'
7
8
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
8
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
9
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
10
11
. ./test-lib.sh
@@ -23,7 +23,7 @@ create_repo () {
23
notemark=$(($mark+1))
24
test_tick &&
25
cat <<-INPUT_END &&
26
- commit refs/heads/master
26
+ commit refs/heads/main
27
mark :$mark
28
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
29
data <<COMMIT
t/t3303-notes-subtrees.sh
+5
-5
@@ -2,7 +2,7 @@
2
3
test_description='Test commit notes organized in subtrees'
4
5
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
5
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8
. ./test-lib.sh
@@ -43,7 +43,7 @@ test_expect_success "setup: create $number_of_commits commits" '
43
nr=$(($nr+1)) &&
44
test_tick &&
45
cat <<INPUT_END
46
-commit refs/heads/master
46
+commit refs/heads/main
47
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
48
data <<COMMIT
49
commit #$nr
@@ -78,7 +78,7 @@ test_sha1_based () {
78
(
79
start_note_commit &&
80
nr=$number_of_commits &&
81
- git rev-list refs/heads/master |
81
+ git rev-list refs/heads/main |
82
while read sha1; do
83
note_path=$(echo "$sha1" | sed "$1")
84
cat <<INPUT_END &&
@@ -108,7 +108,7 @@ test_same_notes () {
108
(
109
start_note_commit &&
110
nr=$number_of_commits &&
111
- git rev-list refs/heads/master |
111
+ git rev-list refs/heads/main |
112
while read sha1; do
113
first_note_path=$(echo "$sha1" | sed "$1")
114
second_note_path=$(echo "$sha1" | sed "$2")
@@ -147,7 +147,7 @@ test_concatenated_notes () {
147
(
148
start_note_commit &&
149
nr=$number_of_commits &&
150
- git rev-list refs/heads/master |
150
+ git rev-list refs/heads/main |
151
while read sha1; do
152
first_note_path=$(echo "$sha1" | sed "$1")
153
second_note_path=$(echo "$sha1" | sed "$2")
t/t3304-notes-mixed.sh
+5
-5
@@ -2,7 +2,7 @@
2
3
test_description='Test notes trees that also contain non-notes'
4
5
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
5
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8
. ./test-lib.sh
@@ -39,7 +39,7 @@ test_expect_success "setup: create a couple of commits" '
39
40
test_tick &&
41
cat <<INPUT_END >input &&
42
-commit refs/heads/master
42
+commit refs/heads/main
43
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
44
data <<COMMIT
45
commit #1
@@ -54,7 +54,7 @@ INPUT_END
54
55
test_tick &&
56
cat <<INPUT_END >>input &&
57
-commit refs/heads/master
57
+commit refs/heads/main
58
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
59
data <<COMMIT
60
commit #2
@@ -71,8 +71,8 @@ INPUT_END
71
72
test_expect_success "create a notes tree with both notes and non-notes" '
73
74
- commit1=$(git rev-parse refs/heads/master^) &&
75
- commit2=$(git rev-parse refs/heads/master) &&
74
+ commit1=$(git rev-parse refs/heads/main^) &&
75
+ commit2=$(git rev-parse refs/heads/main) &&
76
test_tick &&
77
cat <<INPUT_END >input &&
78
commit refs/notes/commits
t/t3308-notes-merge.sh
+1
-1
@@ -108,7 +108,7 @@ test_expect_success 'fail to merge into various non-notes refs' '
108
git update-ref refs/notes/dir/foo HEAD &&
109
test_must_fail git -c "core.notesRef=refs/notes/dir" notes merge x &&
110
test_must_fail git -c "core.notesRef=refs/notes/dir/" notes merge x &&
111
- test_must_fail git -c "core.notesRef=refs/heads/master" notes merge x &&
111
+ test_must_fail git -c "core.notesRef=refs/heads/main" notes merge x &&
112
test_must_fail git -c "core.notesRef=refs/notes/y:" notes merge x &&
113
test_must_fail git -c "core.notesRef=refs/notes/y:foo" notes merge x &&
114
test_must_fail git -c "core.notesRef=refs/notes/foo^{bar" notes merge x
t/t3320-notes-merge-worktrees.sh
+3
-3
@@ -5,7 +5,7 @@
5
6
test_description='Test merging of notes trees in multiple worktrees'
7
8
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
8
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
9
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
10
11
. ./test-lib.sh
@@ -39,8 +39,8 @@ test_expect_success 'modify notes ref ourselves (x)' '
39
'
40
41
test_expect_success 'create some new worktrees' '
42
- git worktree add -b newbranch worktree master &&
43
- git worktree add -b newbranch2 worktree2 master
42
+ git worktree add -b newbranch worktree main &&
43
+ git worktree add -b newbranch2 worktree2 main
44
'
45
46
test_expect_success 'merge z into y fails and sets NOTES_MERGE_REF' '