t9902: use `main` as initial branch name

In 8164360fc86 (t9902: prepare a test for the upcoming default branch name, 2020-10-23), we started adjusting this test script for the default initial branch name changing to `main`. However, there is no need to wait for that: let's adjust the test script to stop relying on a specific initial branch name by setting it explicitly. This allows us to drop the `PREPARE_FOR_MAIN_BRANCH` prereq from one test case. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Dec 17, 2020 at 01:07 UTC 0007618107627eb5bd616427132424e3bf9642bb
1 file changed +155 -154
t/t9902-completion.sh
+155 -154
@@ -136,7 +136,7 @@ fi
136 test_expect_success 'setup for __git_find_repo_path/__gitdir tests' '
137 mkdir -p subdir/subsubdir &&
138 mkdir -p non-repo &&
139 - git init otherrepo
139 + git init -b main otherrepo
140 '
141
142 test_expect_success '__git_find_repo_path - from command line (through $__git_dir)' '
@@ -614,12 +614,13 @@ test_expect_success '__git_is_configured_remote' '
614
615 test_expect_success 'setup for ref completion' '
616 git commit --allow-empty -m initial &&
617 + git branch -M main &&
618 git branch matching-branch &&
619 git tag matching-tag &&
620 (
621 cd otherrepo &&
622 git commit --allow-empty -m initial &&
622 - git branch -m master master-in-other &&
623 + git branch -m main main-in-other &&
624 git branch branch-in-other &&
625 git tag tag-in-other
626 ) &&
@@ -632,10 +633,10 @@ test_expect_success 'setup for ref completion' '
633 test_expect_success '__git_refs - simple' '
634 cat >expected <<-EOF &&
635 HEAD
635 - master
636 + main
637 matching-branch
638 other/branch-in-other
638 - other/master-in-other
639 + other/main-in-other
640 matching-tag
641 EOF
642 (
@@ -647,10 +648,10 @@ test_expect_success '__git_refs - simple' '
648
649 test_expect_success '__git_refs - full refs' '
650 cat >expected <<-EOF &&
650 - refs/heads/master
651 + refs/heads/main
652 refs/heads/matching-branch
653 refs/remotes/other/branch-in-other
653 - refs/remotes/other/master-in-other
654 + refs/remotes/other/main-in-other
655 refs/tags/matching-tag
656 EOF
657 (
@@ -664,7 +665,7 @@ test_expect_success '__git_refs - repo given on the command line' '
665 cat >expected <<-EOF &&
666 HEAD
667 branch-in-other
667 - master-in-other
668 + main-in-other
669 tag-in-other
670 EOF
671 (
@@ -679,7 +680,7 @@ test_expect_success '__git_refs - remote on local file system' '
680 cat >expected <<-EOF &&
681 HEAD
682 branch-in-other
682 - master-in-other
683 + main-in-other
684 tag-in-other
685 EOF
686 (
@@ -692,7 +693,7 @@ test_expect_success '__git_refs - remote on local file system' '
693 test_expect_success '__git_refs - remote on local file system - full refs' '
694 cat >expected <<-EOF &&
695 refs/heads/branch-in-other
695 - refs/heads/master-in-other
696 + refs/heads/main-in-other
697 refs/tags/tag-in-other
698 EOF
699 (
@@ -706,7 +707,7 @@ test_expect_success '__git_refs - configured remote' '
707 cat >expected <<-EOF &&
708 HEAD
709 branch-in-other
709 - master-in-other
710 + main-in-other
711 EOF
712 (
713 cur= &&
@@ -719,7 +720,7 @@ test_expect_success '__git_refs - configured remote - full refs' '
720 cat >expected <<-EOF &&
721 HEAD
722 refs/heads/branch-in-other
722 - refs/heads/master-in-other
723 + refs/heads/main-in-other
724 refs/tags/tag-in-other
725 EOF
726 (
@@ -733,7 +734,7 @@ test_expect_success '__git_refs - configured remote - repo given on the command
734 cat >expected <<-EOF &&
735 HEAD
736 branch-in-other
736 - master-in-other
737 + main-in-other
738 EOF
739 (
740 cd thirdrepo &&
@@ -748,7 +749,7 @@ test_expect_success '__git_refs - configured remote - full refs - repo given on
749 cat >expected <<-EOF &&
750 HEAD
751 refs/heads/branch-in-other
751 - refs/heads/master-in-other
752 + refs/heads/main-in-other
753 refs/tags/tag-in-other
754 EOF
755 (
@@ -764,7 +765,7 @@ test_expect_success '__git_refs - configured remote - remote name matches a dire
765 cat >expected <<-EOF &&
766 HEAD
767 branch-in-other
767 - master-in-other
768 + main-in-other
769 EOF
770 mkdir other &&
771 test_when_finished "rm -rf other" &&
@@ -779,7 +780,7 @@ test_expect_success '__git_refs - URL remote' '
780 cat >expected <<-EOF &&
781 HEAD
782 branch-in-other
782 - master-in-other
783 + main-in-other
784 tag-in-other
785 EOF
786 (
@@ -793,7 +794,7 @@ test_expect_success '__git_refs - URL remote - full refs' '
794 cat >expected <<-EOF &&
795 HEAD
796 refs/heads/branch-in-other
796 - refs/heads/master-in-other
797 + refs/heads/main-in-other
798 refs/tags/tag-in-other
799 EOF
800 (
@@ -849,23 +850,23 @@ test_expect_success '__git_refs - not in a git repository' '
850 test_expect_success '__git_refs - unique remote branches for git checkout DWIMery' '
851 cat >expected <<-EOF &&
852 HEAD
852 - master
853 + main
854 matching-branch
855 other/ambiguous
856 other/branch-in-other
856 - other/master-in-other
857 + other/main-in-other
858 remote/ambiguous
859 remote/branch-in-remote
860 matching-tag
861 branch-in-other
862 branch-in-remote
862 - master-in-other
863 + main-in-other
864 EOF
865 for remote_ref in refs/remotes/other/ambiguous \
866 refs/remotes/remote/ambiguous \
867 refs/remotes/remote/branch-in-remote
868 do
868 - git update-ref $remote_ref master &&
869 + git update-ref $remote_ref main &&
870 test_when_finished "git update-ref -d $remote_ref"
871 done &&
872 (
@@ -878,10 +879,10 @@ test_expect_success '__git_refs - unique remote branches for git checkout DWIMer
879 test_expect_success '__git_refs - after --opt=' '
880 cat >expected <<-EOF &&
881 HEAD
881 - master
882 + main
883 matching-branch
884 other/branch-in-other
884 - other/master-in-other
885 + other/main-in-other
886 matching-tag
887 EOF
888 (
@@ -893,10 +894,10 @@ test_expect_success '__git_refs - after --opt=' '
894
895 test_expect_success '__git_refs - after --opt= - full refs' '
896 cat >expected <<-EOF &&
896 - refs/heads/master
897 + refs/heads/main
898 refs/heads/matching-branch
899 refs/remotes/other/branch-in-other
899 - refs/remotes/other/master-in-other
900 + refs/remotes/other/main-in-other
901 refs/tags/matching-tag
902 EOF
903 (
@@ -909,10 +910,10 @@ test_expect_success '__git_refs - after --opt= - full refs' '
910 test_expect_success '__git refs - excluding refs' '
911 cat >expected <<-EOF &&
912 ^HEAD
912 - ^master
913 + ^main
914 ^matching-branch
915 ^other/branch-in-other
915 - ^other/master-in-other
916 + ^other/main-in-other
917 ^matching-tag
918 EOF
919 (
@@ -924,10 +925,10 @@ test_expect_success '__git refs - excluding refs' '
925
926 test_expect_success '__git refs - excluding full refs' '
927 cat >expected <<-EOF &&
927 - ^refs/heads/master
928 + ^refs/heads/main
929 ^refs/heads/matching-branch
930 ^refs/remotes/other/branch-in-other
930 - ^refs/remotes/other/master-in-other
931 + ^refs/remotes/other/main-in-other
932 ^refs/tags/matching-tag
933 EOF
934 (
@@ -948,17 +949,17 @@ test_expect_success 'setup for filtering matching refs' '
949 test_expect_success '__git_refs - do not filter refs unless told so' '
950 cat >expected <<-EOF &&
951 HEAD
951 - master
952 + main
953 matching-branch
954 matching/branch
955 other/branch-in-other
955 - other/master-in-other
956 + other/main-in-other
957 other/matching/branch-in-other
958 matching-tag
959 matching/tag
960 EOF
961 (
961 - cur=master &&
962 + cur=main &&
963 __git_refs >"$actual"
964 ) &&
965 test_cmp expected "$actual"
@@ -992,7 +993,7 @@ test_expect_success '__git_refs - only matching refs - full refs' '
993
994 test_expect_success '__git_refs - only matching refs - remote on local file system' '
995 cat >expected <<-EOF &&
995 - master-in-other
996 + main-in-other
997 matching/branch-in-other
998 EOF
999 (
@@ -1004,7 +1005,7 @@ test_expect_success '__git_refs - only matching refs - remote on local file syst
1005
1006 test_expect_success '__git_refs - only matching refs - configured remote' '
1007 cat >expected <<-EOF &&
1007 - master-in-other
1008 + main-in-other
1009 matching/branch-in-other
1010 EOF
1011 (
@@ -1016,7 +1017,7 @@ test_expect_success '__git_refs - only matching refs - configured remote' '
1017
1018 test_expect_success '__git_refs - only matching refs - remote - full refs' '
1019 cat >expected <<-EOF &&
1019 - refs/heads/master-in-other
1020 + refs/heads/main-in-other
1021 refs/heads/matching/branch-in-other
1022 EOF
1023 (
@@ -1038,7 +1039,7 @@ test_expect_success '__git_refs - only matching refs - checkout DWIMery' '
1039 refs/remotes/remote/ambiguous \
1040 refs/remotes/remote/branch-in-remote
1041 do
1041 - git update-ref $remote_ref master &&
1042 + git update-ref $remote_ref main &&
1043 test_when_finished "git update-ref -d $remote_ref"
1044 done &&
1045 (
@@ -1055,9 +1056,9 @@ test_expect_success 'teardown after filtering matching refs' '
1056 git -C otherrepo branch -D matching/branch-in-other
1057 '
1058
1058 -test_expect_success PREPARE_FOR_MAIN_BRANCH '__git_refs - for-each-ref format specifiers in prefix' '
1059 +test_expect_success '__git_refs - for-each-ref format specifiers in prefix' '
1060 cat >expected <<-EOF &&
1060 - evil-%%-%42-%(refname)..master
1061 + evil-%%-%42-%(refname)..main
1062 EOF
1063 (
1064 cur="evil-%%-%42-%(refname)..mai" &&
@@ -1069,10 +1070,10 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH '__git_refs - for-each-ref format sp
1070 test_expect_success '__git_complete_refs - simple' '
1071 sed -e "s/Z$//" >expected <<-EOF &&
1072 HEAD Z
1072 - master Z
1073 + main Z
1074 matching-branch Z
1075 other/branch-in-other Z
1075 - other/master-in-other Z
1076 + other/main-in-other Z
1077 matching-tag Z
1078 EOF
1079 (
@@ -1100,7 +1101,7 @@ test_expect_success '__git_complete_refs - remote' '
1101 sed -e "s/Z$//" >expected <<-EOF &&
1102 HEAD Z
1103 branch-in-other Z
1103 - master-in-other Z
1104 + main-in-other Z
1105 EOF
1106 (
1107 cur= &&
@@ -1113,13 +1114,13 @@ test_expect_success '__git_complete_refs - remote' '
1114 test_expect_success '__git_complete_refs - track' '
1115 sed -e "s/Z$//" >expected <<-EOF &&
1116 HEAD Z
1116 - master Z
1117 + main Z
1118 matching-branch Z
1119 other/branch-in-other Z
1119 - other/master-in-other Z
1120 + other/main-in-other Z
1121 matching-tag Z
1122 branch-in-other Z
1122 - master-in-other Z
1123 + main-in-other Z
1124 EOF
1125 (
1126 cur= &&
@@ -1158,10 +1159,10 @@ test_expect_success '__git_complete_refs - prefix' '
1159 test_expect_success '__git_complete_refs - suffix' '
1160 cat >expected <<-EOF &&
1161 HEAD.
1161 - master.
1162 + main.
1163 matching-branch.
1164 other/branch-in-other.
1164 - other/master-in-other.
1165 + other/main-in-other.
1166 matching-tag.
1167 EOF
1168 (
@@ -1176,7 +1177,7 @@ test_expect_success '__git_complete_fetch_refspecs - simple' '
1177 sed -e "s/Z$//" >expected <<-EOF &&
1178 HEAD:HEAD Z
1179 branch-in-other:branch-in-other Z
1179 - master-in-other:master-in-other Z
1180 + main-in-other:main-in-other Z
1181 EOF
1182 (
1183 cur= &&
@@ -1202,7 +1203,7 @@ test_expect_success '__git_complete_fetch_refspecs - prefix' '
1203 sed -e "s/Z$//" >expected <<-EOF &&
1204 +HEAD:HEAD Z
1205 +branch-in-other:branch-in-other Z
1205 - +master-in-other:master-in-other Z
1206 + +main-in-other:main-in-other Z
1207 EOF
1208 (
1209 cur="+" &&
@@ -1215,7 +1216,7 @@ test_expect_success '__git_complete_fetch_refspecs - prefix' '
1216 test_expect_success '__git_complete_fetch_refspecs - fully qualified' '
1217 sed -e "s/Z$//" >expected <<-EOF &&
1218 refs/heads/branch-in-other:refs/heads/branch-in-other Z
1218 - refs/heads/master-in-other:refs/heads/master-in-other Z
1219 + refs/heads/main-in-other:refs/heads/main-in-other Z
1220 refs/tags/tag-in-other:refs/tags/tag-in-other Z
1221 EOF
1222 (
@@ -1229,7 +1230,7 @@ test_expect_success '__git_complete_fetch_refspecs - fully qualified' '
1230 test_expect_success '__git_complete_fetch_refspecs - fully qualified & prefix' '
1231 sed -e "s/Z$//" >expected <<-EOF &&
1232 +refs/heads/branch-in-other:refs/heads/branch-in-other Z
1232 - +refs/heads/master-in-other:refs/heads/master-in-other Z
1233 + +refs/heads/main-in-other:refs/heads/main-in-other Z
1234 +refs/tags/tag-in-other:refs/tags/tag-in-other Z
1235 EOF
1236 (
@@ -1243,8 +1244,8 @@ test_expect_success '__git_complete_fetch_refspecs - fully qualified & prefix' '
1244 test_expect_success 'git switch - with no options, complete local branches and unique remote branch names for DWIM logic' '
1245 test_completion "git switch " <<-\EOF
1246 branch-in-other Z
1246 - master Z
1247 - master-in-other Z
1247 + main Z
1248 + main-in-other Z
1249 matching-branch Z
1250 EOF
1251 '
@@ -1253,25 +1254,25 @@ test_expect_success 'git checkout - completes refs and unique remote branches fo
1254 test_completion "git checkout " <<-\EOF
1255 HEAD Z
1256 branch-in-other Z
1256 - master Z
1257 - master-in-other Z
1257 + main Z
1258 + main-in-other Z
1259 matching-branch Z
1260 matching-tag Z
1261 other/branch-in-other Z
1261 - other/master-in-other Z
1262 + other/main-in-other Z
1263 EOF
1264 '
1265
1266 test_expect_success 'git switch - with --no-guess, complete only local branches' '
1267 test_completion "git switch --no-guess " <<-\EOF
1267 - master Z
1268 + main Z
1269 matching-branch Z
1270 EOF
1271 '
1272
1273 test_expect_success 'git switch - with GIT_COMPLETION_CHECKOUT_NO_GUESS=1, complete only local branches' '
1274 GIT_COMPLETION_CHECKOUT_NO_GUESS=1 test_completion "git switch " <<-\EOF
1274 - master Z
1275 + main Z
1276 matching-branch Z
1277 EOF
1278 '
@@ -1279,8 +1280,8 @@ test_expect_success 'git switch - with GIT_COMPLETION_CHECKOUT_NO_GUESS=1, compl
1280 test_expect_success 'git switch - --guess overrides GIT_COMPLETION_CHECKOUT_NO_GUESS=1, complete local branches and unique remote names for DWIM logic' '
1281 GIT_COMPLETION_CHECKOUT_NO_GUESS=1 test_completion "git switch --guess " <<-\EOF
1282 branch-in-other Z
1282 - master Z
1283 - master-in-other Z
1283 + main Z
1284 + main-in-other Z
1285 matching-branch Z
1286 EOF
1287 '
@@ -1288,15 +1289,15 @@ test_expect_success 'git switch - --guess overrides GIT_COMPLETION_CHECKOUT_NO_G
1289 test_expect_success 'git switch - a later --guess overrides previous --no-guess, complete local and remote unique branches for DWIM' '
1290 test_completion "git switch --no-guess --guess " <<-\EOF
1291 branch-in-other Z
1291 - master Z
1292 - master-in-other Z
1292 + main Z
1293 + main-in-other Z
1294 matching-branch Z
1295 EOF
1296 '
1297
1298 test_expect_success 'git switch - a later --no-guess overrides previous --guess, complete only local branches' '
1299 test_completion "git switch --guess --no-guess " <<-\EOF
1299 - master Z
1300 + main Z
1301 matching-branch Z
1302 EOF
1303 '
@@ -1304,11 +1305,11 @@ test_expect_success 'git switch - a later --no-guess overrides previous --guess,
1305 test_expect_success 'git checkout - with GIT_COMPLETION_NO_GUESS=1 only completes refs' '
1306 GIT_COMPLETION_CHECKOUT_NO_GUESS=1 test_completion "git checkout " <<-\EOF
1307 HEAD Z
1307 - master Z
1308 + main Z
1309 matching-branch Z
1310 matching-tag Z
1311 other/branch-in-other Z
1311 - other/master-in-other Z
1312 + other/main-in-other Z
1313 EOF
1314 '
1315
@@ -1316,23 +1317,23 @@ test_expect_success 'git checkout - --guess overrides GIT_COMPLETION_NO_GUESS=1,
1317 GIT_COMPLETION_CHECKOUT_NO_GUESS=1 test_completion "git checkout --guess " <<-\EOF
1318 HEAD Z
1319 branch-in-other Z
1319 - master Z
1320 - master-in-other Z
1320 + main Z
1321 + main-in-other Z
1322 matching-branch Z
1323 matching-tag Z
1324 other/branch-in-other Z
1324 - other/master-in-other Z
1325 + other/main-in-other Z
1326 EOF
1327 '
1328
1329 test_expect_success 'git checkout - with --no-guess, only completes refs' '
1330 test_completion "git checkout --no-guess " <<-\EOF
1331 HEAD Z
1331 - master Z
1332 + main Z
1333 matching-branch Z
1334 matching-tag Z
1335 other/branch-in-other Z
1335 - other/master-in-other Z
1336 + other/main-in-other Z
1337 EOF
1338 '
1339
@@ -1340,23 +1341,23 @@ test_expect_success 'git checkout - a later --guess overrides previous --no-gues
1341 test_completion "git checkout --no-guess --guess " <<-\EOF
1342 HEAD Z
1343 branch-in-other Z
1343 - master Z
1344 - master-in-other Z
1344 + main Z
1345 + main-in-other Z
1346 matching-branch Z
1347 matching-tag Z
1348 other/branch-in-other Z
1348 - other/master-in-other Z
1349 + other/main-in-other Z
1350 EOF
1351 '
1352
1353 test_expect_success 'git checkout - a later --no-guess overrides previous --guess, complete only refs' '
1354 test_completion "git checkout --guess --no-guess " <<-\EOF
1355 HEAD Z
1355 - master Z
1356 + main Z
1357 matching-branch Z
1358 matching-tag Z
1359 other/branch-in-other Z
1359 - other/master-in-other Z
1360 + other/main-in-other Z
1361 EOF
1362 '
1363
@@ -1364,11 +1365,11 @@ test_expect_success 'git checkout - with checkout.guess = false, only completes
1365 test_config checkout.guess false &&
1366 test_completion "git checkout " <<-\EOF
1367 HEAD Z
1367 - master Z
1368 + main Z
1369 matching-branch Z
1370 matching-tag Z
1371 other/branch-in-other Z
1371 - other/master-in-other Z
1372 + other/main-in-other Z
1373 EOF
1374 '
1375
@@ -1377,12 +1378,12 @@ test_expect_success 'git checkout - with checkout.guess = true, completes refs a
1378 test_completion "git checkout " <<-\EOF
1379 HEAD Z
1380 branch-in-other Z
1380 - master Z
1381 - master-in-other Z
1381 + main Z
1382 + main-in-other Z
1383 matching-branch Z
1384 matching-tag Z
1385 other/branch-in-other Z
1385 - other/master-in-other Z
1386 + other/main-in-other Z
1387 EOF
1388 '
1389
@@ -1391,12 +1392,12 @@ test_expect_success 'git checkout - a later --guess overrides previous checkout.
1392 test_completion "git checkout --guess " <<-\EOF
1393 HEAD Z
1394 branch-in-other Z
1394 - master Z
1395 - master-in-other Z
1395 + main Z
1396 + main-in-other Z
1397 matching-branch Z
1398 matching-tag Z
1399 other/branch-in-other Z
1399 - other/master-in-other Z
1400 + other/main-in-other Z
1401 EOF
1402 '
1403
@@ -1404,75 +1405,75 @@ test_expect_success 'git checkout - a later --no-guess overrides previous checko
1405 test_config checkout.guess true &&
1406 test_completion "git checkout --no-guess " <<-\EOF
1407 HEAD Z
1407 - master Z
1408 + main Z
1409 matching-branch Z
1410 matching-tag Z
1411 other/branch-in-other Z
1411 - other/master-in-other Z
1412 + other/main-in-other Z
1413 EOF
1414 '
1415
1416 test_expect_success 'git switch - with --detach, complete all references' '
1417 test_completion "git switch --detach " <<-\EOF
1418 HEAD Z
1418 - master Z
1419 + main Z
1420 matching-branch Z
1421 matching-tag Z
1422 other/branch-in-other Z
1422 - other/master-in-other Z
1423 + other/main-in-other Z
1424 EOF
1425 '
1426
1427 test_expect_success 'git checkout - with --detach, complete only references' '
1428 test_completion "git checkout --detach " <<-\EOF
1429 HEAD Z
1429 - master Z
1430 + main Z
1431 matching-branch Z
1432 matching-tag Z
1433 other/branch-in-other Z
1433 - other/master-in-other Z
1434 + other/main-in-other Z
1435 EOF
1436 '
1437
1438 test_expect_success 'git switch - with -d, complete all references' '
1439 test_completion "git switch -d " <<-\EOF
1440 HEAD Z
1440 - master Z
1441 + main Z
1442 matching-branch Z
1443 matching-tag Z
1444 other/branch-in-other Z
1444 - other/master-in-other Z
1445 + other/main-in-other Z
1446 EOF
1447 '
1448
1449 test_expect_success 'git checkout - with -d, complete only references' '
1450 test_completion "git checkout -d " <<-\EOF
1451 HEAD Z
1451 - master Z
1452 + main Z
1453 matching-branch Z
1454 matching-tag Z
1455 other/branch-in-other Z
1455 - other/master-in-other Z
1456 + other/main-in-other Z
1457 EOF
1458 '
1459
1460 test_expect_success 'git switch - with --track, complete only remote branches' '
1461 test_completion "git switch --track " <<-\EOF
1462 other/branch-in-other Z
1462 - other/master-in-other Z
1463 + other/main-in-other Z
1464 EOF
1465 '
1466
1467 test_expect_success 'git checkout - with --track, complete only remote branches' '
1468 test_completion "git checkout --track " <<-\EOF
1469 other/branch-in-other Z
1469 - other/master-in-other Z
1470 + other/main-in-other Z
1471 EOF
1472 '
1473
1474 test_expect_success 'git switch - with --no-track, complete only local branch names' '
1475 test_completion "git switch --no-track " <<-\EOF
1475 - master Z
1476 + main Z
1477 matching-branch Z
1478 EOF
1479 '
@@ -1480,151 +1481,151 @@ test_expect_success 'git switch - with --no-track, complete only local branch na
1481 test_expect_success 'git checkout - with --no-track, complete only local references' '
1482 test_completion "git checkout --no-track " <<-\EOF
1483 HEAD Z
1483 - master Z
1484 + main Z
1485 matching-branch Z
1486 matching-tag Z
1487 other/branch-in-other Z
1487 - other/master-in-other Z
1488 + other/main-in-other Z
1489 EOF
1490 '
1491
1492 test_expect_success 'git switch - with -c, complete all references' '
1493 test_completion "git switch -c new-branch " <<-\EOF
1494 HEAD Z
1494 - master Z
1495 + main Z
1496 matching-branch Z
1497 matching-tag Z
1498 other/branch-in-other Z
1498 - other/master-in-other Z
1499 + other/main-in-other Z
1500 EOF
1501 '
1502
1503 test_expect_success 'git switch - with -C, complete all references' '
1504 test_completion "git switch -C new-branch " <<-\EOF
1505 HEAD Z
1505 - master Z
1506 + main Z
1507 matching-branch Z
1508 matching-tag Z
1509 other/branch-in-other Z
1509 - other/master-in-other Z
1510 + other/main-in-other Z
1511 EOF
1512 '
1513
1514 test_expect_success 'git switch - with -c and --track, complete all references' '
1515 test_completion "git switch -c new-branch --track " <<-EOF
1516 HEAD Z
1516 - master Z
1517 + main Z
1518 matching-branch Z
1519 matching-tag Z
1520 other/branch-in-other Z
1520 - other/master-in-other Z
1521 + other/main-in-other Z
1522 EOF
1523 '
1524
1525 test_expect_success 'git switch - with -C and --track, complete all references' '
1526 test_completion "git switch -C new-branch --track " <<-EOF
1527 HEAD Z
1527 - master Z
1528 + main Z
1529 matching-branch Z
1530 matching-tag Z
1531 other/branch-in-other Z
1531 - other/master-in-other Z
1532 + other/main-in-other Z
1533 EOF
1534 '
1535
1536 test_expect_success 'git switch - with -c and --no-track, complete all references' '
1537 test_completion "git switch -c new-branch --no-track " <<-\EOF
1538 HEAD Z
1538 - master Z
1539 + main Z
1540 matching-branch Z
1541 matching-tag Z
1542 other/branch-in-other Z
1542 - other/master-in-other Z
1543 + other/main-in-other Z
1544 EOF
1545 '
1546
1547 test_expect_success 'git switch - with -C and --no-track, complete all references' '
1548 test_completion "git switch -C new-branch --no-track " <<-\EOF
1549 HEAD Z
1549 - master Z
1550 + main Z
1551 matching-branch Z
1552 matching-tag Z
1553 other/branch-in-other Z
1553 - other/master-in-other Z
1554 + other/main-in-other Z
1555 EOF
1556 '
1557
1558 test_expect_success 'git checkout - with -b, complete all references' '
1559 test_completion "git checkout -b new-branch " <<-\EOF
1560 HEAD Z
1560 - master Z
1561 + main Z
1562 matching-branch Z
1563 matching-tag Z
1564 other/branch-in-other Z
1564 - other/master-in-other Z
1565 + other/main-in-other Z
1566 EOF
1567 '
1568
1569 test_expect_success 'git checkout - with -B, complete all references' '
1570 test_completion "git checkout -B new-branch " <<-\EOF
1571 HEAD Z
1571 - master Z
1572 + main Z
1573 matching-branch Z
1574 matching-tag Z
1575 other/branch-in-other Z
1575 - other/master-in-other Z
1576 + other/main-in-other Z
1577 EOF
1578 '
1579
1580 test_expect_success 'git checkout - with -b and --track, complete all references' '
1581 test_completion "git checkout -b new-branch --track " <<-EOF
1582 HEAD Z
1582 - master Z
1583 + main Z
1584 matching-branch Z
1585 matching-tag Z
1586 other/branch-in-other Z
1586 - other/master-in-other Z
1587 + other/main-in-other Z
1588 EOF
1589 '
1590
1591 test_expect_success 'git checkout - with -B and --track, complete all references' '
1592 test_completion "git checkout -B new-branch --track " <<-EOF
1593 HEAD Z
1593 - master Z
1594 + main Z
1595 matching-branch Z
1596 matching-tag Z
1597 other/branch-in-other Z
1597 - other/master-in-other Z
1598 + other/main-in-other Z
1599 EOF
1600 '
1601
1602 test_expect_success 'git checkout - with -b and --no-track, complete all references' '
1603 test_completion "git checkout -b new-branch --no-track " <<-\EOF
1604 HEAD Z
1604 - master Z
1605 + main Z
1606 matching-branch Z
1607 matching-tag Z
1608 other/branch-in-other Z
1608 - other/master-in-other Z
1609 + other/main-in-other Z
1610 EOF
1611 '
1612
1613 test_expect_success 'git checkout - with -B and --no-track, complete all references' '
1614 test_completion "git checkout -B new-branch --no-track " <<-\EOF
1615 HEAD Z
1615 - master Z
1616 + main Z
1617 matching-branch Z
1618 matching-tag Z
1619 other/branch-in-other Z
1619 - other/master-in-other Z
1620 + other/main-in-other Z
1621 EOF
1622 '
1623
1624 test_expect_success 'git switch - for -c, complete local branches and unique remote branches' '
1625 test_completion "git switch -c " <<-\EOF
1626 branch-in-other Z
1626 - master Z
1627 - master-in-other Z
1627 + main Z
1628 + main-in-other Z
1629 matching-branch Z
1630 EOF
1631 '
@@ -1632,36 +1633,36 @@ test_expect_success 'git switch - for -c, complete local branches and unique rem
1633 test_expect_success 'git switch - for -C, complete local branches and unique remote branches' '
1634 test_completion "git switch -C " <<-\EOF
1635 branch-in-other Z
1635 - master Z
1636 - master-in-other Z
1636 + main Z
1637 + main-in-other Z
1638 matching-branch Z
1639 EOF
1640 '
1641
1642 test_expect_success 'git switch - for -c with --no-guess, complete local branches only' '
1643 test_completion "git switch --no-guess -c " <<-\EOF
1643 - master Z
1644 + main Z
1645 matching-branch Z
1646 EOF
1647 '
1648
1649 test_expect_success 'git switch - for -C with --no-guess, complete local branches only' '
1650 test_completion "git switch --no-guess -C " <<-\EOF
1650 - master Z
1651 + main Z
1652 matching-branch Z
1653 EOF
1654 '
1655
1656 test_expect_success 'git switch - for -c with --no-track, complete local branches only' '
1657 test_completion "git switch --no-track -c " <<-\EOF
1657 - master Z
1658 + main Z
1659 matching-branch Z
1660 EOF
1661 '
1662
1663 test_expect_success 'git switch - for -C with --no-track, complete local branches only' '
1664 test_completion "git switch --no-track -C " <<-\EOF
1664 - master Z
1665 + main Z
1666 matching-branch Z
1667 EOF
1668 '
@@ -1669,8 +1670,8 @@ test_expect_success 'git switch - for -C with --no-track, complete local branche
1670 test_expect_success 'git checkout - for -b, complete local branches and unique remote branches' '
1671 test_completion "git checkout -b " <<-\EOF
1672 branch-in-other Z
1672 - master Z
1673 - master-in-other Z
1673 + main Z
1674 + main-in-other Z
1675 matching-branch Z
1676 EOF
1677 '
@@ -1678,36 +1679,36 @@ test_expect_success 'git checkout - for -b, complete local branches and unique r
1679 test_expect_success 'git checkout - for -B, complete local branches and unique remote branches' '
1680 test_completion "git checkout -B " <<-\EOF
1681 branch-in-other Z
1681 - master Z
1682 - master-in-other Z
1682 + main Z
1683 + main-in-other Z
1684 matching-branch Z
1685 EOF
1686 '
1687
1688 test_expect_success 'git checkout - for -b with --no-guess, complete local branches only' '
1689 test_completion "git checkout --no-guess -b " <<-\EOF
1689 - master Z
1690 + main Z
1691 matching-branch Z
1692 EOF
1693 '
1694
1695 test_expect_success 'git checkout - for -B with --no-guess, complete local branches only' '
1696 test_completion "git checkout --no-guess -B " <<-\EOF
1696 - master Z
1697 + main Z
1698 matching-branch Z
1699 EOF
1700 '
1701
1702 test_expect_success 'git checkout - for -b with --no-track, complete local branches only' '
1703 test_completion "git checkout --no-track -b " <<-\EOF
1703 - master Z
1704 + main Z
1705 matching-branch Z
1706 EOF
1707 '
1708
1709 test_expect_success 'git checkout - for -B with --no-track, complete local branches only' '
1710 test_completion "git checkout --no-track -B " <<-\EOF
1710 - master Z
1711 + main Z
1712 matching-branch Z
1713 EOF
1714 '
@@ -1715,14 +1716,14 @@ test_expect_success 'git checkout - for -B with --no-track, complete local branc
1716 test_expect_success 'git switch - with --orphan completes local branch names and unique remote branch names' '
1717 test_completion "git switch --orphan " <<-\EOF
1718 branch-in-other Z
1718 - master Z
1719 - master-in-other Z
1719 + main Z
1720 + main-in-other Z
1721 matching-branch Z
1722 EOF
1723 '
1724
1725 test_expect_success 'git switch - --orphan with branch already provided completes nothing else' '
1725 - test_completion "git switch --orphan master " <<-\EOF
1726 + test_completion "git switch --orphan main " <<-\EOF
1727
1728 EOF
1729 '
@@ -1730,20 +1731,20 @@ test_expect_success 'git switch - --orphan with branch already provided complete
1731 test_expect_success 'git checkout - with --orphan completes local branch names and unique remote branch names' '
1732 test_completion "git checkout --orphan " <<-\EOF
1733 branch-in-other Z
1733 - master Z
1734 - master-in-other Z
1734 + main Z
1735 + main-in-other Z
1736 matching-branch Z
1737 EOF
1738 '
1739
1740 test_expect_success 'git checkout - --orphan with branch already provided completes local refs for a start-point' '
1740 - test_completion "git checkout --orphan master " <<-\EOF
1741 + test_completion "git checkout --orphan main " <<-\EOF
1742 HEAD Z
1742 - master Z
1743 + main Z
1744 matching-branch Z
1745 matching-tag Z
1746 other/branch-in-other Z
1746 - other/master-in-other Z
1747 + other/main-in-other Z
1748 EOF
1749 '
1750
@@ -2067,7 +2068,7 @@ test_expect_success 'setup for integration tests' '
2068
2069 test_expect_success 'checkout completes ref names' '
2070 test_completion "git checkout m" <<-\EOF
2070 - master Z
2071 + main Z
2072 mybranch Z
2073 mytag Z
2074 EOF
@@ -2081,7 +2082,7 @@ test_expect_success 'git -C <path> checkout uses the right repo' '
2082
2083 test_expect_success 'show completes all refs' '
2084 test_completion "git show m" <<-\EOF
2084 - master Z
2085 + main Z
2086 mybranch Z
2087 mytag Z
2088 EOF
@@ -2118,7 +2119,7 @@ test_expect_success PERL 'send-email' '
2119 --cover-from-description=Z
2120 --cover-letter Z
2121 EOF
2121 - test_completion "git send-email ma" "master "
2122 + test_completion "git send-email ma" "main "
2123 '
2124
2125 test_expect_success 'complete files' '
@@ -2198,7 +2199,7 @@ test_expect_success 'complete files' '
2199 test_expect_success "simple alias" '
2200 test_config alias.co checkout &&
2201 test_completion "git co m" <<-\EOF
2201 - master Z
2202 + main Z
2203 mybranch Z
2204 mytag Z
2205 EOF
@@ -2208,7 +2209,7 @@ test_expect_success "recursive alias" '
2209 test_config alias.co checkout &&
2210 test_config alias.cod "co --detached" &&
2211 test_completion "git cod m" <<-\EOF
2211 - master Z
2212 + main Z
2213 mybranch Z
2214 mytag Z
2215 EOF
@@ -2217,7 +2218,7 @@ test_expect_success "recursive alias" '
2218 test_expect_success "completion uses <cmd> completion for alias: !sh -c 'git <cmd> ...'" '
2219 test_config alias.co "!sh -c '"'"'git checkout ...'"'"'" &&
2220 test_completion "git co m" <<-\EOF
2220 - master Z
2221 + main Z
2222 mybranch Z
2223 mytag Z
2224 EOF
@@ -2226,7 +2227,7 @@ test_expect_success "completion uses <cmd> completion for alias: !sh -c 'git <cm
2227 test_expect_success 'completion uses <cmd> completion for alias: !f () { VAR=val git <cmd> ... }' '
2228 test_config alias.co "!f () { VAR=val git checkout ... ; } f" &&
2229 test_completion "git co m" <<-\EOF
2229 - master Z
2230 + main Z
2231 mybranch Z
2232 mytag Z
2233 EOF
@@ -2235,7 +2236,7 @@ test_expect_success 'completion uses <cmd> completion for alias: !f () { VAR=val
2236 test_expect_success 'completion used <cmd> completion for alias: !f() { : git <cmd> ; ... }' '
2237 test_config alias.co "!f() { : git checkout ; if ... } f" &&
2238 test_completion "git co m" <<-\EOF
2238 - master Z
2239 + main Z
2240 mybranch Z
2241 mytag Z
2242 EOF
@@ -2266,7 +2267,7 @@ for flag in -d --delete
2267 do
2268 test_expect_success "__git_complete_remote_or_refspec - push $flag other" '
2269 sed -e "s/Z$//" >expected <<-EOF &&
2269 - master-in-other Z
2270 + main-in-other Z
2271 EOF
2272 (
2273 words=(git push '$flag' other ma) &&
@@ -2279,7 +2280,7 @@ do
2280
2281 test_expect_failure "__git_complete_remote_or_refspec - push other $flag" '
2282 sed -e "s/Z$//" >expected <<-EOF &&
2282 - master-in-other Z
2283 + main-in-other Z
2284 EOF
2285 (
2286 words=(git push other '$flag' ma) &&