Skip to contentSkip to conversation

Use main as default branch name

PATCH Superseded Johannes Schindelin via GitGitGadget 11 participants 163 messages Nov 12, 2020 – Nov 23, 2020 1 message not in the archive Kbuild Page 1 of 6

lore
Share & tools
lore
#5 lore raw

PATCH 5/28 t3416: preemptively adjust alignment in a comment

In reply to Johannes Schindelin via GitGitGadget

From: Johannes Schindelin <[email protected]>

We are about to adjust t3416 for the new default branch name main. This name is two characters shorter and therefore needs two spaces more padding to align correctly.

Adjusting the alignment before the big search-and-replace makes it easier to verify that the final result does not leave any misaligned lines behind.

---
 t/t3416-rebase-onto-threedots.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
t/t3416-rebase-onto-threedots.sh +1 -1
index 9c2548423b..1f37adf56b 100755
@@ -12,7 +12,7 @@ test_description='git rebase --onto A...B'
 #
 #	    F---G topic                             G'
 #	   /                                       /
-# A---B---C---D---E master      -->       A---B---C---D---E
+# A---B---C---D---E master        -->       A---B---C---D---E
 #      \   \ /
 #	\   x
 #	 \ / \
Signature · 1 line
gitgitgadget
#2 lore raw

PATCH 2/28 t[01]*: adjust the references to the default branch name "main"

In reply to Johannes Schindelin via GitGitGadget

From: Johannes Schindelin <[email protected]>

This trick was performed via

	$ (cd t &&
	   sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
		-e 's/Master/Main/g' -- t[01]*.sh)

This allows us to define GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main for those tests.

---
 t/t0002-gitfile.sh                   |  6 +--
 t/t0020-crlf.sh                      |  8 ++--
 t/t0021-conversion.sh                | 40 ++++++++--------
 t/t0027-auto-crlf.sh                 |  4 +-
 t/t0028-working-tree-encoding.sh     |  4 +-
 t/t0041-usage.sh                     | 10 ++--
 t/t0050-filesystem.sh                |  6 +--
 t/t0060-path-utils.sh                |  4 +-
 t/t0100-previous.sh                  | 18 ++++----
 t/t1004-read-tree-m-u-wf.sh          | 40 ++++++++--------
 t/t1008-read-tree-overlay.sh         |  2 +-
 t/t1009-read-tree-new-index.sh       |  4 +-
 t/t1011-read-tree-sparse-checkout.sh |  2 +-
 t/t1021-rerere-in-workdir.sh         |  2 +-
 t/t1090-sparse-checkout-scope.sh     | 10 ++--
 t/t1091-sparse-checkout-builtin.sh   |  2 +-
 t/t1300-config.sh                    |  8 ++--
 t/t1301-shared-repo.sh               |  4 +-
 t/t1305-config-include.sh            |  2 +-
 t/t1309-early-config.sh              |  4 +-
 t/t1400-update-ref.sh                | 68 ++++++++++++++--------------
 t/t1402-check-ref-format.sh          | 28 ++++++------
 t/t1403-show-ref.sh                  | 18 ++++----
 t/t1405-main-ref-store.sh            | 42 ++++++++---------
 t/t1406-submodule-ref-store.sh       | 30 ++++++------
 t/t1407-worktree-ref-store.sh        | 32 ++++++-------
 t/t1408-packed-refs.sh               | 12 ++---
 t/t1410-reflog.sh                    | 56 +++++++++++------------
 t/t1411-reflog-show.sh               |  2 +-
 t/t1413-reflog-detach.sh             | 24 +++++-----
 t/t1414-reflog-walk.sh               | 12 ++---
 t/t1416-ref-transaction-hooks.sh     | 10 ++--
 t/t1430-bad-ref-name.sh              | 52 ++++++++++-----------
 t/t1450-fsck.sh                      |  2 +-
 t/t1500-rev-parse.sh                 |  4 +-
 t/t1503-rev-parse-verify.sh          | 28 ++++++------
 t/t1505-rev-parse-last.sh            |  8 ++--
 t/t1506-rev-parse-diagnosis.sh       |  4 +-
 t/t1507-rev-parse-upstream.sh        | 40 ++++++++--------
 t/t1508-at-combinations.sh           | 10 ++--
 t/t1511-rev-parse-caret.sh           | 26 +++++------
 t/t1512-rev-parse-disambiguation.sh  |  2 +-
 t/t1513-rev-parse-prefix.sh          |  4 +-
 t/t1514-rev-parse-push.sh            | 16 +++----
 t/t1700-split-index.sh               |  2 +-
 t/test-lib.sh                        |  7 +++
 46 files changed, 363 insertions(+), 356 deletions(-)
t/t0002-gitfile.sh +3 -3
index 960ed150cb..bbcfc8a0b5 100755
@@ -96,7 +96,7 @@ test_expect_success 'enter_repo non-strict mode' '
 	git ls-remote enter_repo >actual &&
 	cat >expected <<-EOF &&
 	$head	HEAD
-	$head	refs/heads/master
+	$head	refs/heads/main
 	$head	refs/tags/foo
 	EOF
 	test_cmp expected actual
@@ -111,7 +111,7 @@ test_expect_success 'enter_repo linked checkout' '
 	git ls-remote foo >actual &&
 	cat >expected <<-EOF &&
 	$head	HEAD
-	$head	refs/heads/master
+	$head	refs/heads/main
 	$head	refs/tags/foo
 	EOF
 	test_cmp expected actual
@@ -122,7 +122,7 @@ test_expect_success 'enter_repo strict mode' '
 	git ls-remote --upload-pack="git upload-pack --strict" foo/.git >actual &&
 	cat >expected <<-EOF &&
 	$head	HEAD
-	$head	refs/heads/master
+	$head	refs/heads/main
 	$head	refs/tags/foo
 	EOF
 	test_cmp expected actual
t/t0020-crlf.sh +4 -4
index b63ba62e5d..04bf4b1e82 100755
@@ -318,8 +318,8 @@ test_expect_success 'checkout with existing .gitattributes' '
 	git add .gitattributes .file &&
 	git commit -m second &&
 
-	git checkout master~1 &&
-	git checkout master &&
+	git checkout main~1 &&
+	git checkout main &&
 	test "$(git diff-files --raw)" = ""
 
 '
@@ -331,8 +331,8 @@ test_expect_success 'checkout when deleting .gitattributes' '
 	git add .file2 &&
 	git commit -m third &&
 
-	git checkout master~1 &&
-	git checkout master &&
+	git checkout main~1 &&
+	git checkout main &&
 	has_cr .file2
 
 '
t/t0021-conversion.sh +20 -20
index f6deaf498b..d0eeca4556 100755
@@ -378,8 +378,8 @@ test_expect_success PERL 'required process filter should filter data' '
 		test_cmp_count expected.log debug.log &&
 
 		git commit -m "test commit 2" &&
-		MASTER=$(git rev-parse --verify master) &&
-		META="ref=refs/heads/master treeish=$MASTER" &&
+		MAIN=$(git rev-parse --verify main) &&
+		META="ref=refs/heads/main treeish=$MAIN" &&
 		rm -f test2.r "testsubdir/test3 '\''sq'\'',\$x=.r" &&
 
 		filter_git checkout --quiet --no-progress . &&
@@ -404,7 +404,7 @@ test_expect_success PERL 'required process filter should filter data' '
 		EOF
 		test_cmp_exclude_clean expected.log debug.log &&
 
-		filter_git checkout --quiet --no-progress master &&
+		filter_git checkout --quiet --no-progress main &&
 		cat >expected.log <<-EOF &&
 			START
 			init handshake complete
@@ -436,15 +436,15 @@ test_expect_success PERL 'required process filter should filter data for various
 		M3=$(git hash-object "testsubdir/test3 '\''sq'\'',\$x=.r") &&
 		EMPTY=$(git hash-object /dev/null) &&
 
-		MASTER=$(git rev-parse --verify master) &&
+		MAIN=$(git rev-parse --verify main) &&
 
 		cp "$TEST_ROOT/test.o" test5.r &&
 		git add test5.r &&
 		git commit -m "test commit 3" &&
 		git checkout empty-branch &&
-		filter_git rebase --onto empty-branch master^^ master &&
-		MASTER2=$(git rev-parse --verify master) &&
-		META="ref=refs/heads/master treeish=$MASTER2" &&
+		filter_git rebase --onto empty-branch main^^ main &&
+		MAIN2=$(git rev-parse --verify main) &&
+		META="ref=refs/heads/main treeish=$MAIN2" &&
 		cat >expected.log <<-EOF &&
 			START
 			init handshake complete
@@ -458,8 +458,8 @@ test_expect_success PERL 'required process filter should filter data for various
 		test_cmp_exclude_clean expected.log debug.log &&
 
 		git reset --hard empty-branch &&
-		filter_git reset --hard $MASTER &&
-		META="treeish=$MASTER" &&
+		filter_git reset --hard $MAIN &&
+		META="treeish=$MAIN" &&
 		cat >expected.log <<-EOF &&
 			START
 			init handshake complete
@@ -471,10 +471,10 @@ test_expect_success PERL 'required process filter should filter data for various
 		EOF
 		test_cmp_exclude_clean expected.log debug.log &&
 
-		git branch old-master $MASTER &&
+		git branch old-main $MAIN &&
 		git reset --hard empty-branch &&
-		filter_git reset --hard old-master &&
-		META="ref=refs/heads/old-master treeish=$MASTER" &&
+		filter_git reset --hard old-main &&
+		META="ref=refs/heads/old-main treeish=$MAIN" &&
 		cat >expected.log <<-EOF &&
 			START
 			init handshake complete
@@ -487,9 +487,9 @@ test_expect_success PERL 'required process filter should filter data for various
 		test_cmp_exclude_clean expected.log debug.log &&
 
 		git checkout -b merge empty-branch &&
-		git branch -f master $MASTER2 &&
-		filter_git merge master &&
-		META="treeish=$MASTER2" &&
+		git branch -f main $MAIN2 &&
+		filter_git merge main &&
+		META="treeish=$MAIN2" &&
 		cat >expected.log <<-EOF &&
 			START
 			init handshake complete
@@ -502,8 +502,8 @@ test_expect_success PERL 'required process filter should filter data for various
 		EOF
 		test_cmp_exclude_clean expected.log debug.log &&
 
-		filter_git archive master >/dev/null &&
-		META="ref=refs/heads/master treeish=$MASTER2" &&
+		filter_git archive main >/dev/null &&
+		META="ref=refs/heads/main treeish=$MAIN2" &&
 		cat >expected.log <<-EOF &&
 			START
 			init handshake complete
@@ -516,7 +516,7 @@ test_expect_success PERL 'required process filter should filter data for various
 		EOF
 		test_cmp_exclude_clean expected.log debug.log &&
 
-		TREE="$(git rev-parse $MASTER2^{tree})" &&
+		TREE="$(git rev-parse $MAIN2^{tree})" &&
 		filter_git archive $TREE >/dev/null &&
 		META="treeish=$TREE" &&
 		cat >expected.log <<-EOF &&
@@ -856,8 +856,8 @@ test_expect_success PERL 'delayed checkout in process filter' '
 	) &&
 
 	S=$(test_file_size "$TEST_ROOT/test.o") &&
-	PM="ref=refs/heads/master treeish=$(git -C repo rev-parse --verify master) " &&
-	M="${PM}blob=$(git -C repo rev-parse --verify master:test.a)" &&
+	PM="ref=refs/heads/main treeish=$(git -C repo rev-parse --verify main) " &&
+	M="${PM}blob=$(git -C repo rev-parse --verify main:test.a)" &&
 	cat >a.exp <<-EOF &&
 		START
 		init handshake complete
t/t0027-auto-crlf.sh +2 -2
index 9fcd56fab3..51f74a3ddf 100755
@@ -368,9 +368,9 @@ test_expect_success 'ls-files --eol -o Text/Binary' '
 	test_cmp expect actual
 '
 
-test_expect_success 'setup master' '
+test_expect_success 'setup main' '
 	echo >.gitattributes &&
-	git checkout -b master &&
+	git checkout -b main &&
 	git add .gitattributes &&
 	git commit -m "add .gitattributes" . &&
 	printf "\$Id: 0000000000000000000000000000000000000000 \$\nLINEONE\nLINETWO\nLINETHREE"     >LF &&
t/t0028-working-tree-encoding.sh +2 -2
index bfc4fb9af5..9c48037884 100755
@@ -215,7 +215,7 @@ test_expect_success 'error if encoding round trip is not the same during refresh
 	TEST_HASH=$(git hash-object --no-filters -w nonsense.utf16le) &&
 	git update-index --add --cacheinfo 100644 $TEST_HASH nonsense.utf16le &&
 	COMMIT=$(git commit-tree -p $(git rev-parse HEAD) -m "plain commit" $(git write-tree)) &&
-	git update-ref refs/heads/master $COMMIT &&
+	git update-ref refs/heads/main $COMMIT &&
 
 	test_must_fail git checkout HEAD^ 2>err.out &&
 	test_i18ngrep "error: .* overwritten by checkout:" err.out
@@ -231,7 +231,7 @@ test_expect_success 'error if encoding garbage is already in Git' '
 	TEST_HASH=$(git hash-object --no-filters -w nonsense.utf16) &&
 	git update-index --add --cacheinfo 100644 $TEST_HASH nonsense.utf16 &&
 	COMMIT=$(git commit-tree -p $(git rev-parse HEAD) -m "plain commit" $(git write-tree)) &&
-	git update-ref refs/heads/master $COMMIT &&
+	git update-ref refs/heads/main $COMMIT &&
 
 	git diff 2>err.out &&
 	test_i18ngrep "error: BOM is required" err.out
t/t0041-usage.sh +5 -5
index 5b927b76fe..6f93450597 100755
@@ -41,8 +41,8 @@ test_expect_success 'tag usage error' '
 '
 
 test_expect_success 'branch --contains <existent_commit>' '
-	git branch --contains "master" >actual 2>actual.err &&
-	test_i18ngrep "master" actual &&
+	git branch --contains "main" >actual 2>actual.err &&
+	test_i18ngrep "main" actual &&
 	test_line_count = 0 actual.err
 '
 
@@ -54,7 +54,7 @@ test_expect_success 'branch --contains <inexistent_commit>' '
 '
 
 test_expect_success 'branch --no-contains <existent_commit>' '
-	git branch --no-contains "master" >actual 2>actual.err &&
+	git branch --no-contains "main" >actual 2>actual.err &&
 	test_line_count = 0 actual &&
 	test_line_count = 0 actual.err
 '
@@ -73,7 +73,7 @@ test_expect_success 'branch usage error' '
 '
 
 test_expect_success 'for-each-ref --contains <existent_object>' '
-	git for-each-ref --contains "master" >actual 2>actual.err &&
+	git for-each-ref --contains "main" >actual 2>actual.err &&
 	test_line_count = 2 actual &&
 	test_line_count = 0 actual.err
 '
@@ -86,7 +86,7 @@ test_expect_success 'for-each-ref --contains <inexistent_object>' '
 '
 
 test_expect_success 'for-each-ref --no-contains <existent_object>' '
-	git for-each-ref --no-contains "master" >actual 2>actual.err &&
+	git for-each-ref --no-contains "main" >actual 2>actual.err &&
 	test_line_count = 0 actual &&
 	test_line_count = 0 actual.err
 '
t/t0050-filesystem.sh +3 -3
index 608673fb77..e3412b896b 100755
@@ -65,7 +65,7 @@ test_expect_success "setup case tests" '
 	git mv camelcase tmp &&
 	git mv tmp CamelCase &&
 	git commit -m "rename" &&
-	git checkout -f master
+	git checkout -f main
 '
 
 test_expect_success 'rename (case change)' '
@@ -118,7 +118,7 @@ test_expect_success "setup unicode normalization tests" '
 	git mv $aumlcdiar tmp &&
 	git mv tmp "$auml" &&
 	git commit -m rename &&
-	git checkout -f master
+	git checkout -f main
 '
 
 $test_unicode 'rename (silent unicode normalization)' '
@@ -147,7 +147,7 @@ test_expect_success CASE_INSENSITIVE_FS 'checkout with no pathspec and a case in
 		git add gitweb &&
 		git commit -m "add gitweb/subdir/file" &&
 
-		git checkout master
+		git checkout main
 	)
 '
 
t/t0060-path-utils.sh +2 -2
index 928eebbdc0..fab077b6f7 100755
@@ -312,8 +312,8 @@ test_git_path GIT_COMMON_DIR=bar info/sparse-checkout     .git/info/sparse-check
 test_git_path GIT_COMMON_DIR=bar info//sparse-checkout    .git/info//sparse-checkout
 test_git_path GIT_COMMON_DIR=bar remotes/bar              bar/remotes/bar
 test_git_path GIT_COMMON_DIR=bar branches/bar             bar/branches/bar
-test_git_path GIT_COMMON_DIR=bar logs/refs/heads/master     bar/logs/refs/heads/master
-test_git_path GIT_COMMON_DIR=bar refs/heads/master          bar/refs/heads/master
+test_git_path GIT_COMMON_DIR=bar logs/refs/heads/main     bar/logs/refs/heads/main
+test_git_path GIT_COMMON_DIR=bar refs/heads/main          bar/refs/heads/main
 test_git_path GIT_COMMON_DIR=bar refs/bisect/foo          .git/refs/bisect/foo
 test_git_path GIT_COMMON_DIR=bar hooks/me                 bar/hooks/me
 test_git_path GIT_COMMON_DIR=bar config                   bar/config
t/t0100-previous.sh +9 -9
index 58c0b7e9b6..dfb367b720 100755
@@ -8,7 +8,7 @@ test_expect_success 'branch -d @{-1}' '
 	test_commit A &&
 	git checkout -b junk &&
 	git checkout - &&
-	test "$(git symbolic-ref HEAD)" = refs/heads/master &&
+	test "$(git symbolic-ref HEAD)" = refs/heads/main &&
 	git branch -d @{-1} &&
 	test_must_fail git rev-parse --verify refs/heads/junk
 '
@@ -17,9 +17,9 @@ test_expect_success 'branch -d @{-12} when there is not enough switches yet' '
 	git reflog expire --expire=now &&
 	git checkout -b junk2 &&
 	git checkout - &&
-	test "$(git symbolic-ref HEAD)" = refs/heads/master &&
+	test "$(git symbolic-ref HEAD)" = refs/heads/main &&
 	test_must_fail git branch -d @{-12} &&
-	git rev-parse --verify refs/heads/master
+	git rev-parse --verify refs/heads/main
 '
 
 test_expect_success 'merge @{-1}' '
@@ -28,19 +28,19 @@ test_expect_success 'merge @{-1}' '
 	git checkout A &&
 	test_commit C &&
 	test_commit D &&
-	git branch -f master B &&
+	git branch -f main B &&
 	git branch -f other &&
 	git checkout other &&
-	git checkout master &&
+	git checkout main &&
 	git merge @{-1} &&
 	git cat-file commit HEAD | grep "Merge branch '\''other'\''"
 '
 
 test_expect_success 'merge @{-1}~1' '
-	git checkout master &&
+	git checkout main &&
 	git reset --hard B &&
 	git checkout other &&
-	git checkout master &&
+	git checkout main &&
 	git merge @{-1}~1 &&
 	git cat-file commit HEAD >actual &&
 	grep "Merge branch '\''other'\''" actual
@@ -48,11 +48,11 @@ test_expect_success 'merge @{-1}~1' '
 
 test_expect_success 'merge @{-100} before checking out that many branches yet' '
 	git reflog expire --expire=now &&
-	git checkout -f master &&
+	git checkout -f main &&
 	git reset --hard B &&
 	git branch -f other C &&
 	git checkout other &&
-	git checkout master &&
+	git checkout main &&
 	test_must_fail git merge @{-100}
 '
 
t/t1004-read-tree-m-u-wf.sh +20 -20
index 181956b241..c8a81f180f 100755
@@ -20,17 +20,17 @@ test_expect_success 'two-way setup' '
 	git branch side &&
 	git tag -f branch-point &&
 
-	echo file2 is not tracked on the master branch anymore &&
+	echo file2 is not tracked on the main branch anymore &&
 	rm -f file2 subdir/file2 &&
 	git update-index --remove file2 subdir/file2 &&
-	git commit -a -m "master removes file2 and subdir/file2"
+	git commit -a -m "main removes file2 and subdir/file2"
 '
 
 test_expect_success 'two-way not clobbering' '
 
-	echo >file2 master creates untracked file2 &&
-	echo >subdir/file2 master creates untracked subdir/file2 &&
-	if err=$(read_tree_u_must_succeed -m -u master side 2>&1)
+	echo >file2 main creates untracked file2 &&
+	echo >subdir/file2 main creates untracked subdir/file2 &&
+	if err=$(read_tree_u_must_succeed -m -u main side 2>&1)
 	then
 		echo should have complained
 		false
@@ -43,7 +43,7 @@ echo file2 >.gitignore
 
 test_expect_success 'two-way with incorrect --exclude-per-directory (1)' '
 
-	if err=$(read_tree_u_must_succeed -m --exclude-per-directory=.gitignore master side 2>&1)
+	if err=$(read_tree_u_must_succeed -m --exclude-per-directory=.gitignore main side 2>&1)
 	then
 		echo should have complained
 		false
@@ -54,7 +54,7 @@ test_expect_success 'two-way with incorrect --exclude-per-directory (1)' '
 
 test_expect_success 'two-way with incorrect --exclude-per-directory (2)' '
 
-	if err=$(read_tree_u_must_succeed -m -u --exclude-per-directory=foo --exclude-per-directory=.gitignore master side 2>&1)
+	if err=$(read_tree_u_must_succeed -m -u --exclude-per-directory=foo --exclude-per-directory=.gitignore main side 2>&1)
 	then
 		echo should have complained
 		false
@@ -65,7 +65,7 @@ test_expect_success 'two-way with incorrect --exclude-per-directory (2)' '
 
 test_expect_success 'two-way clobbering a ignored file' '
 
-	read_tree_u_must_succeed -m -u --exclude-per-directory=.gitignore master side
+	read_tree_u_must_succeed -m -u --exclude-per-directory=.gitignore main side
 '
 
 rm -f .gitignore
@@ -81,21 +81,21 @@ test_expect_success 'three-way not complaining on an untracked path in both' '
 	git update-index --add file3 subdir/file3 &&
 	git commit -a -m "side adds file3 and removes file2" &&
 
-	git checkout master &&
-	echo >file2 file two is untracked on the master side &&
-	echo >subdir/file2 file two is untracked on the master side &&
+	git checkout main &&
+	echo >file2 file two is untracked on the main side &&
+	echo >subdir/file2 file two is untracked on the main side &&
 
-	read_tree_u_must_succeed -m -u branch-point master side
+	read_tree_u_must_succeed -m -u branch-point main side
 '
 
 test_expect_success 'three-way not clobbering a working tree file' '
 
 	git reset --hard &&
 	rm -f file2 subdir/file2 file3 subdir/file3 &&
-	git checkout master &&
-	echo >file3 file three created in master, untracked &&
-	echo >subdir/file3 file three created in master, untracked &&
-	if err=$(read_tree_u_must_succeed -m -u branch-point master side 2>&1)
+	git checkout main &&
+	echo >file3 file three created in main, untracked &&
+	echo >subdir/file3 file three created in main, untracked &&
+	if err=$(read_tree_u_must_succeed -m -u branch-point main side 2>&1)
 	then
 		echo should have complained
 		false
@@ -110,11 +110,11 @@ test_expect_success 'three-way not complaining on an untracked file' '
 
 	git reset --hard &&
 	rm -f file2 subdir/file2 file3 subdir/file3 &&
-	git checkout master &&
-	echo >file3 file three created in master, untracked &&
-	echo >subdir/file3 file three created in master, untracked &&
+	git checkout main &&
+	echo >file3 file three created in main, untracked &&
+	echo >subdir/file3 file three created in main, untracked &&
 
-	read_tree_u_must_succeed -m -u --exclude-per-directory=.gitignore branch-point master side
+	read_tree_u_must_succeed -m -u --exclude-per-directory=.gitignore branch-point main side
 '
 
 test_expect_success '3-way not overwriting local changes (setup)' '
t/t1008-read-tree-overlay.sh +1 -1
index cf96016844..2a757bd6d5 100755
@@ -22,7 +22,7 @@ test_expect_success setup '
 '
 
 test_expect_success 'multi-read' '
-	read_tree_must_succeed initial master side &&
+	read_tree_must_succeed initial main side &&
 	test_write_lines a b/c >expect &&
 	git ls-files >actual &&
 	test_cmp expect actual
t/t1009-read-tree-new-index.sh +2 -2
index 59b3aa4bc4..7302adfb20 100755
@@ -12,13 +12,13 @@ test_expect_success setup '
 
 test_expect_success 'non-existent index file' '
 	rm -f new-index &&
-	GIT_INDEX_FILE=new-index git read-tree master
+	GIT_INDEX_FILE=new-index git read-tree main
 '
 
 test_expect_success 'empty index file' '
 	rm -f new-index &&
 	> new-index &&
-	GIT_INDEX_FILE=new-index git read-tree master
+	GIT_INDEX_FILE=new-index git read-tree main
 '
 
 test_done
t/t1011-read-tree-sparse-checkout.sh +1 -1
index 140f459977..dfe9794a74 100755
@@ -2,7 +2,7 @@
 
 test_description='sparse checkout tests
 
-* (tag: removed, master) removed
+* (tag: removed, main) removed
 | D	sub/added
 * (HEAD, tag: top) modified and added
 | M	init.t
t/t1021-rerere-in-workdir.sh +1 -1
index 301e071ff7..a32b4a50e0 100755
@@ -19,7 +19,7 @@ test_expect_success SYMLINKS setup '
 	test_tick &&
 	git commit -a -m goodbye &&
 
-	git checkout master
+	git checkout main
 '
 
 test_expect_success SYMLINKS 'rerere in workdir' '
t/t1090-sparse-checkout-scope.sh +5 -5
index f35a73dd20..6c253fd526 100755
@@ -20,18 +20,18 @@ test_expect_success 'create feature branch' '
 	git commit -m "modification"
 '
 
-test_expect_success 'perform sparse checkout of master' '
+test_expect_success 'perform sparse checkout of main' '
 	git config --local --bool core.sparsecheckout true &&
 	echo "!/*" >.git/info/sparse-checkout &&
 	echo "/a" >>.git/info/sparse-checkout &&
 	echo "/c" >>.git/info/sparse-checkout &&
-	git checkout master &&
+	git checkout main &&
 	test_path_is_file a &&
 	test_path_is_missing b &&
 	test_path_is_file c
 '
 
-test_expect_success 'merge feature branch into sparse checkout of master' '
+test_expect_success 'merge feature branch into sparse checkout of main' '
 	git merge feature &&
 	test_path_is_file a &&
 	test_path_is_missing b &&
@@ -39,10 +39,10 @@ test_expect_success 'merge feature branch into sparse checkout of master' '
 	test "$(cat c)" = "modified"
 '
 
-test_expect_success 'return to full checkout of master' '
+test_expect_success 'return to full checkout of main' '
 	git checkout feature &&
 	echo "/*" >.git/info/sparse-checkout &&
-	git checkout master &&
+	git checkout main &&
 	test_path_is_file a &&
 	test_path_is_file b &&
 	test_path_is_file c &&
t/t1091-sparse-checkout-builtin.sh +1 -1
index 84acfc48b6..4ee16805bb 100755
@@ -117,7 +117,7 @@ test_expect_success 'interaction with clone --no-checkout (unborn index)' '
 	test_path_is_missing clone_no_checkout/.git/index &&
 
 	# No branch is checked out until we manually switch to one
-	git -C clone_no_checkout switch master &&
+	git -C clone_no_checkout switch main &&
 	test_path_is_file clone_no_checkout/.git/index &&
 	check_files clone_no_checkout a folder1
 '
t/t1300-config.sh +4 -4
index 825d9a184f..11a8e641da 100755
@@ -1054,8 +1054,8 @@ test_expect_success 'check split_cmdline return' "
 	echo foo > foo &&
 	git add foo &&
 	git commit -m 'initial commit' &&
-	git config branch.master.mergeoptions 'echo \"' &&
-	test_must_fail git merge master
+	git config branch.main.mergeoptions 'echo \"' &&
+	test_must_fail git merge main
 "
 
 test_expect_success 'git -c "key=value" support' '
@@ -1769,11 +1769,11 @@ test_expect_success '--show-origin blob' '
 
 test_expect_success '--show-origin blob ref' '
 	cat >expect <<-\EOF &&
-	blob:master:custom.conf	user.custom=true
+	blob:main:custom.conf	user.custom=true
 	EOF
 	git add "$CUSTOM_CONFIG_FILE" &&
 	git commit -m "new config file" &&
-	git config --blob=master:"$CUSTOM_CONFIG_FILE" --show-origin --list >output &&
+	git config --blob=main:"$CUSTOM_CONFIG_FILE" --show-origin --list >output &&
 	test_cmp expect output
 '
 
t/t1301-shared-repo.sh +2 -2
index 2dc853d1be..b0236ffe4a 100755
@@ -115,13 +115,13 @@ test_expect_success POSIXPERM 'git reflog expire honors core.sharedRepository' '
 	umask 077 &&
 	git config core.sharedRepository group &&
 	git reflog expire --all &&
-	actual="$(ls -l .git/logs/refs/heads/master)" &&
+	actual="$(ls -l .git/logs/refs/heads/main)" &&
 	case "$actual" in
 	-rw-rw-*)
 		: happy
 		;;
 	*)
-		echo Ooops, .git/logs/refs/heads/master is not 0662 [$actual]
+		echo Ooops, .git/logs/refs/heads/main is not 0662 [$actual]
 		false
 		;;
 	esac
t/t1305-config-include.sh +1 -1
index f1e1b289f9..938ca17d78 100755
@@ -312,7 +312,7 @@ test_expect_success SYMLINKS 'conditional include, gitdir matching symlink, icas
 test_expect_success 'conditional include, onbranch' '
 	echo "[includeIf \"onbranch:foo-branch\"]path=bar9" >>.git/config &&
 	echo "[test]nine=9" >.git/bar9 &&
-	git checkout -b master &&
+	git checkout -b main &&
 	test_must_fail git config test.nine &&
 	git checkout -b foo-branch &&
 	echo 9 >expect &&
t/t1309-early-config.sh +2 -2
index ebb8e1aecb..598e62eb4c 100755
@@ -91,11 +91,11 @@ test_expect_failure 'ignore .git/ with invalid config' '
 
 test_expect_success 'early config and onbranch' '
 	echo "[broken" >broken &&
-	test_with_config "[includeif \"onbranch:master\"]path=../broken"
+	test_with_config "[includeif \"onbranch:main\"]path=../broken"
 '
 
 test_expect_success 'onbranch config outside of git repo' '
-	test_config_global includeIf.onbranch:master.path non-existent &&
+	test_config_global includeIf.onbranch:main.path non-existent &&
 	nongit git help
 '
 
t/t1400-update-ref.sh +34 -34

155 lines not on this page · raw message

t/t1402-check-ref-format.sh +14 -14
index 98e4a8613b..c19fa344d1 100755
@@ -134,15 +134,15 @@ valid_ref !MINGW "$ref" '--refspec-pattern --allow-onelevel --normalize'
 test_expect_success "check-ref-format --branch @{-1}" '
 	T=$(git write-tree) &&
 	sha1=$(echo A | git commit-tree $T) &&
-	git update-ref refs/heads/master $sha1 &&
-	git update-ref refs/remotes/origin/master $sha1 &&
-	git checkout master &&
-	git checkout origin/master &&
-	git checkout master &&
+	git update-ref refs/heads/main $sha1 &&
+	git update-ref refs/remotes/origin/main $sha1 &&
+	git checkout main &&
+	git checkout origin/main &&
+	git checkout main &&
 	refname=$(git check-ref-format --branch @{-1}) &&
 	test "$refname" = "$sha1" &&
 	refname2=$(git check-ref-format --branch @{-2}) &&
-	test "$refname2" = master'
+	test "$refname2" = main'
 
 test_expect_success 'check-ref-format --branch -naster' '
 	test_must_fail git check-ref-format --branch -naster >actual &&
@@ -154,11 +154,11 @@ test_expect_success 'check-ref-format --branch from subdir' '
 
 	T=$(git write-tree) &&
 	sha1=$(echo A | git commit-tree $T) &&
-	git update-ref refs/heads/master $sha1 &&
-	git update-ref refs/remotes/origin/master $sha1 &&
-	git checkout master &&
-	git checkout origin/master &&
-	git checkout master &&
+	git update-ref refs/heads/main $sha1 &&
+	git update-ref refs/remotes/origin/main $sha1 &&
+	git checkout main &&
+	git checkout origin/main &&
+	git checkout main &&
 	refname=$(
 		cd subdir &&
 		git check-ref-format --branch @{-1}
@@ -171,9 +171,9 @@ test_expect_success 'check-ref-format --branch @{-1} from non-repo' '
 	test_must_be_empty actual
 '
 
-test_expect_success 'check-ref-format --branch master from non-repo' '
-	echo master >expect &&
-	nongit git check-ref-format --branch master >actual &&
+test_expect_success 'check-ref-format --branch main from non-repo' '
+	echo main >expect &&
+	nongit git check-ref-format --branch main >actual &&
 	test_cmp expect actual
 '
 
t/t1403-show-ref.sh +9 -9
index 5d955c3bff..681b7022c3 100755
@@ -9,7 +9,7 @@ test_expect_success setup '
 	git checkout -b side &&
 	test_commit B &&
 	git tag -f -a -m "annotated B" B &&
-	git checkout master &&
+	git checkout main &&
 	test_commit C &&
 	git branch B A^0
 '
@@ -92,23 +92,23 @@ test_expect_success 'show-ref -d' '
 	git show-ref --verify -d refs/tags/A refs/tags/C >actual &&
 	test_cmp expect actual &&
 
-	echo $(git rev-parse refs/heads/master) refs/heads/master >expect &&
-	git show-ref -d master >actual &&
+	echo $(git rev-parse refs/heads/main) refs/heads/main >expect &&
+	git show-ref -d main >actual &&
 	test_cmp expect actual &&
 
-	git show-ref -d heads/master >actual &&
+	git show-ref -d heads/main >actual &&
 	test_cmp expect actual &&
 
-	git show-ref -d refs/heads/master >actual &&
+	git show-ref -d refs/heads/main >actual &&
 	test_cmp expect actual &&
 
-	git show-ref -d --verify refs/heads/master >actual &&
+	git show-ref -d --verify refs/heads/main >actual &&
 	test_cmp expect actual &&
 
-	test_must_fail git show-ref -d --verify master >actual &&
+	test_must_fail git show-ref -d --verify main >actual &&
 	test_must_be_empty actual &&
 
-	test_must_fail git show-ref -d --verify heads/master >actual &&
+	test_must_fail git show-ref -d --verify heads/main >actual &&
 	test_must_be_empty actual &&
 
 	test_must_fail git show-ref --verify -d A C >actual &&
@@ -120,7 +120,7 @@ test_expect_success 'show-ref -d' '
 '
 
 test_expect_success 'show-ref --heads, --tags, --head, pattern' '
-	for branch in B master side
+	for branch in B main side
 	do
 		echo $(git rev-parse refs/heads/$branch) refs/heads/$branch
 	done >expect.heads &&
t/t1405-main-ref-store.sh +21 -21

91 lines not on this page · raw message

t/t1406-submodule-ref-store.sh +15 -15
index 36b7ef5046..e3e3b9c84c 100755
@@ -11,7 +11,7 @@ test_expect_success 'setup' '
 	(
 		cd sub &&
 		test_commit first &&
-		git checkout -b new-master
+		git checkout -b new-main
 	)
 '
 
@@ -27,7 +27,7 @@ test_expect_success 'peel_ref(new-tag)' '
 '
 
 test_expect_success 'create_symref() not allowed' '
-	test_must_fail $RUN create-symref FOO refs/heads/master nothing
+	test_must_fail $RUN create-symref FOO refs/heads/main nothing
 '
 
 test_expect_success 'delete_refs() not allowed' '
@@ -35,14 +35,14 @@ test_expect_success 'delete_refs() not allowed' '
 '
 
 test_expect_success 'rename_refs() not allowed' '
-	test_must_fail $RUN rename-ref refs/heads/master refs/heads/new-master
+	test_must_fail $RUN rename-ref refs/heads/main refs/heads/new-main
 '
 
 test_expect_success 'for_each_ref(refs/heads/)' '
 	$RUN for-each-ref refs/heads/ | cut -d" " -f 2- >actual &&
 	cat >expected <<-\EOF &&
-	master 0x0
-	new-master 0x0
+	main 0x0
+	new-main 0x0
 	EOF
 	test_cmp expected actual
 '
@@ -53,23 +53,23 @@ test_expect_success 'for_each_ref() is sorted' '
 	test_cmp expected actual
 '
 
-test_expect_success 'resolve_ref(master)' '
-	SHA1=`git -C sub rev-parse master` &&
-	echo "$SHA1 refs/heads/master 0x0" >expected &&
-	$RUN resolve-ref refs/heads/master 0 >actual &&
+test_expect_success 'resolve_ref(main)' '
+	SHA1=`git -C sub rev-parse main` &&
+	echo "$SHA1 refs/heads/main 0x0" >expected &&
+	$RUN resolve-ref refs/heads/main 0 >actual &&
 	test_cmp expected actual
 '
 
-test_expect_success 'verify_ref(new-master)' '
-	$RUN verify-ref refs/heads/new-master
+test_expect_success 'verify_ref(new-main)' '
+	$RUN verify-ref refs/heads/new-main
 '
 
 test_expect_success 'for_each_reflog()' '
 	$RUN for-each-reflog | sort | cut -d" " -f 2- >actual &&
 	cat >expected <<-\EOF &&
 	HEAD 0x1
-	refs/heads/master 0x0
-	refs/heads/new-master 0x0
+	refs/heads/main 0x0
+	refs/heads/new-main 0x0
 	EOF
 	test_cmp expected actual
 '
@@ -77,12 +77,12 @@ test_expect_success 'for_each_reflog()' '
 test_expect_success 'for_each_reflog_ent()' '
 	$RUN for-each-reflog-ent HEAD >actual &&
 	head -n1 actual | grep first &&
-	tail -n2 actual | head -n1 | grep master.to.new
+	tail -n2 actual | head -n1 | grep main.to.new
 '
 
 test_expect_success 'for_each_reflog_ent_reverse()' '
 	$RUN for-each-reflog-ent-reverse HEAD >actual &&
-	head -n1 actual | grep master.to.new &&
+	head -n1 actual | grep main.to.new &&
 	tail -n2 actual | head -n1 | grep first
 '
 
t/t1407-worktree-ref-store.sh +16 -16
index 9a84858118..71059cb254 100755
@@ -9,7 +9,7 @@ RMAIN="test-tool ref-store worktree:main"
 
 test_expect_success 'setup' '
 	test_commit first &&
-	git worktree add -b wt-master wt &&
+	git worktree add -b wt-main wt &&
 	(
 		cd wt &&
 		test_commit second
@@ -17,34 +17,34 @@ test_expect_success 'setup' '
 '
 
 test_expect_success 'resolve_ref(<shared-ref>)' '
-	SHA1=`git rev-parse master` &&
-	echo "$SHA1 refs/heads/master 0x0" >expected &&
-	$RWT resolve-ref refs/heads/master 0 >actual &&
+	SHA1=`git rev-parse main` &&
+	echo "$SHA1 refs/heads/main 0x0" >expected &&
+	$RWT resolve-ref refs/heads/main 0 >actual &&
 	test_cmp expected actual &&
-	$RMAIN resolve-ref refs/heads/master 0 >actual &&
+	$RMAIN resolve-ref refs/heads/main 0 >actual &&
 	test_cmp expected actual
 '
 
 test_expect_success 'resolve_ref(<per-worktree-ref>)' '
 	SHA1=`git -C wt rev-parse HEAD` &&
-	echo "$SHA1 refs/heads/wt-master 0x1" >expected &&
+	echo "$SHA1 refs/heads/wt-main 0x1" >expected &&
 	$RWT resolve-ref HEAD 0 >actual &&
 	test_cmp expected actual &&
 
 	SHA1=`git rev-parse HEAD` &&
-	echo "$SHA1 refs/heads/master 0x1" >expected &&
+	echo "$SHA1 refs/heads/main 0x1" >expected &&
 	$RMAIN resolve-ref HEAD 0 >actual &&
 	test_cmp expected actual
 '
 
-test_expect_success 'create_symref(FOO, refs/heads/master)' '
-	$RWT create-symref FOO refs/heads/master nothing &&
-	echo refs/heads/master >expected &&
+test_expect_success 'create_symref(FOO, refs/heads/main)' '
+	$RWT create-symref FOO refs/heads/main nothing &&
+	echo refs/heads/main >expected &&
 	git -C wt symbolic-ref FOO >actual &&
 	test_cmp expected actual &&
 
-	$RMAIN create-symref FOO refs/heads/wt-master nothing &&
-	echo refs/heads/wt-master >expected &&
+	$RMAIN create-symref FOO refs/heads/wt-main nothing &&
+	echo refs/heads/wt-main >expected &&
 	git symbolic-ref FOO >actual &&
 	test_cmp expected actual
 '
@@ -63,8 +63,8 @@ test_expect_success 'for_each_reflog()' '
 	HEAD 0x1
 	PSEUDO-WT 0x0
 	refs/bisect/wt-random 0x0
-	refs/heads/master 0x0
-	refs/heads/wt-master 0x0
+	refs/heads/main 0x0
+	refs/heads/wt-main 0x0
 	EOF
 	test_cmp expected actual &&
 
@@ -73,8 +73,8 @@ test_expect_success 'for_each_reflog()' '
 	HEAD 0x1
 	PSEUDO-MAIN 0x0
 	refs/bisect/random 0x0
-	refs/heads/master 0x0
-	refs/heads/wt-master 0x0
+	refs/heads/main 0x0
+	refs/heads/wt-main 0x0
 	EOF
 	test_cmp expected actual
 '
t/t1408-packed-refs.sh +6 -6
index 1e44a17eea..f40e7af8ce 100755
@@ -9,32 +9,32 @@ test_expect_success setup '
 	git commit --allow-empty -m one &&
 	one=$(git rev-parse HEAD) &&
 	git for-each-ref >actual &&
-	echo "$one commit	refs/heads/master" >expect &&
+	echo "$one commit	refs/heads/main" >expect &&
 	test_cmp expect actual &&
 
 	git pack-refs --all &&
 	git for-each-ref >actual &&
-	echo "$one commit	refs/heads/master" >expect &&
+	echo "$one commit	refs/heads/main" >expect &&
 	test_cmp expect actual &&
 
 	git checkout --orphan another &&
 	test_tick &&
 	git commit --allow-empty -m two &&
 	two=$(git rev-parse HEAD) &&
-	git checkout -B master &&
+	git checkout -B main &&
 	git branch -D another &&
 
 	git for-each-ref >actual &&
-	echo "$two commit	refs/heads/master" >expect &&
+	echo "$two commit	refs/heads/main" >expect &&
 	test_cmp expect actual &&
 
 	git reflog expire --expire=now --all &&
 	git prune &&
-	git tag -m v1.0 v1.0 master
+	git tag -m v1.0 v1.0 main
 '
 
 test_expect_success 'no error from stale entry in packed-refs' '
-	git describe master >actual 2>&1 &&
+	git describe main >actual 2>&1 &&
 	echo "v1.0" >expect &&
 	test_cmp expect actual
 '
t/t1410-reflog.sh +28 -28

161 lines not on this page · raw message

t/t1411-reflog-show.sh +1 -1
index 985daf1def..333b35aebc 100755
@@ -167,7 +167,7 @@ test_expect_success 'git log -g -p shows diffs vs. parents' '
 '
 
 test_expect_success 'reflog exists works' '
-	git reflog exists refs/heads/master &&
+	git reflog exists refs/heads/main &&
 	! git reflog exists refs/heads/nonexistent
 '
 
t/t1413-reflog-detach.sh +12 -12
index c730600d8a..b1f7f35fe9 100755
@@ -4,7 +4,7 @@ test_description='Test reflog interaction with detached HEAD'
 . ./test-lib.sh
 
 reset_state () {
-	git checkout master &&
+	git checkout main &&
 	cp saved_reflog .git/logs/HEAD
 }
 
@@ -19,14 +19,14 @@ test_expect_success setup '
 
 test_expect_success baseline '
 	reset_state &&
-	git rev-parse master master^ >expect &&
+	git rev-parse main main^ >expect &&
 	git log -g --format=%H >actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'switch to branch' '
 	reset_state &&
-	git rev-parse side master master^ >expect &&
+	git rev-parse side main main^ >expect &&
 	git checkout side &&
 	git log -g --format=%H >actual &&
 	test_cmp expect actual
@@ -34,34 +34,34 @@ test_expect_success 'switch to branch' '
 
 test_expect_success 'detach to other' '
 	reset_state &&
-	git rev-parse master side master master^ >expect &&
+	git rev-parse main side main main^ >expect &&
 	git checkout side &&
-	git checkout master^0 &&
+	git checkout main^0 &&
 	git log -g --format=%H >actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'detach to self' '
 	reset_state &&
-	git rev-parse master master master^ >expect &&
-	git checkout master^0 &&
+	git rev-parse main main main^ >expect &&
+	git checkout main^0 &&
 	git log -g --format=%H >actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'attach to self' '
 	reset_state &&
-	git rev-parse master master master master^ >expect &&
-	git checkout master^0 &&
-	git checkout master &&
+	git rev-parse main main main main^ >expect &&
+	git checkout main^0 &&
+	git checkout main &&
 	git log -g --format=%H >actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'attach to other' '
 	reset_state &&
-	git rev-parse side master master master^ >expect &&
-	git checkout master^0 &&
+	git rev-parse side main main main^ >expect &&
+	git checkout main^0 &&
 	git checkout side &&
 	git log -g --format=%H >actual &&
 	test_cmp expect actual
t/t1414-reflog-walk.sh +6 -6
index 1181a9fb28..89458b7158 100755
@@ -8,7 +8,7 @@ test_expect_success 'set up some reflog entries' '
 	test_commit two &&
 	git checkout -b side HEAD^ &&
 	test_commit three &&
-	git merge --no-commit master &&
+	git merge --no-commit main &&
 	echo evil-merge-content >>one.t &&
 	test_tick &&
 	git commit --no-edit -a
@@ -20,9 +20,9 @@ do_walk () {
 
 test_expect_success 'set up expected reflog' '
 	cat >expect.all <<-EOF
-	HEAD@{0} commit (merge): Merge branch ${SQ}master${SQ} into side
+	HEAD@{0} commit (merge): Merge branch ${SQ}main${SQ} into side
 	HEAD@{1} commit: three
-	HEAD@{2} checkout: moving from master to side
+	HEAD@{2} checkout: moving from main to side
 	HEAD@{3} commit: two
 	HEAD@{4} commit (initial): one
 	EOF
@@ -73,15 +73,15 @@ test_expect_success 'walking multiple reflogs shows all' '
 	#      sort ignores the bits after the timestamp.
 	#
 	#   2. POSIX leaves undefined whether this is a stable sort or not. So
-	#      we use "-k 1" to ensure that we see HEAD before master before
+	#      we use "-k 1" to ensure that we see HEAD before main before
 	#      side when breaking ties.
 	{
 		do_walk --date=unix HEAD &&
 		do_walk --date=unix side &&
-		do_walk --date=unix master
+		do_walk --date=unix main
 	} >expect.raw &&
 	sort -t "{" -k 2nr -k 1 <expect.raw >expect &&
-	do_walk --date=unix HEAD master side >actual &&
+	do_walk --date=unix HEAD main side >actual &&
 	test_cmp expect actual
 '
 
t/t1416-ref-transaction-hooks.sh +5 -5
index f6e741c6c0..4cabc07c86 100755
@@ -53,11 +53,11 @@ test_expect_success 'hook gets all queued updates in prepared state' '
 	EOF
 	cat >expect <<-EOF &&
 		$ZERO_OID $POST_OID HEAD
-		$ZERO_OID $POST_OID refs/heads/master
+		$ZERO_OID $POST_OID refs/heads/main
 	EOF
 	git update-ref HEAD POST <<-EOF &&
 		update HEAD $ZERO_OID $POST_OID
-		update refs/heads/master $ZERO_OID $POST_OID
+		update refs/heads/main $ZERO_OID $POST_OID
 	EOF
 	test_cmp expect actual
 '
@@ -76,7 +76,7 @@ test_expect_success 'hook gets all queued updates in committed state' '
 	EOF
 	cat >expect <<-EOF &&
 		$ZERO_OID $POST_OID HEAD
-		$ZERO_OID $POST_OID refs/heads/master
+		$ZERO_OID $POST_OID refs/heads/main
 	EOF
 	git update-ref HEAD POST &&
 	test_cmp expect actual
@@ -96,12 +96,12 @@ test_expect_success 'hook gets all queued updates in aborted state' '
 	EOF
 	cat >expect <<-EOF &&
 		$ZERO_OID $POST_OID HEAD
-		$ZERO_OID $POST_OID refs/heads/master
+		$ZERO_OID $POST_OID refs/heads/main
 	EOF
 	git update-ref --stdin <<-EOF &&
 		start
 		update HEAD POST $ZERO_OID
-		update refs/heads/master POST $ZERO_OID
+		update refs/heads/main POST $ZERO_OID
 		abort
 	EOF
 	test_cmp expect actual
t/t1430-bad-ref-name.sh +26 -26

193 lines not on this page · raw message

t/t1450-fsck.sh +1 -1
index b17f5c21fb..a30fc5f74a 100755
@@ -3,7 +3,7 @@
 test_description='git fsck random collection of tests
 
 * (HEAD) B
-* (master) A
+* (main) A
 '
 
 . ./test-lib.sh
t/t1500-rev-parse.sh +2 -2
index 408b97d5af..a85692ffff 100755
@@ -174,8 +174,8 @@ test_expect_success 'showing the superproject correctly' '
 	test_commit -C super/dir/sub branch1_commit &&
 	git -C super add dir/sub &&
 	test_commit -C super branch1_commit &&
-	git -C super checkout -b branch2 master &&
-	git -C super/dir/sub checkout -b branch2 master &&
+	git -C super checkout -b branch2 main &&
+	git -C super/dir/sub checkout -b branch2 main &&
 	test_commit -C super/dir/sub branch2_commit &&
 	git -C super add dir/sub &&
 	test_commit -C super branch2_commit &&
t/t1503-rev-parse-verify.sh +14 -14
index dc9fe3cbf1..de63186587 100755
@@ -51,8 +51,8 @@ test_expect_success 'works with one good rev' '
 	test "$rev_hash3" = "$HASH3" &&
 	rev_hash4=$(git rev-parse --verify $HASH4) &&
 	test "$rev_hash4" = "$HASH4" &&
-	rev_master=$(git rev-parse --verify master) &&
-	test "$rev_master" = "$HASH4" &&
+	rev_main=$(git rev-parse --verify main) &&
+	test "$rev_main" = "$HASH4" &&
 	rev_head=$(git rev-parse --verify HEAD) &&
 	test "$rev_head" = "$HASH4"
 '
@@ -116,27 +116,27 @@ test_expect_success 'no stdout output on error' '
 '
 
 test_expect_success 'use --default' '
-	git rev-parse --verify --default master &&
-	git rev-parse --verify --default master HEAD &&
-	git rev-parse --default master --verify &&
-	git rev-parse --default master --verify HEAD &&
-	git rev-parse --verify HEAD --default master &&
-	test_must_fail git rev-parse --verify foo --default master &&
+	git rev-parse --verify --default main &&
+	git rev-parse --verify --default main HEAD &&
+	git rev-parse --default main --verify &&
+	git rev-parse --default main --verify HEAD &&
+	git rev-parse --verify HEAD --default main &&
+	test_must_fail git rev-parse --verify foo --default main &&
 	test_must_fail git rev-parse --default HEAD --verify bar &&
 	test_must_fail git rev-parse --verify --default HEAD baz &&
 	test_must_fail git rev-parse --default foo --verify &&
 	test_must_fail git rev-parse --verify --default bar
 '
 
-test_expect_success 'master@{n} for various n' '
+test_expect_success 'main@{n} for various n' '
 	N=$(git reflog | wc -l) &&
 	Nm1=$(($N-1)) &&
 	Np1=$(($N+1)) &&
-	git rev-parse --verify master@{0} &&
-	git rev-parse --verify master@{1} &&
-	git rev-parse --verify master@{$Nm1} &&
-	test_must_fail git rev-parse --verify master@{$N} &&
-	test_must_fail git rev-parse --verify master@{$Np1}
+	git rev-parse --verify main@{0} &&
+	git rev-parse --verify main@{1} &&
+	git rev-parse --verify main@{$Nm1} &&
+	test_must_fail git rev-parse --verify main@{$N} &&
+	test_must_fail git rev-parse --verify main@{$Np1}
 '
 
 test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' '
t/t1505-rev-parse-last.sh +4 -4
index 4969edb314..a64cd4ce14 100755
@@ -20,12 +20,12 @@ test_expect_success 'setup' '
 	make_commit 3 &&
 	git checkout side &&
 	make_commit 4 &&
-	git merge master &&
-	git checkout master
+	git merge main &&
+	git checkout main
 
 '
 
-# 1 -- 2 -- 3 master
+# 1 -- 2 -- 3 main
 #  \         \
 #   \         \
 #    --- 4 --- 5 side
@@ -49,7 +49,7 @@ test_expect_success '@{-1}@{1} works' '
 '
 
 test_expect_success '@{-2} works' '
-	test_cmp_rev master @{-2}
+	test_cmp_rev main @{-2}
 '
 
 test_expect_success '@{-3} fails' '
t/t1506-rev-parse-diagnosis.sh +2 -2
index e2ae15a2cf..8b183f1de1 100755
@@ -137,10 +137,10 @@ test_expect_success 'incorrect file in :path and :N:path' '
 '
 
 test_expect_success 'invalid @{n} reference' '
-	test_must_fail git rev-parse master@{99999} >output 2>error &&
+	test_must_fail git rev-parse main@{99999} >output 2>error &&
 	test_must_be_empty output &&
 	test_i18ngrep "log for [^ ]* only has [0-9][0-9]* entries" error  &&
-	test_must_fail git rev-parse --verify master@{99999} >output 2>error &&
+	test_must_fail git rev-parse --verify main@{99999} >output 2>error &&
 	test_must_be_empty output &&
 	test_i18ngrep "log for [^ ]* only has [0-9][0-9]* entries" error
 '
t/t1507-rev-parse-upstream.sh +20 -20
index dfc0d96d8a..d49998ceb6 100755
@@ -10,20 +10,20 @@ test_expect_success 'setup' '
 	test_commit 1 &&
 	git checkout -b side &&
 	test_commit 2 &&
-	git checkout master &&
+	git checkout main &&
 	git clone . clone &&
 	test_commit 3 &&
 	(cd clone &&
 	 test_commit 4 &&
 	 git branch --track my-side origin/side &&
-	 git branch --track local-master master &&
+	 git branch --track local-main main &&
 	 git branch --track fun@ny origin/side &&
 	 git branch --track @funny origin/side &&
 	 git branch --track funny@ origin/side &&
-	 git remote add -t master master-only .. &&
-	 git fetch master-only &&
+	 git remote add -t main main-only .. &&
+	 git fetch main-only &&
 	 git branch bad-upstream &&
-	 git config branch.bad-upstream.remote master-only &&
+	 git config branch.bad-upstream.remote main-only &&
 	 git config branch.bad-upstream.merge refs/heads/side
 	)
 '
@@ -39,7 +39,7 @@ error_message () {
 }
 
 test_expect_success '@{upstream} resolves to correct full name' '
-	echo refs/remotes/origin/master >expect &&
+	echo refs/remotes/origin/main >expect &&
 	git -C clone rev-parse --symbolic-full-name @{upstream} >actual &&
 	test_cmp expect actual &&
 	git -C clone rev-parse --symbolic-full-name @{UPSTREAM} >actual &&
@@ -49,7 +49,7 @@ test_expect_success '@{upstream} resolves to correct full name' '
 '
 
 test_expect_success '@{u} resolves to correct full name' '
-	echo refs/remotes/origin/master >expect &&
+	echo refs/remotes/origin/main >expect &&
 	git -C clone rev-parse --symbolic-full-name @{u} >actual &&
 	test_cmp expect actual &&
 	git -C clone rev-parse --symbolic-full-name @{U} >actual &&
@@ -132,7 +132,7 @@ test_expect_success 'checkout -b new my-side@{u} forks from the same' '
 test_expect_success 'merge my-side@{u} records the correct name' '
 (
 	cd clone &&
-	git checkout master &&
+	git checkout main &&
 	test_might_fail git branch -D new &&
 	git branch -t new my-side@{u} &&
 	git merge -s ours new@{u} &&
@@ -143,24 +143,24 @@ test_expect_success 'merge my-side@{u} records the correct name' '
 '
 
 test_expect_success 'branch -d other@{u}' '
-	git checkout -t -b other master &&
+	git checkout -t -b other main &&
 	git branch -d @{u} &&
-	git for-each-ref refs/heads/master >actual &&
+	git for-each-ref refs/heads/main >actual &&
 	test_must_be_empty actual
 '
 
 test_expect_success 'checkout other@{u}' '
-	git branch -f master HEAD &&
-	git checkout -t -b another master &&
+	git branch -f main HEAD &&
+	git checkout -t -b another main &&
 	git checkout @{u} &&
 	git symbolic-ref HEAD >actual &&
-	echo refs/heads/master >expect &&
+	echo refs/heads/main >expect &&
 	test_cmp expect actual
 '
 
 test_expect_success 'branch@{u} works when tracking a local branch' '
-	echo refs/heads/master >expect &&
-	git -C clone rev-parse --symbolic-full-name local-master@{u} >actual &&
+	echo refs/heads/main >expect &&
+	git -C clone rev-parse --symbolic-full-name local-main@{u} >actual &&
 	test_cmp expect actual
 '
 
@@ -174,7 +174,7 @@ test_expect_success 'branch@{u} error message when no upstream' '
 
 test_expect_success '@{u} error message when no upstream' '
 	cat >expect <<-EOF &&
-	fatal: no upstream configured for branch ${SQ}master${SQ}
+	fatal: no upstream configured for branch ${SQ}main${SQ}
 	EOF
 	test_must_fail git rev-parse --verify @{u} 2>actual &&
 	test_i18ncmp expect actual
@@ -208,14 +208,14 @@ test_expect_success 'branch@{u} error message if upstream branch not fetched' '
 test_expect_success 'pull works when tracking a local branch' '
 (
 	cd clone &&
-	git checkout local-master &&
+	git checkout local-main &&
 	git pull
 )
 '
 
 # makes sense if the previous one succeeded
 test_expect_success '@{u} works when tracking a local branch' '
-	echo refs/heads/master >expect &&
+	echo refs/heads/main >expect &&
 	git -C clone rev-parse --symbolic-full-name @{u} >actual &&
 	test_cmp expect actual
 '
@@ -224,7 +224,7 @@ test_expect_success 'log -g other@{u}' '
 	commit=$(git rev-parse HEAD) &&
 	cat >expect <<-EOF &&
 	commit $commit
-	Reflog: master@{0} (C O Mitter <[email protected]>)
+	Reflog: main@{0} (C O Mitter <[email protected]>)
 	Reflog message: branch: Created from HEAD
 	Author: A U Thor <[email protected]>
 	Date:   Thu Apr 7 15:15:13 2005 -0700
@@ -239,7 +239,7 @@ test_expect_success 'log -g other@{u}@{now}' '
 	commit=$(git rev-parse HEAD) &&
 	cat >expect <<-EOF &&
 	commit $commit
-	Reflog: master@{Thu Apr 7 15:17:13 2005 -0700} (C O Mitter <[email protected]>)
+	Reflog: main@{Thu Apr 7 15:17:13 2005 -0700} (C O Mitter <[email protected]>)
 	Reflog message: branch: Created from HEAD
 	Author: A U Thor <[email protected]>
 	Date:   Thu Apr 7 15:15:13 2005 -0700
t/t1508-at-combinations.sh +5 -5
index 4a9964e9dc..bda6e7900c 100755
@@ -30,8 +30,8 @@ fail() {
 }
 
 test_expect_success 'setup' '
-	test_commit master-one &&
-	test_commit master-two &&
+	test_commit main-one &&
+	test_commit main-two &&
 	git checkout -b upstream-branch &&
 	test_commit upstream-one &&
 	test_commit upstream-two &&
@@ -47,7 +47,7 @@ test_expect_success 'setup' '
 	git checkout -b new-branch &&
 	test_commit new-one &&
 	test_commit new-two &&
-	git branch -u master old-branch &&
+	git branch -u main old-branch &&
 	git branch -u upstream-branch new-branch
 '
 
@@ -62,8 +62,8 @@ check "@{-1}@{1}" commit old-one
 check "@{u}" ref refs/heads/upstream-branch
 check "HEAD@{u}" ref refs/heads/upstream-branch
 check "@{u}@{1}" commit upstream-one
-check "@{-1}@{u}" ref refs/heads/master
-check "@{-1}@{u}@{1}" commit master-one
+check "@{-1}@{u}" ref refs/heads/main
+check "@{-1}@{u}@{1}" commit main-one
 check "@" commit new-two
 check "@@{u}" ref refs/heads/upstream-branch
 check "@@/at-test" ref refs/heads/@@/at-test
t/t1511-rev-parse-caret.sh +13 -13
index e0a49a651f..cc324bea52 100755
@@ -15,7 +15,7 @@ test_expect_success 'setup' '
 	git commit -m Initial &&
 	git tag -a -m commit commit-tag &&
 	git branch ref &&
-	git checkout master &&
+	git checkout main &&
 	echo modified >>a-blob &&
 	git add -u &&
 	git commit -m Modified &&
@@ -73,52 +73,52 @@ test_expect_success 'ref^{tag}' '
 '
 
 test_expect_success 'ref^{/.}' '
-	git rev-parse master >expected &&
-	git rev-parse master^{/.} >actual &&
+	git rev-parse main >expected &&
+	git rev-parse main^{/.} >actual &&
 	test_cmp expected actual
 '
 
 test_expect_success 'ref^{/non-existent}' '
-	test_must_fail git rev-parse master^{/non-existent}
+	test_must_fail git rev-parse main^{/non-existent}
 '
 
 test_expect_success 'ref^{/Initial}' '
 	git rev-parse ref >expected &&
-	git rev-parse master^{/Initial} >actual &&
+	git rev-parse main^{/Initial} >actual &&
 	test_cmp expected actual
 '
 
 test_expect_success 'ref^{/!Exp}' '
-	test_must_fail git rev-parse master^{/!Exp}
+	test_must_fail git rev-parse main^{/!Exp}
 '
 
 test_expect_success 'ref^{/!}' '
-	test_must_fail git rev-parse master^{/!}
+	test_must_fail git rev-parse main^{/!}
 '
 
 test_expect_success 'ref^{/!!Exp}' '
 	git rev-parse expref >expected &&
-	git rev-parse master^{/!!Exp} >actual &&
+	git rev-parse main^{/!!Exp} >actual &&
 	test_cmp expected actual
 '
 
 test_expect_success 'ref^{/!-}' '
-	test_must_fail git rev-parse master^{/!-}
+	test_must_fail git rev-parse main^{/!-}
 '
 
 test_expect_success 'ref^{/!-.}' '
-	test_must_fail git rev-parse master^{/!-.}
+	test_must_fail git rev-parse main^{/!-.}
 '
 
 test_expect_success 'ref^{/!-non-existent}' '
-	git rev-parse master >expected &&
-	git rev-parse master^{/!-non-existent} >actual &&
+	git rev-parse main >expected &&
+	git rev-parse main^{/!-non-existent} >actual &&
 	test_cmp expected actual
 '
 
 test_expect_success 'ref^{/!-Changed}' '
 	git rev-parse expref >expected &&
-	git rev-parse master^{/!-Changed} >actual &&
+	git rev-parse main^{/!-Changed} >actual &&
 	test_cmp expected actual
 '
 
t/t1512-rev-parse-disambiguation.sh +1 -1
index 18fa6cf40d..6b4481d36b 100755
@@ -212,7 +212,7 @@ test_expect_success 'more history' '
 	side=$(git rev-parse HEAD) &&
 
 	# commit 000000000066
-	git checkout master &&
+	git checkout main &&
 
 	# If you use recursive, merge will fail and you will need to
 	# clean up a0blgqsjc as well.  If you use resolve, merge will
t/t1513-rev-parse-prefix.sh +2 -2
index 87ec3ae714..f77e59121c 100755
@@ -76,9 +76,9 @@ test_expect_success 'disambiguate path with valid prefix' '
 '
 
 test_expect_success 'file and refs with prefix' '
-	git rev-parse --prefix sub1/ master file1 >actual &&
+	git rev-parse --prefix sub1/ main file1 >actual &&
 	cat <<-EOF >expected &&
-	$(git rev-parse master)
+	$(git rev-parse main)
 	sub1/file1
 	EOF
 	test_cmp expected actual
t/t1514-rev-parse-push.sh +8 -8
index 788cc91e45..e85b222e99 100755
@@ -16,24 +16,24 @@ test_expect_success 'setup' '
 	git remote add other other.git &&
 	test_commit base &&
 	git push origin HEAD &&
-	git branch --set-upstream-to=origin/master master &&
-	git branch --track topic origin/master &&
+	git branch --set-upstream-to=origin/main main &&
+	git branch --track topic origin/main &&
 	git push origin topic &&
 	git push other topic
 '
 
 test_expect_success '@{push} with default=nothing' '
 	test_config push.default nothing &&
-	test_must_fail git rev-parse master@{push} &&
-	test_must_fail git rev-parse master@{PUSH} &&
-	test_must_fail git rev-parse master@{PuSH}
+	test_must_fail git rev-parse main@{push} &&
+	test_must_fail git rev-parse main@{PUSH} &&
+	test_must_fail git rev-parse main@{PuSH}
 '
 
 test_expect_success '@{push} with default=simple' '
 	test_config push.default simple &&
-	resolve master@{push} refs/remotes/origin/master &&
-	resolve master@{PUSH} refs/remotes/origin/master &&
-	resolve master@{pUSh} refs/remotes/origin/master
+	resolve main@{push} refs/remotes/origin/main &&
+	resolve main@{PUSH} refs/remotes/origin/main &&
+	resolve main@{pUSh} refs/remotes/origin/main
 '
 
 test_expect_success 'triangular @{push} fails with default=simple' '
t/t1700-split-index.sh +1 -1
index 12a5568844..f3309045fe 100755
@@ -496,7 +496,7 @@ test_expect_success 'do not refresh null base index' '
 		test_commit initial &&
 		git checkout -b side-branch &&
 		test_commit extra &&
-		git checkout master &&
+		git checkout main &&
 		git update-index --split-index &&
 		test_commit more &&
 		# must not write a new shareindex, or we wont catch the problem
t/test-lib.sh +7 -0
index a863ccee7e..126004e342 100644
@@ -256,6 +256,13 @@ case "$TRASH_DIRECTORY" in
  *) TRASH_DIRECTORY="$TEST_OUTPUT_DIRECTORY/$TRASH_DIRECTORY" ;;
 esac
 
+case "$TEST_NUMBER" in
+[01]*)
+	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+	;;
+esac
+
 # If --stress was passed, run this test repeatedly in several parallel loops.
 if test "$GIT_TEST_STRESS_STARTED" = "done"
 then
Signature · 1 line
gitgitgadget
#4 lore raw

PATCH 4/28 t3[0-3]*: adjust the references to the default branch name "main"

In reply to Johannes Schindelin via GitGitGadget

From: Johannes Schindelin <[email protected]>

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/*)

This allows us to define GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main for those tests.

---
 t/t3040-subprojects-basic.sh          |   2 +-
 t/t3200-branch.sh                     | 242 +++++++++++++-------------
 t/t3201-branch-contains.sh            |  80 ++++-----
 t/t3202-show-branch-octopus.sh        |   2 +-
 t/t3203-branch-output.sh              |  38 ++--
 t/t3204-branch-name-interpretation.sh |   6 +-
 t/t3205-branch-color.sh               |   6 +-
 t/t3206-range-diff.sh                 |  40 ++---
 t/t3206/history.export                |   2 +-
 t/t3210-pack-refs.sh                  |   4 +-
 t/t3211-peel-ref.sh                   |   4 +-
 t/t3301-notes.sh                      |   6 +-
 t/t3302-notes-index-expensive.sh      |   2 +-
 t/t3303-notes-subtrees.sh             |   8 +-
 t/t3304-notes-mixed.sh                |   8 +-
 t/t3308-notes-merge.sh                |   2 +-
 t/t3320-notes-merge-worktrees.sh      |   4 +-
 t/test-lib.sh                         |   2 +-
 18 files changed, 229 insertions(+), 229 deletions(-)
t/t3040-subprojects-basic.sh +1 -1
index b81eb5fd6f..f3ea8dcf58 100755
@@ -80,6 +80,6 @@ test_expect_success 'checkout in superproject' '
 '
 
 # just interesting what happened...
-# git diff --name-status -M save master
+# git diff --name-status -M save main
 
 test_done
t/t3200-branch.sh +121 -121

619 lines not on this page · raw message

t/t3201-branch-contains.sh +40 -40

223 lines not on this page · raw message

t/t3202-show-branch-octopus.sh +1 -1
index 6adf47869c..97551016ad 100755
@@ -15,7 +15,7 @@ test_expect_success 'setup' '
 
 	for i in $numbers
 	do
-		git checkout -b branch$i master &&
+		git checkout -b branch$i main &&
 		> file$i &&
 		git add file$i &&
 		test_tick &&
t/t3203-branch-output.sh +19 -19
index d65586541d..727c9d9caa 100755
@@ -26,7 +26,7 @@ test_expect_success 'make remote branches' '
 cat >expect <<'EOF'
   branch-one
   branch-two
-* master
+* main
 EOF
 test_expect_success 'git branch shows local branches' '
 	git branch >actual &&
@@ -60,7 +60,7 @@ test_expect_success 'git branch -r shows remote branches' '
 cat >expect <<'EOF'
   branch-one
   branch-two
-* master
+* main
   remotes/origin/HEAD -> origin/branch-one
   remotes/origin/branch-one
   remotes/origin/branch-two
@@ -152,7 +152,7 @@ test_expect_success 'git branch shows detached HEAD properly' '
 * (HEAD detached at $(git rev-parse --short HEAD^0))
   branch-one
   branch-two
-  master
+  main
 EOF
 	git checkout HEAD^0 &&
 	git branch >actual &&
@@ -160,12 +160,12 @@ EOF
 '
 
 test_expect_success 'git branch shows detached HEAD properly after checkout --detach' '
-	git checkout master &&
+	git checkout main &&
 	cat >expect <<EOF &&
 * (HEAD detached at $(git rev-parse --short HEAD^0))
   branch-one
   branch-two
-  master
+  main
 EOF
 	git checkout --detach &&
 	git branch >actual &&
@@ -177,7 +177,7 @@ test_expect_success 'git branch shows detached HEAD properly after moving' '
 * (HEAD detached from $(git rev-parse --short HEAD))
   branch-one
   branch-two
-  master
+  main
 EOF
 	git reset --hard HEAD^1 &&
 	git branch >actual &&
@@ -189,9 +189,9 @@ test_expect_success 'git branch shows detached HEAD properly from tag' '
 * (HEAD detached at fromtag)
   branch-one
   branch-two
-  master
+  main
 EOF
-	git tag fromtag master &&
+	git tag fromtag main &&
 	git checkout fromtag &&
 	git branch >actual &&
 	test_i18ncmp expect actual
@@ -202,7 +202,7 @@ test_expect_success 'git branch shows detached HEAD properly after moving from t
 * (HEAD detached from fromtag)
   branch-one
   branch-two
-  master
+  main
 EOF
 	git reset --hard HEAD^1 &&
 	git branch >actual &&
@@ -214,7 +214,7 @@ test_expect_success 'git branch `--sort` option' '
 	* (HEAD detached from fromtag)
 	  branch-two
 	  branch-one
-	  master
+	  main
 	EOF
 	git branch --sort=objectsize >actual &&
 	test_i18ncmp expect actual
@@ -223,7 +223,7 @@ test_expect_success 'git branch `--sort` option' '
 test_expect_success 'git branch --points-at option' '
 	cat >expect <<-\EOF &&
 	  branch-one
-	  master
+	  main
 	EOF
 	git branch --points-at=branch-one >actual &&
 	test_cmp expect actual
@@ -260,14 +260,14 @@ test_expect_success 'sort branches, ignore case' '
 		cat >expected <<-\EOF &&
 		BRANCH-two
 		branch-one
-		master
+		main
 		EOF
 		test_cmp expected actual &&
 		git branch --list -i | awk "{print \$NF}" >actual &&
 		cat >expected <<-\EOF &&
 		branch-one
 		BRANCH-two
-		master
+		main
 		EOF
 		test_cmp expected actual
 	)
@@ -279,7 +279,7 @@ test_expect_success 'git branch --format option' '
 	Refname is refs/heads/ambiguous
 	Refname is refs/heads/branch-one
 	Refname is refs/heads/branch-two
-	Refname is refs/heads/master
+	Refname is refs/heads/main
 	Refname is refs/heads/ref-to-branch
 	Refname is refs/heads/ref-to-remote
 	EOF
@@ -293,7 +293,7 @@ test_expect_success 'worktree colors correct' '
 	  ambiguous<RESET>
 	  branch-one<RESET>
 	+ <CYAN>branch-two<RESET>
-	  master<RESET>
+	  main<RESET>
 	  ref-to-branch<RESET> -> branch-one
 	  ref-to-remote<RESET> -> origin/branch-one
 	EOF
@@ -306,9 +306,9 @@ test_expect_success 'worktree colors correct' '
 '
 
 test_expect_success "set up color tests" '
-	echo "<RED>master<RESET>" >expect.color &&
-	echo "master" >expect.bare &&
-	color_args="--format=%(color:red)%(refname:short) --list master"
+	echo "<RED>main<RESET>" >expect.color &&
+	echo "main" >expect.bare &&
+	color_args="--format=%(color:red)%(refname:short) --list main"
 '
 
 test_expect_success '%(color) omitted without tty' '
@@ -331,7 +331,7 @@ test_expect_success '--color overrides auto-color' '
 
 test_expect_success PREPARE_FOR_MAIN_BRANCH 'verbose output lists worktree path' '
 	one=$(git rev-parse --short HEAD) &&
-	two=$(git rev-parse --short master) &&
+	two=$(git rev-parse --short main) &&
 	cat >expect <<-EOF &&
 	* (HEAD detached from fromtag) $one one
 	  ambiguous                    $one one
t/t3204-branch-name-interpretation.sh +3 -3
index 698d9cc4f3..e527e0b0c9 100755
@@ -28,7 +28,7 @@ test_expect_success 'update branch via @{-1}' '
 	git branch previous one &&
 
 	git checkout previous &&
-	git checkout master &&
+	git checkout main &&
 
 	git branch -f @{-1} two &&
 	expect_branch previous two
@@ -58,7 +58,7 @@ test_expect_success 'delete branch via @{-1}' '
 	git branch previous-del &&
 
 	git checkout previous-del &&
-	git checkout master &&
+	git checkout main &&
 
 	git branch -D @{-1} &&
 	expect_deleted previous-del
@@ -98,7 +98,7 @@ test_expect_success 'disallow deleting remote branch via @{-1}' '
 	git update-ref refs/remotes/origin/previous one &&
 
 	git checkout -b origin/previous two &&
-	git checkout master &&
+	git checkout main &&
 
 	test_must_fail git branch -r -D @{-1} &&
 	expect_branch refs/remotes/origin/previous one &&
t/t3205-branch-color.sh +3 -3
index 289625c464..9f2fb785d2 100755
@@ -5,7 +5,7 @@ test_description='basic branch output coloring'
 
 test_expect_success 'set up some sample branches' '
 	test_commit foo &&
-	git update-ref refs/remotes/origin/master HEAD &&
+	git update-ref refs/remotes/origin/main HEAD &&
 	git update-ref refs/heads/other HEAD
 '
 
@@ -19,9 +19,9 @@ test_expect_success 'set up some color config' '
 
 test_expect_success 'regular output shows colors' '
 	cat >expect <<-\EOF &&
-	* <CYAN>master<RESET>
+	* <CYAN>main<RESET>
 	  <BLUE>other<RESET>
-	  <YELLOW>remotes/origin/master<RESET>
+	  <YELLOW>remotes/origin/main<RESET>
 	EOF
 	git branch --color -a >actual.raw &&
 	test_decode_color <actual.raw >actual &&
t/t3206-range-diff.sh +20 -20
index 6eb344be03..2813a362c7 100755
@@ -127,7 +127,7 @@ test_expect_success 'setup' '
 '
 
 test_expect_success 'simple A..B A..C (unmodified)' '
-	git range-diff --no-color master..topic master..unmodified \
+	git range-diff --no-color main..topic main..unmodified \
 		>actual &&
 	cat >expect <<-EOF &&
 	1:  $(test_oid t1) = 1:  $(test_oid u1) s/5/A/
@@ -145,13 +145,13 @@ test_expect_success 'simple B...C (unmodified)' '
 '
 
 test_expect_success 'simple A B C (unmodified)' '
-	git range-diff --no-color master topic unmodified >actual &&
+	git range-diff --no-color main topic unmodified >actual &&
 	# same "expect" as above
 	test_cmp expect actual
 '
 
 test_expect_success 'trivial reordering' '
-	git range-diff --no-color master topic reordered >actual &&
+	git range-diff --no-color main topic reordered >actual &&
 	cat >expect <<-EOF &&
 	1:  $(test_oid t1) = 1:  $(test_oid r1) s/5/A/
 	3:  $(test_oid t3) = 2:  $(test_oid r2) s/11/B/
@@ -162,7 +162,7 @@ test_expect_success 'trivial reordering' '
 '
 
 test_expect_success 'removed a commit' '
-	git range-diff --no-color master topic removed >actual &&
+	git range-diff --no-color main topic removed >actual &&
 	cat >expect <<-EOF &&
 	1:  $(test_oid t1) = 1:  $(test_oid d1) s/5/A/
 	2:  $(test_oid t2) < -:  $(test_oid __) s/4/A/
@@ -173,7 +173,7 @@ test_expect_success 'removed a commit' '
 '
 
 test_expect_success 'added a commit' '
-	git range-diff --no-color master topic added >actual &&
+	git range-diff --no-color main topic added >actual &&
 	cat >expect <<-EOF &&
 	1:  $(test_oid t1) = 1:  $(test_oid a1) s/5/A/
 	2:  $(test_oid t2) = 2:  $(test_oid a2) s/4/A/
@@ -185,7 +185,7 @@ test_expect_success 'added a commit' '
 '
 
 test_expect_success 'new base, A B C' '
-	git range-diff --no-color master topic rebased >actual &&
+	git range-diff --no-color main topic rebased >actual &&
 	cat >expect <<-EOF &&
 	1:  $(test_oid t1) = 1:  $(test_oid b1) s/5/A/
 	2:  $(test_oid t2) = 2:  $(test_oid b2) s/4/A/
@@ -196,7 +196,7 @@ test_expect_success 'new base, A B C' '
 '
 
 test_expect_success 'new base, B...C' '
-	# this syntax includes the commits from master!
+	# this syntax includes the commits from main!
 	git range-diff --no-color topic...rebased >actual &&
 	cat >expect <<-EOF &&
 	-:  $(test_oid __) > 1:  $(test_oid b5) unrelated
@@ -420,7 +420,7 @@ test_expect_success 'file added and later removed' '
 
 test_expect_success 'no commits on one side' '
 	git commit --amend -m "new message" &&
-	git range-diff master HEAD@{1} HEAD
+	git range-diff main HEAD@{1} HEAD
 '
 
 test_expect_success 'changed message' '
@@ -482,11 +482,11 @@ test_expect_success 'dual-coloring' '
 	test_cmp expect actual
 '
 
-for prev in topic master..topic
+for prev in topic main..topic
 do
 	test_expect_success "format-patch --range-diff=$prev" '
 		git format-patch --cover-letter --range-diff=$prev \
-			master..unmodified >actual &&
+			main..unmodified >actual &&
 		test_when_finished "rm 000?-*" &&
 		test_line_count = 5 actual &&
 		test_i18ngrep "^Range-diff:$" 0000-* &&
@@ -511,19 +511,19 @@ test_expect_success 'range-diff overrides diff.noprefix internally' '
 
 test_expect_success 'basic with modified format.pretty with suffix' '
 	git -c format.pretty="format:commit %H%d%n" range-diff \
-		master..topic master..unmodified
+		main..topic main..unmodified
 '
 
 test_expect_success 'basic with modified format.pretty without "commit "' '
 	git -c format.pretty="format:%H%n" range-diff \
-		master..topic master..unmodified
+		main..topic main..unmodified
 '
 
 test_expect_success 'range-diff compares notes by default' '
 	git notes add -m "topic note" topic &&
 	git notes add -m "unmodified note" unmodified &&
 	test_when_finished git notes remove topic unmodified &&
-	git range-diff --no-color master..topic master..unmodified \
+	git range-diff --no-color main..topic main..unmodified \
 		>actual &&
 	sed s/Z/\ /g >expect <<-EOF &&
 	1:  $(test_oid t1) = 1:  $(test_oid u1) s/5/A/
@@ -547,7 +547,7 @@ test_expect_success 'range-diff with --no-notes' '
 	git notes add -m "topic note" topic &&
 	git notes add -m "unmodified note" unmodified &&
 	test_when_finished git notes remove topic unmodified &&
-	git range-diff --no-color --no-notes master..topic master..unmodified \
+	git range-diff --no-color --no-notes main..topic main..unmodified \
 		>actual &&
 	cat >expect <<-EOF &&
 	1:  $(test_oid t1) = 1:  $(test_oid u1) s/5/A/
@@ -565,7 +565,7 @@ test_expect_success 'range-diff with multiple --notes' '
 	git notes --ref=note2 add -m "topic note2" topic &&
 	git notes --ref=note2 add -m "unmodified note2" unmodified &&
 	test_when_finished git notes --ref=note2 remove topic unmodified &&
-	git range-diff --no-color --notes=note1 --notes=note2 master..topic master..unmodified \
+	git range-diff --no-color --notes=note1 --notes=note2 main..topic main..unmodified \
 		>actual &&
 	sed s/Z/\ /g >expect <<-EOF &&
 	1:  $(test_oid t1) = 1:  $(test_oid u1) s/5/A/
@@ -595,7 +595,7 @@ test_expect_success 'format-patch --range-diff does not compare notes by default
 	git notes add -m "unmodified note" unmodified &&
 	test_when_finished git notes remove topic unmodified &&
 	git format-patch --cover-letter --range-diff=$prev \
-		master..unmodified >actual &&
+		main..unmodified >actual &&
 	test_when_finished "rm 000?-*" &&
 	test_line_count = 5 actual &&
 	test_i18ngrep "^Range-diff:$" 0000-* &&
@@ -612,7 +612,7 @@ test_expect_success 'format-patch --range-diff with --no-notes' '
 	git notes add -m "unmodified note" unmodified &&
 	test_when_finished git notes remove topic unmodified &&
 	git format-patch --no-notes --cover-letter --range-diff=$prev \
-		master..unmodified >actual &&
+		main..unmodified >actual &&
 	test_when_finished "rm 000?-*" &&
 	test_line_count = 5 actual &&
 	test_i18ngrep "^Range-diff:$" 0000-* &&
@@ -629,7 +629,7 @@ test_expect_success 'format-patch --range-diff with --notes' '
 	git notes add -m "unmodified note" unmodified &&
 	test_when_finished git notes remove topic unmodified &&
 	git format-patch --notes --cover-letter --range-diff=$prev \
-		master..unmodified >actual &&
+		main..unmodified >actual &&
 	test_when_finished "rm 000?-*" &&
 	test_line_count = 5 actual &&
 	test_i18ngrep "^Range-diff:$" 0000-* &&
@@ -658,7 +658,7 @@ test_expect_success 'format-patch --range-diff with format.notes config' '
 	test_when_finished git notes remove topic unmodified &&
 	test_config format.notes true &&
 	git format-patch --cover-letter --range-diff=$prev \
-		master..unmodified >actual &&
+		main..unmodified >actual &&
 	test_when_finished "rm 000?-*" &&
 	test_line_count = 5 actual &&
 	test_i18ngrep "^Range-diff:$" 0000-* &&
@@ -689,7 +689,7 @@ test_expect_success 'format-patch --range-diff with multiple notes' '
 	git notes --ref=note2 add -m "unmodified note2" unmodified &&
 	test_when_finished git notes --ref=note2 remove topic unmodified &&
 	git format-patch --notes=note1 --notes=note2 --cover-letter --range-diff=$prev \
-		master..unmodified >actual &&
+		main..unmodified >actual &&
 	test_when_finished "rm 000?-*" &&
 	test_line_count = 5 actual &&
 	test_i18ngrep "^Range-diff:$" 0000-* &&
t/t3206/history.export +1 -1
index 4c808e5b3b..4485adc37b 100644
@@ -168,7 +168,7 @@ mark :11
 data 10
 unrelated
 
-commit refs/heads/master
+commit refs/heads/main
 mark :12
 author Thomas Rast <[email protected]> 1374485127 +0200
 committer Thomas Rast <[email protected]> 1374485127 +0200
t/t3210-pack-refs.sh +2 -2
index f41b2afb99..a0b188fa4d 100755
@@ -135,7 +135,7 @@ test_expect_success 'delete ref with dangling packed version' '
 	git commit --allow-empty -m "future garbage" &&
 	git pack-refs --all &&
 	git reset --hard HEAD^ &&
-	git checkout master &&
+	git checkout main &&
 	git reflog expire --expire=all --all &&
 	git prune --expire=all &&
 	git branch -d lamb 2>result &&
@@ -240,7 +240,7 @@ test_expect_success 'retry acquiring packed-refs.lock' '
 
 test_expect_success SYMLINKS 'pack symlinked packed-refs' '
 	# First make sure that symlinking works when reading:
-	git update-ref refs/heads/lossy refs/heads/master &&
+	git update-ref refs/heads/lossy refs/heads/main &&
 	git for-each-ref >all-refs-before &&
 	mv .git/packed-refs .git/my-deviant-packed-refs &&
 	ln -s my-deviant-packed-refs .git/packed-refs &&
t/t3211-peel-ref.sh +2 -2
index 3b7caca421..73a914d194 100755
@@ -19,7 +19,7 @@ print_ref() {
 
 test_expect_success 'set up expected show-ref output' '
 	{
-		print_ref "refs/heads/master" &&
+		print_ref "refs/heads/main" &&
 		print_ref "refs/outside/foo" &&
 		print_ref "refs/outside/foo^{}" &&
 		print_ref "refs/tags/base" &&
@@ -47,7 +47,7 @@ test_expect_success 'create old-style pack-refs without fully-peeled' '
 	# know we are emulating exactly what an older git would have written.
 	{
 		echo "# pack-refs with: peeled " &&
-		print_ref "refs/heads/master" &&
+		print_ref "refs/heads/main" &&
 		print_ref "refs/outside/foo" &&
 		print_ref "refs/tags/base" &&
 		print_ref "refs/tags/foo" &&
t/t3301-notes.sh +3 -3
index 8f43303007..2b685580b6 100755
@@ -1295,11 +1295,11 @@ test_expect_success 'git notes copy diagnoses too many or too few parameters' '
 	test_i18ngrep "too many parameters" error
 '
 
-test_expect_success 'git notes get-ref expands refs/heads/master to refs/notes/refs/heads/master' '
+test_expect_success 'git notes get-ref expands refs/heads/main to refs/notes/refs/heads/main' '
 	test_unconfig core.notesRef &&
 	sane_unset GIT_NOTES_REF &&
-	echo refs/notes/refs/heads/master >expect &&
-	git notes --ref=refs/heads/master get-ref >actual &&
+	echo refs/notes/refs/heads/main >expect &&
+	git notes --ref=refs/heads/main get-ref >actual &&
 	test_cmp expect actual
 '
 
t/t3302-notes-index-expensive.sh +1 -1
index 7217c5e222..1c1490ca68 100755
@@ -20,7 +20,7 @@ create_repo () {
 			notemark=$(($mark+1))
 			test_tick &&
 			cat <<-INPUT_END &&
-			commit refs/heads/master
+			commit refs/heads/main
 			mark :$mark
 			committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
 			data <<COMMIT
t/t3303-notes-subtrees.sh +4 -4
index 704aee81ef..d994492469 100755
@@ -40,7 +40,7 @@ test_expect_success "setup: create $number_of_commits commits" '
 			nr=$(($nr+1)) &&
 			test_tick &&
 			cat <<INPUT_END
-commit refs/heads/master
+commit refs/heads/main
 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
 data <<COMMIT
 commit #$nr
@@ -75,7 +75,7 @@ test_sha1_based () {
 	(
 		start_note_commit &&
 		nr=$number_of_commits &&
-		git rev-list refs/heads/master |
+		git rev-list refs/heads/main |
 		while read sha1; do
 			note_path=$(echo "$sha1" | sed "$1")
 			cat <<INPUT_END &&
@@ -105,7 +105,7 @@ test_same_notes () {
 	(
 		start_note_commit &&
 		nr=$number_of_commits &&
-		git rev-list refs/heads/master |
+		git rev-list refs/heads/main |
 		while read sha1; do
 			first_note_path=$(echo "$sha1" | sed "$1")
 			second_note_path=$(echo "$sha1" | sed "$2")
@@ -144,7 +144,7 @@ test_concatenated_notes () {
 	(
 		start_note_commit &&
 		nr=$number_of_commits &&
-		git rev-list refs/heads/master |
+		git rev-list refs/heads/main |
 		while read sha1; do
 			first_note_path=$(echo "$sha1" | sed "$1")
 			second_note_path=$(echo "$sha1" | sed "$2")
t/t3304-notes-mixed.sh +4 -4
index 1709e8c00b..802e004016 100755
@@ -36,7 +36,7 @@ test_expect_success "setup: create a couple of commits" '
 
 	test_tick &&
 	cat <<INPUT_END >input &&
-commit refs/heads/master
+commit refs/heads/main
 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
 data <<COMMIT
 commit #1
@@ -51,7 +51,7 @@ INPUT_END
 
 	test_tick &&
 	cat <<INPUT_END >>input &&
-commit refs/heads/master
+commit refs/heads/main
 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
 data <<COMMIT
 commit #2
@@ -68,8 +68,8 @@ INPUT_END
 
 test_expect_success "create a notes tree with both notes and non-notes" '
 
-	commit1=$(git rev-parse refs/heads/master^) &&
-	commit2=$(git rev-parse refs/heads/master) &&
+	commit1=$(git rev-parse refs/heads/main^) &&
+	commit2=$(git rev-parse refs/heads/main) &&
 	test_tick &&
 	cat <<INPUT_END >input &&
 commit refs/notes/commits
t/t3308-notes-merge.sh +1 -1
index d69c84c640..202702be1a 100755
@@ -108,7 +108,7 @@ test_expect_success 'fail to merge into various non-notes refs' '
 	git update-ref refs/notes/dir/foo HEAD &&
 	test_must_fail git -c "core.notesRef=refs/notes/dir" notes merge x &&
 	test_must_fail git -c "core.notesRef=refs/notes/dir/" notes merge x &&
-	test_must_fail git -c "core.notesRef=refs/heads/master" notes merge x &&
+	test_must_fail git -c "core.notesRef=refs/heads/main" notes merge x &&
 	test_must_fail git -c "core.notesRef=refs/notes/y:" notes merge x &&
 	test_must_fail git -c "core.notesRef=refs/notes/y:foo" notes merge x &&
 	test_must_fail git -c "core.notesRef=refs/notes/foo^{bar" notes merge x
t/t3320-notes-merge-worktrees.sh +2 -2
index 823fdbda1f..465145c487 100755
@@ -36,8 +36,8 @@ test_expect_success 'modify notes ref ourselves (x)' '
 '
 
 test_expect_success 'create some new worktrees' '
-	git worktree add -b newbranch worktree master &&
-	git worktree add -b newbranch2 worktree2 master
+	git worktree add -b newbranch worktree main &&
+	git worktree add -b newbranch2 worktree2 main
 '
 
 test_expect_success 'merge z into y fails and sets NOTES_MERGE_REF' '
t/test-lib.sh +1 -1
index 3bb6675390..c464f8dcc8 100644
@@ -257,7 +257,7 @@ case "$TRASH_DIRECTORY" in
 esac
 
 case "$TEST_NUMBER" in
-[0-2]*)
+[0-2]*|3[0-3]*)
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
Signature · 1 line
gitgitgadget
#3 lore raw

PATCH 3/28 t2*: adjust the references to the default branch name "main"

In reply to Johannes Schindelin via GitGitGadget

From: Johannes Schindelin <[email protected]>

This trick was performed via

	$ (cd t &&
	   sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
		-e 's/Master/Main/g' -- t2*.sh)

This allows us to define GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main for those tests.

---
 t/t2007-checkout-symlink.sh              | 10 ++--
 t/t2009-checkout-statinfo.sh             |  8 +--
 t/t2010-checkout-ambiguous.sh            |  4 +-
 t/t2011-checkout-invalid-head.sh         | 16 +++---
 t/t2012-checkout-last.sh                 | 48 ++++++++--------
 t/t2015-checkout-unborn.sh               |  2 +-
 t/t2017-checkout-orphan.sh               | 44 +++++++--------
 t/t2020-checkout-detach.sh               | 28 +++++-----
 t/t2022-checkout-paths.sh                | 22 ++++----
 t/t2023-checkout-m.sh                    | 10 ++--
 t/t2024-checkout-dwim.sh                 | 70 ++++++++++++------------
 t/t2027-checkout-track.sh                |  6 +-
 t/t2030-unresolve-info.sh                |  6 +-
 t/t2060-switch.sh                        | 30 +++++-----
 t/t2070-restore.sh                       |  4 +-
 t/t2106-update-index-assume-unchanged.sh |  2 +-
 t/t2400-worktree-add.sh                  | 66 +++++++++++-----------
 t/t2401-worktree-prune.sh                |  2 +-
 t/t2402-worktree-list.sh                 | 20 +++----
 t/t2405-worktree-submodule.sh            |  6 +-
 t/test-lib.sh                            |  2 +-
 21 files changed, 203 insertions(+), 203 deletions(-)
t/t2007-checkout-symlink.sh +5 -5
index fc9aad530e..d6468ad8f3 100755
@@ -12,14 +12,14 @@ test_expect_success setup '
 	echo hello >frotz/filfre &&
 	git add frotz/filfre &&
 	test_tick &&
-	git commit -m "master has file frotz/filfre" &&
+	git commit -m "main has file frotz/filfre" &&
 
 	git branch side &&
 
 	echo goodbye >nitfol &&
 	git add nitfol &&
 	test_tick &&
-	git commit -m "master adds file nitfol" &&
+	git commit -m "main adds file nitfol" &&
 
 	git checkout side &&
 
@@ -34,13 +34,13 @@ test_expect_success setup '
 
 test_expect_success 'switch from symlink to dir' '
 
-	git checkout master
+	git checkout main
 
 '
 
-test_expect_success 'Remove temporary directories & switch to master' '
+test_expect_success 'Remove temporary directories & switch to main' '
 	rm -fr frotz xyzzy nitfol &&
-	git checkout -f master
+	git checkout -f main
 '
 
 test_expect_success 'switch from dir to symlink' '
t/t2009-checkout-statinfo.sh +4 -4
index f3c2152087..91940f3c60 100755
@@ -21,13 +21,13 @@ test_expect_success 'branch switching' '
 	git reset --hard &&
 	test "$(git diff-files --raw)" = "" &&
 
-	git checkout master &&
+	git checkout main &&
 	test "$(git diff-files --raw)" = "" &&
 
 	git checkout side &&
 	test "$(git diff-files --raw)" = "" &&
 
-	git checkout master &&
+	git checkout main &&
 	test "$(git diff-files --raw)" = ""
 
 '
@@ -37,13 +37,13 @@ test_expect_success 'path checkout' '
 	git reset --hard &&
 	test "$(git diff-files --raw)" = "" &&
 
-	git checkout master world &&
+	git checkout main world &&
 	test "$(git diff-files --raw)" = "" &&
 
 	git checkout side world &&
 	test "$(git diff-files --raw)" = "" &&
 
-	git checkout master world &&
+	git checkout main world &&
 	test "$(git diff-files --raw)" = ""
 
 '
t/t2010-checkout-ambiguous.sh +2 -2
index 2e47fe01cf..64395479e8 100755
@@ -17,7 +17,7 @@ test_expect_success 'reference must be a tree' '
 '
 
 test_expect_success 'branch switching' '
-	test "refs/heads/master" = "$(git symbolic-ref HEAD)" &&
+	test "refs/heads/main" = "$(git symbolic-ref HEAD)" &&
 	git checkout world -- &&
 	test "refs/heads/world" = "$(git symbolic-ref HEAD)"
 '
@@ -57,7 +57,7 @@ test_expect_success 'disambiguate checking out from a tree-ish' '
 '
 
 test_expect_success 'accurate error message with more than one ref' '
-	test_must_fail git checkout HEAD master -- 2>actual &&
+	test_must_fail git checkout HEAD main -- 2>actual &&
 	test_i18ngrep 2 actual &&
 	test_i18ngrep "one reference expected, 2 given" actual
 '
t/t2011-checkout-invalid-head.sh +8 -8
index 0e8d56aa76..d92f8582ea 100755
@@ -11,12 +11,12 @@ test_expect_success 'setup' '
 '
 
 test_expect_success 'checkout should not start branch from a tree' '
-	test_must_fail git checkout -b newbranch master^{tree}
+	test_must_fail git checkout -b newbranch main^{tree}
 '
 
-test_expect_success 'checkout master from invalid HEAD' '
+test_expect_success 'checkout main from invalid HEAD' '
 	echo $ZERO_OID >.git/HEAD &&
-	git checkout master --
+	git checkout main --
 '
 
 test_expect_success 'checkout notices failure to lock HEAD' '
@@ -26,7 +26,7 @@ test_expect_success 'checkout notices failure to lock HEAD' '
 '
 
 test_expect_success 'create ref directory/file conflict scenario' '
-	git update-ref refs/heads/outer/inner master &&
+	git update-ref refs/heads/outer/inner main &&
 
 	# do not rely on symbolic-ref to get a known state,
 	# as it may use the same code we are testing
@@ -37,12 +37,12 @@ test_expect_success 'create ref directory/file conflict scenario' '
 
 test_expect_success 'checkout away from d/f HEAD (unpacked, to branch)' '
 	reset_to_df &&
-	git checkout master
+	git checkout main
 '
 
 test_expect_success 'checkout away from d/f HEAD (unpacked, to detached)' '
 	reset_to_df &&
-	git checkout --detach master
+	git checkout --detach main
 '
 
 test_expect_success 'pack refs' '
@@ -51,11 +51,11 @@ test_expect_success 'pack refs' '
 
 test_expect_success 'checkout away from d/f HEAD (packed, to branch)' '
 	reset_to_df &&
-	git checkout master
+	git checkout main
 '
 
 test_expect_success 'checkout away from d/f HEAD (packed, to detached)' '
 	reset_to_df &&
-	git checkout --detach master
+	git checkout --detach main
 '
 test_done
t/t2012-checkout-last.sh +24 -24

87 lines not on this page · raw message

t/t2015-checkout-unborn.sh +1 -1
index 37bdcedcc9..2b3e6dc27e 100755
@@ -11,7 +11,7 @@ test_expect_success 'setup' '
 	 git add file &&
 	 git commit -m base
 	) &&
-	git fetch parent master:origin
+	git fetch parent main:origin
 '
 
 test_expect_success 'checkout from unborn preserves untracked files' '
t/t2017-checkout-orphan.sh +22 -22

110 lines not on this page · raw message

t/t2020-checkout-detach.sh +14 -14
index b748db9946..25885c3065 100755
@@ -22,7 +22,7 @@ check_no_orphan_warning() {
 }
 
 reset () {
-	git checkout master &&
+	git checkout main &&
 	check_not_detached
 }
 
@@ -85,7 +85,7 @@ test_expect_success 'checkout --detach errors out for non-commit' '
 
 test_expect_success 'checkout --detach errors out for extra argument' '
 	reset &&
-	git checkout master &&
+	git checkout main &&
 	test_must_fail git checkout --detach tag one.t &&
 	check_not_detached
 '
@@ -113,7 +113,7 @@ test_expect_success 'checkout warns on orphan commits' '
 	echo new content >orphan &&
 	git commit -a -m orphan2 &&
 	orphan2=$(git rev-parse HEAD) &&
-	git checkout master 2>stderr
+	git checkout main 2>stderr
 '
 
 test_expect_success 'checkout warns on orphan commits: output' '
@@ -132,7 +132,7 @@ test_expect_success 'checkout warns orphaning 1 of 2 commits: output' '
 test_expect_success 'checkout does not warn leaving ref tip' '
 	reset &&
 	git checkout --detach two &&
-	git checkout master 2>stderr
+	git checkout main 2>stderr
 '
 
 test_expect_success 'checkout does not warn leaving ref tip' '
@@ -142,7 +142,7 @@ test_expect_success 'checkout does not warn leaving ref tip' '
 test_expect_success 'checkout does not warn leaving reachable commit' '
 	reset &&
 	git checkout --detach HEAD^ &&
-	git checkout master 2>stderr
+	git checkout main 2>stderr
 '
 
 test_expect_success 'checkout does not warn leaving reachable commit' '
@@ -150,14 +150,14 @@ test_expect_success 'checkout does not warn leaving reachable commit' '
 '
 
 cat >expect <<'EOF'
-Your branch is behind 'master' by 1 commit, and can be fast-forwarded.
+Your branch is behind 'main' by 1 commit, and can be fast-forwarded.
   (use "git pull" to update your local branch)
 EOF
 test_expect_success 'tracking count is accurate after orphan check' '
 	reset &&
-	git branch child master^ &&
+	git branch child main^ &&
 	git config branch.child.remote . &&
-	git config branch.child.merge refs/heads/master &&
+	git config branch.child.merge refs/heads/main &&
 	git checkout child^ &&
 	git checkout child >stdout &&
 	test_i18ncmp expect stdout
@@ -189,9 +189,9 @@ test_expect_success 'no advice given for explicit detached head state' '
 # Detached HEAD tests for GIT_PRINT_SHA1_ELLIPSIS (new format)
 test_expect_success 'describe_detached_head prints no SHA-1 ellipsis when not asked to' "
 
-	commit=$(git rev-parse --short=12 master^) &&
-	commit2=$(git rev-parse --short=12 master~2) &&
-	commit3=$(git rev-parse --short=12 master~3) &&
+	commit=$(git rev-parse --short=12 main^) &&
+	commit2=$(git rev-parse --short=12 main~2) &&
+	commit3=$(git rev-parse --short=12 main~3) &&
 
 	# The first detach operation is more chatty than the following ones.
 	cat >1st_detach <<-EOF &&
@@ -271,9 +271,9 @@ test_expect_success 'describe_detached_head prints no SHA-1 ellipsis when not as
 # Detached HEAD tests for GIT_PRINT_SHA1_ELLIPSIS (old format)
 test_expect_success 'describe_detached_head does print SHA-1 ellipsis when asked to' "
 
-	commit=$(git rev-parse --short=12 master^) &&
-	commit2=$(git rev-parse --short=12 master~2) &&
-	commit3=$(git rev-parse --short=12 master~3) &&
+	commit=$(git rev-parse --short=12 main^) &&
+	commit2=$(git rev-parse --short=12 main~2) &&
+	commit3=$(git rev-parse --short=12 main~3) &&
 
 	# The first detach operation is more chatty than the following ones.
 	cat >1st_detach <<-EOF &&
t/t2022-checkout-paths.sh +11 -11
index 6844afafc0..4174620cf4 100755
@@ -5,15 +5,15 @@ test_description='checkout $tree -- $paths'
 
 test_expect_success setup '
 	mkdir dir &&
-	>dir/master &&
+	>dir/main &&
 	echo common >dir/common &&
-	git add dir/master dir/common &&
-	test_tick && git commit -m "master has dir/master" &&
+	git add dir/main dir/common &&
+	test_tick && git commit -m "main has dir/main" &&
 	git checkout -b next &&
-	git mv dir/master dir/next0 &&
+	git mv dir/main dir/next0 &&
 	echo next >dir/next1 &&
 	git add dir &&
-	test_tick && git commit -m "next has dir/next but not dir/master"
+	test_tick && git commit -m "next has dir/next but not dir/main"
 '
 
 test_expect_success 'checking out paths out of a tree does not clobber unrelated paths' '
@@ -26,11 +26,11 @@ test_expect_success 'checking out paths out of a tree does not clobber unrelated
 	echo untracked >expect.next2 &&
 	cat expect.next2 >dir/next2 &&
 
-	git checkout master dir &&
+	git checkout main dir &&
 
 	test_cmp expect.common dir/common &&
-	test_path_is_file dir/master &&
-	git diff --exit-code master dir/master &&
+	test_path_is_file dir/main &&
+	git diff --exit-code main dir/main &&
 
 	test_path_is_missing dir/next0 &&
 	test_cmp expect.next1 dir/next1 &&
@@ -52,11 +52,11 @@ test_expect_success 'do not touch unmerged entries matching $path but not in $tr
 	EOF
 	git update-index --index-info <expect.next0 &&
 
-	git checkout master dir &&
+	git checkout main dir &&
 
 	test_cmp expect.common dir/common &&
-	test_path_is_file dir/master &&
-	git diff --exit-code master dir/master &&
+	test_path_is_file dir/main &&
+	git diff --exit-code main dir/main &&
 	git ls-files -s dir/next0 >actual.next0 &&
 	test_cmp expect.next0 actual.next0
 '
t/t2023-checkout-m.sh +5 -5
index fca3f85824..ddcfcc3e9b 100755
@@ -10,15 +10,15 @@ test_expect_success setup '
 	test_tick &&
 	test_commit both.txt both.txt initial &&
 	git branch topic &&
-	test_commit modified_in_master both.txt in_master &&
-	test_commit added_in_master each.txt in_master &&
+	test_commit modified_in_main both.txt in_main &&
+	test_commit added_in_main each.txt in_main &&
 	git checkout topic &&
 	test_commit modified_in_topic both.txt in_topic &&
 	test_commit added_in_topic each.txt in_topic
 '
 
-test_expect_success 'git merge master' '
-    test_must_fail git merge master
+test_expect_success 'git merge main' '
+    test_must_fail git merge main
 '
 
 clean_branchnames () {
@@ -61,7 +61,7 @@ test_expect_success 'force checkout a conflict file creates stage zero entry' '
 		git checkout topic &&
 		echo c >a &&
 		C_OBJ=$(git hash-object a) &&
-		git checkout -m master &&
+		git checkout -m main &&
 		test_cmp_rev :1:a $A_OBJ &&
 		test_cmp_rev :2:a $B_OBJ &&
 		test_cmp_rev :3:a $C_OBJ &&
t/t2024-checkout-dwim.sh +35 -35

238 lines not on this page · raw message

t/t2027-checkout-track.sh +3 -3
index bcba1bf90c..bc46c5a68e 100755
@@ -10,14 +10,14 @@ test_expect_success 'setup' '
 '
 
 test_expect_success 'checkout --track -b creates a new tracking branch' '
-	git checkout --track -b branch1 master &&
+	git checkout --track -b branch1 main &&
 	test $(git rev-parse --abbrev-ref HEAD) = branch1 &&
 	test $(git config --get branch.branch1.remote) = . &&
-	test $(git config --get branch.branch1.merge) = refs/heads/master
+	test $(git config --get branch.branch1.merge) = refs/heads/main
 '
 
 test_expect_success 'checkout --track -b rejects an extra path argument' '
-	test_must_fail git checkout --track -b branch2 master one.t 2>err &&
+	test_must_fail git checkout --track -b branch2 main one.t 2>err &&
 	test_i18ngrep "cannot be used with updating paths" err
 '
 
t/t2030-unresolve-info.sh +3 -3
index 309199bca2..3cdd73c172 100755
@@ -59,7 +59,7 @@ test_expect_success setup '
 	test_commit fourth fi/le fourth &&
 	git checkout add-add &&
 	test_commit fifth add-differently &&
-	git checkout master
+	git checkout main
 '
 
 test_expect_success 'add records switch clears' '
@@ -183,8 +183,8 @@ test_expect_success 'rerere forget (binary)' '
 '
 
 test_expect_success 'rerere forget (add-add conflict)' '
-	git checkout -f master &&
-	echo master >add-differently &&
+	git checkout -f main &&
+	echo main >add-differently &&
 	git add add-differently &&
 	git commit -m "add differently" &&
 	test_must_fail git merge fifth &&
t/t2060-switch.sh +15 -15
index 68c9101b02..11f85f8861 100755
@@ -23,41 +23,41 @@ test_expect_success 'switch branch' '
 '
 
 test_expect_success 'switch and detach' '
-	test_when_finished git switch master &&
-	test_must_fail git switch master^{commit} &&
-	git switch --detach master^{commit} &&
+	test_when_finished git switch main &&
+	test_must_fail git switch main^{commit} &&
+	git switch --detach main^{commit} &&
 	test_must_fail git symbolic-ref HEAD
 '
 
 test_expect_success 'switch and detach current branch' '
-	test_when_finished git switch master &&
-	git switch master &&
+	test_when_finished git switch main &&
+	git switch main &&
 	git switch --detach &&
 	test_must_fail git symbolic-ref HEAD
 '
 
 test_expect_success 'switch and create branch' '
-	test_when_finished git switch master &&
-	git switch -c temp master^ &&
-	test_cmp_rev master^ refs/heads/temp &&
+	test_when_finished git switch main &&
+	git switch -c temp main^ &&
+	test_cmp_rev main^ refs/heads/temp &&
 	echo refs/heads/temp >expected-branch &&
 	git symbolic-ref HEAD >actual-branch &&
 	test_cmp expected-branch actual-branch
 '
 
 test_expect_success 'force create branch from HEAD' '
-	test_when_finished git switch master &&
-	git switch --detach master &&
+	test_when_finished git switch main &&
+	git switch --detach main &&
 	test_must_fail git switch -c temp &&
 	git switch -C temp &&
-	test_cmp_rev master refs/heads/temp &&
+	test_cmp_rev main refs/heads/temp &&
 	echo refs/heads/temp >expected-branch &&
 	git symbolic-ref HEAD >actual-branch &&
 	test_cmp expected-branch actual-branch
 '
 
 test_expect_success 'new orphan branch from empty' '
-	test_when_finished git switch master &&
+	test_when_finished git switch main &&
 	test_must_fail git switch --orphan new-orphan HEAD &&
 	git switch --orphan new-orphan &&
 	test_commit orphan &&
@@ -69,7 +69,7 @@ test_expect_success 'new orphan branch from empty' '
 '
 
 test_expect_success 'orphan branch works with --discard-changes' '
-	test_when_finished git switch master &&
+	test_when_finished git switch main &&
 	echo foo >foo.txt &&
 	git switch --discard-changes --orphan new-orphan2 &&
 	git ls-files >tracked-files &&
@@ -77,7 +77,7 @@ test_expect_success 'orphan branch works with --discard-changes' '
 '
 
 test_expect_success 'switching ignores file of same branch name' '
-	test_when_finished git switch master &&
+	test_when_finished git switch main &&
 	: >first-branch &&
 	git switch first-branch &&
 	echo refs/heads/first-branch >expected &&
@@ -86,7 +86,7 @@ test_expect_success 'switching ignores file of same branch name' '
 '
 
 test_expect_success 'guess and create branch' '
-	test_when_finished git switch master &&
+	test_when_finished git switch main &&
 	test_must_fail git switch --no-guess foo &&
 	test_config checkout.guess false &&
 	test_must_fail git switch foo &&
t/t2070-restore.sh +2 -2
index 89e5a142c9..46e27212d6 100755
@@ -15,7 +15,7 @@ test_expect_success 'setup' '
 	echo ignored >ignored &&
 	echo /ignored >.gitignore &&
 	git add one two .gitignore &&
-	git update-ref refs/heads/one master
+	git update-ref refs/heads/one main
 '
 
 test_expect_success 'restore without pathspec is not ok' '
@@ -91,7 +91,7 @@ test_expect_success 'restore --ignore-unmerged ignores unmerged entries' '
 		git switch -c first &&
 		echo first >unmerged &&
 		git commit -am first &&
-		git switch -c second master &&
+		git switch -c second main &&
 		echo second >unmerged &&
 		git commit -am second &&
 		test_must_fail git merge first &&
t/t2106-update-index-assume-unchanged.sh +1 -1
index 99d858c6b7..2b923824c9 100755
@@ -19,6 +19,6 @@ test_expect_success 'do not switch branches with dirty file' \
 	 git checkout other &&
 	 echo dirt >file &&
 	 git update-index --assume-unchanged file &&
-	 test_must_fail git checkout master'
+	 test_must_fail git checkout main'
 
 test_done
t/t2400-worktree-add.sh +33 -33

218 lines not on this page · raw message

t/t2401-worktree-prune.sh +1 -1
index a6ce7f590b..7a2ff04f44 100755
@@ -87,7 +87,7 @@ test_expect_success 'not prune recent checkouts' '
 
 test_expect_success 'not prune proper checkouts' '
 	test_when_finished rm -r .git/worktrees &&
-	git worktree add --detach "$PWD/nop" master &&
+	git worktree add --detach "$PWD/nop" main &&
 	git worktree prune &&
 	test -d .git/worktrees/nop
 '
t/t2402-worktree-list.sh +10 -10
index 795ddca2e4..03603d0dd0 100755
@@ -21,7 +21,7 @@ test_expect_success 'rev-parse --git-common-dir on main worktree' '
 test_expect_success 'rev-parse --git-path objects linked worktree' '
 	echo "$(git rev-parse --show-toplevel)/.git/objects" >expect &&
 	test_when_finished "rm -rf linked-tree actual expect && git worktree prune" &&
-	git worktree add --detach linked-tree master &&
+	git worktree add --detach linked-tree main &&
 	git -C linked-tree rev-parse --git-path objects >actual &&
 	test_cmp expect actual
 '
@@ -29,7 +29,7 @@ test_expect_success 'rev-parse --git-path objects linked worktree' '
 test_expect_success '"list" all worktrees from main' '
 	echo "$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]" >expect &&
 	test_when_finished "rm -rf here out actual expect && git worktree prune" &&
-	git worktree add --detach here master &&
+	git worktree add --detach here main &&
 	echo "$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)" >>expect &&
 	git worktree list >out &&
 	sed "s/  */ /g" <out >actual &&
@@ -39,7 +39,7 @@ test_expect_success '"list" all worktrees from main' '
 test_expect_success '"list" all worktrees from linked' '
 	echo "$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]" >expect &&
 	test_when_finished "rm -rf here out actual expect && git worktree prune" &&
-	git worktree add --detach here master &&
+	git worktree add --detach here main &&
 	echo "$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)" >>expect &&
 	git -C here worktree list >out &&
 	sed "s/  */ /g" <out >actual &&
@@ -52,7 +52,7 @@ test_expect_success '"list" all worktrees --porcelain' '
 	echo "branch $(git symbolic-ref HEAD)" >>expect &&
 	echo >>expect &&
 	test_when_finished "rm -rf here actual expect && git worktree prune" &&
-	git worktree add --detach here master &&
+	git worktree add --detach here main &&
 	echo "worktree $(git -C here rev-parse --show-toplevel)" >>expect &&
 	echo "HEAD $(git rev-parse HEAD)" >>expect &&
 	echo "detached" >>expect &&
@@ -63,8 +63,8 @@ test_expect_success '"list" all worktrees --porcelain' '
 
 test_expect_success '"list" all worktrees with locked annotation' '
 	test_when_finished "rm -rf locked unlocked out && git worktree prune" &&
-	git worktree add --detach locked master &&
-	git worktree add --detach unlocked master &&
+	git worktree add --detach locked main &&
+	git worktree add --detach unlocked main &&
 	git worktree lock locked &&
 	git worktree list >out &&
 	grep "/locked  *[0-9a-f].* locked$" out &&
@@ -76,13 +76,13 @@ test_expect_success 'bare repo setup' '
 	echo "data" >file1 &&
 	git add file1 &&
 	git commit -m"File1: add data" &&
-	git push bare1 master &&
+	git push bare1 main &&
 	git reset --hard HEAD^
 '
 
 test_expect_success '"list" all worktrees from bare main' '
 	test_when_finished "rm -rf there out actual expect && git -C bare1 worktree prune" &&
-	git -C bare1 worktree add --detach ../there master &&
+	git -C bare1 worktree add --detach ../there main &&
 	echo "$(pwd)/bare1 (bare)" >expect &&
 	echo "$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)" >>expect &&
 	git -C bare1 worktree list >out &&
@@ -92,7 +92,7 @@ test_expect_success '"list" all worktrees from bare main' '
 
 test_expect_success '"list" all worktrees --porcelain from bare main' '
 	test_when_finished "rm -rf there actual expect && git -C bare1 worktree prune" &&
-	git -C bare1 worktree add --detach ../there master &&
+	git -C bare1 worktree add --detach ../there main &&
 	echo "worktree $(pwd)/bare1" >expect &&
 	echo "bare" >>expect &&
 	echo >>expect &&
@@ -106,7 +106,7 @@ test_expect_success '"list" all worktrees --porcelain from bare main' '
 
 test_expect_success '"list" all worktrees from linked with a bare main' '
 	test_when_finished "rm -rf there out actual expect && git -C bare1 worktree prune" &&
-	git -C bare1 worktree add --detach ../there master &&
+	git -C bare1 worktree add --detach ../there main &&
 	echo "$(pwd)/bare1 (bare)" >expect &&
 	echo "$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)" >>expect &&
 	git -C there worktree list >out &&
t/t2405-worktree-submodule.sh +3 -3
index e1b2bfd87e..ccc47fae97 100755
@@ -31,7 +31,7 @@ test_expect_success 'add superproject worktree' '
 '
 
 test_expect_failure 'submodule is checked out just after worktree add' '
-	git -C worktree diff --submodule master"^!" >out &&
+	git -C worktree diff --submodule main"^!" >out &&
 	grep "file1 updated" out
 '
 
@@ -41,7 +41,7 @@ test_expect_success 'add superproject worktree and initialize submodules' '
 '
 
 test_expect_success 'submodule is checked out just after submodule update in linked worktree' '
-	git -C worktree-submodule-update diff --submodule master"^!" >out &&
+	git -C worktree-submodule-update diff --submodule main"^!" >out &&
 	grep "file1 updated" out
 '
 
@@ -51,7 +51,7 @@ test_expect_success 'add superproject worktree and manually add submodule worktr
 '
 
 test_expect_success 'submodule is checked out after manually adding submodule worktree' '
-	git -C linked_submodule diff --submodule master"^!" >out &&
+	git -C linked_submodule diff --submodule main"^!" >out &&
 	grep "file1 updated" out
 '
 
t/test-lib.sh +1 -1
index 126004e342..3bb6675390 100644
@@ -257,7 +257,7 @@ case "$TRASH_DIRECTORY" in
 esac
 
 case "$TEST_NUMBER" in
-[01]*)
+[0-2]*)
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
Signature · 1 line
gitgitgadget
#6 lore raw

PATCH 6/28 t34*: adjust the references to the default branch name "main"

In reply to Johannes Schindelin via GitGitGadget

From: Johannes Schindelin <[email protected]>

Carefully excluding t3404, which sees independent development elsewhere at the time of writing, we use main as the default branch name in t34*. This trick was performed via

	$ (cd t &&
	   sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
		-e 's/Master/Main/g' -- t34*.sh &&
	   git checkout HEAD -- t34\*)

This allows us to define GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main for those tests.

---
 t/t3400-rebase.sh                 | 60 +++++++++++++++----------------
 t/t3402-rebase-merge.sh           | 44 +++++++++++------------
 t/t3403-rebase-skip.sh            |  6 ++--
 t/t3405-rebase-malformed.sh       |  8 ++---
 t/t3406-rebase-message.sh         | 24 ++++++-------
 t/t3407-rebase-abort.sh           | 18 +++++-----
 t/t3408-rebase-multi-line.sh      |  2 +-
 t/t3409-rebase-preserve-merges.sh | 10 +++---
 t/t3412-rebase-root.sh            | 28 +++++++--------
 t/t3413-rebase-hook.sh            | 42 +++++++++++-----------
 t/t3415-rebase-autosquash.sh      |  2 +-
 t/t3416-rebase-onto-threedots.sh  | 54 ++++++++++++++--------------
 t/t3418-rebase-continue.sh        | 24 ++++++-------
 t/t3419-rebase-patch-id.sh        | 12 +++----
 t/t3420-rebase-autostash.sh       |  8 ++---
 t/t3423-rebase-reword.sh          |  6 ++--
 t/t3427-rebase-subtree.sh         | 20 +++++------
 t/t3430-rebase-merges.sh          | 16 ++++-----
 t/t3431-rebase-fork-point.sh      | 32 ++++++++---------
 t/t3432-rebase-fast-forward.sh    | 34 +++++++++---------
 t/t3434-rebase-i18n.sh            |  8 ++---
 t/t3435-rebase-gpg-sign.sh        |  4 +--
 t/t3436-rebase-more-options.sh    |  2 +-
 t/test-lib.sh                     |  8 ++++-
 24 files changed, 239 insertions(+), 233 deletions(-)
t/t3400-rebase.sh +30 -30
index 40d2975995..cdfc7e083a 100755
@@ -24,15 +24,15 @@ test_expect_success 'prepare repository with topic branches' '
 	git update-index --add Y &&
 	git commit -m "Add Y." &&
 	git checkout -b filemove &&
-	git reset --soft master &&
+	git reset --soft main &&
 	mkdir D &&
 	git mv A D/A &&
 	git commit -m "Move A." &&
-	git checkout -b my-topic-branch master &&
+	git checkout -b my-topic-branch main &&
 	echo Second >B &&
 	git update-index --add B &&
 	git commit -m "Add B." &&
-	git checkout -f master &&
+	git checkout -f main &&
 	echo Third >>A &&
 	git update-index A &&
 	git commit -m "Modify A." &&
@@ -46,23 +46,23 @@ test_expect_success 'prepare repository with topic branches' '
 
 test_expect_success 'rebase on dirty worktree' '
 	echo dirty >>A &&
-	test_must_fail git rebase master
+	test_must_fail git rebase main
 '
 
 test_expect_success 'rebase on dirty cache' '
 	git add A &&
-	test_must_fail git rebase master
+	test_must_fail git rebase main
 '
 
-test_expect_success 'rebase against master' '
+test_expect_success 'rebase against main' '
 	git reset --hard HEAD &&
-	git rebase master
+	git rebase main
 '
 
 test_expect_success 'rebase sets ORIG_HEAD to pre-rebase state' '
 	git checkout -b orig-head topic &&
 	pre="$(git rev-parse --verify HEAD)" &&
-	git rebase master &&
+	git rebase main &&
 	test_cmp_rev "$pre" ORIG_HEAD &&
 	test_cmp_rev ! "$pre" HEAD
 '
@@ -93,19 +93,19 @@ test_expect_success 'HEAD was detached during rebase' '
 
 test_expect_success 'rebase from ambiguous branch name' '
 	git checkout -b topic side &&
-	git rebase master
+	git rebase main
 '
 
 test_expect_success 'rebase off of the previous branch using "-"' '
-	git checkout master &&
+	git checkout main &&
 	git checkout HEAD^ &&
 	git rebase @{-1} >expect.messages &&
-	git merge-base master HEAD >expect.forkpoint &&
+	git merge-base main HEAD >expect.forkpoint &&
 
-	git checkout master &&
+	git checkout main &&
 	git checkout HEAD^ &&
 	git rebase - >actual.messages &&
-	git merge-base master HEAD >actual.forkpoint &&
+	git merge-base main HEAD >actual.forkpoint &&
 
 	test_cmp expect.forkpoint actual.forkpoint &&
 	# the next one is dubious---we may want to say "-",
@@ -114,7 +114,7 @@ test_expect_success 'rebase off of the previous branch using "-"' '
 '
 
 test_expect_success 'rebase a single mode change' '
-	git checkout master &&
+	git checkout main &&
 	git branch -D topic &&
 	echo 1 >X &&
 	git add X &&
@@ -126,7 +126,7 @@ test_expect_success 'rebase a single mode change' '
 	test_chmod +x A &&
 	test_tick &&
 	git commit -m modechange &&
-	GIT_TRACE=1 git rebase master
+	GIT_TRACE=1 git rebase main
 '
 
 test_expect_success 'rebase is not broken by diff.renames' '
@@ -162,11 +162,11 @@ test_expect_success 'fail when upstream arg is missing and not configured' '
 test_expect_success 'rebase works with format.useAutoBase' '
 	test_config format.useAutoBase true &&
 	git checkout topic &&
-	git rebase master
+	git rebase main
 '
 
 test_expect_success 'default to common base in @{upstream}s reflog if no upstream arg (--merge)' '
-	git checkout -b default-base master &&
+	git checkout -b default-base main &&
 	git checkout -b default topic &&
 	git config branch.default.remote . &&
 	git config branch.default.merge refs/heads/default-base &&
@@ -184,7 +184,7 @@ test_expect_success 'default to common base in @{upstream}s reflog if no upstrea
 '
 
 test_expect_success 'default to common base in @{upstream}s reflog if no upstream arg (--apply)' '
-	git checkout -B default-base master &&
+	git checkout -B default-base main &&
 	git checkout -B default topic &&
 	git config branch.default.remote . &&
 	git config branch.default.merge refs/heads/default-base &&
@@ -226,13 +226,13 @@ test_expect_success 'cherry-picked commits and fork-point work together' '
 
 test_expect_success 'rebase --apply -q is quiet' '
 	git checkout -b quiet topic &&
-	git rebase --apply -q master >output.out 2>&1 &&
+	git rebase --apply -q main >output.out 2>&1 &&
 	test_must_be_empty output.out
 '
 
 test_expect_success 'rebase --merge -q is quiet' '
 	git checkout -B quiet topic &&
-	git rebase --merge -q master >output.out 2>&1 &&
+	git rebase --merge -q main >output.out 2>&1 &&
 	test_must_be_empty output.out
 '
 
@@ -294,7 +294,7 @@ test_expect_success 'rebase commit with an ancient timestamp' '
 '
 
 test_expect_success 'rebase with "From " line in commit message' '
-	git checkout -b preserve-from master~1 &&
+	git checkout -b preserve-from main~1 &&
 	cat >From_.msg <<EOF &&
 Somebody embedded an mbox in a commit message
 
@@ -310,7 +310,7 @@ EOF
 	>From_ &&
 	git add From_ &&
 	git commit -F From_.msg &&
-	git rebase master &&
+	git rebase main &&
 	git log -1 --pretty=format:%B >out &&
 	test_cmp From_.msg out
 '
@@ -357,12 +357,12 @@ test_expect_success 'rebase --apply and .gitattributes' '
 		git cherry-pick test &&
 
 		git checkout test &&
-		git rebase master &&
+		git rebase main &&
 		grep "smudged" a.txt &&
 
 		git checkout removal &&
 		git reset --hard &&
-		git rebase master &&
+		git rebase main &&
 		grep "clean" a.txt
 	)
 '
@@ -402,20 +402,20 @@ test_expect_success 'rebase -c rebase.useBuiltin=false warning' '
 '
 
 test_expect_success 'switch to branch checked out here' '
-	git checkout master &&
-	git rebase master master
+	git checkout main &&
+	git rebase main main
 '
 
 test_expect_success 'switch to branch not checked out' '
-	git checkout master &&
+	git checkout main &&
 	git branch other &&
-	git rebase master other
+	git rebase main other
 '
 
 test_expect_success 'refuse to switch to branch checked out elsewhere' '
-	git checkout master &&
+	git checkout main &&
 	git worktree add wt &&
-	test_must_fail git -C wt rebase master master 2>err &&
+	test_must_fail git -C wt rebase main main 2>err &&
 	test_i18ngrep "already checked out" err
 '
 
t/t3402-rebase-merge.sh +22 -22

132 lines not on this page · raw message

t/t3403-rebase-skip.sh +3 -3
index a927774910..360b46adef 100755
@@ -48,7 +48,7 @@ test_expect_success setup '
 	'
 
 test_expect_success 'rebase with git am -3 (default)' '
-	test_must_fail git rebase master
+	test_must_fail git rebase main
 '
 
 test_expect_success 'rebase --skip can not be used with other options' '
@@ -64,7 +64,7 @@ test_expect_success 'rebase moves back to skip-reference' '
 	test refs/heads/skip-reference = $(git symbolic-ref HEAD) &&
 	git branch post-rebase &&
 	git reset --hard pre-rebase &&
-	test_must_fail git rebase master &&
+	test_must_fail git rebase main &&
 	echo "hello" > hello &&
 	git add hello &&
 	git rebase --continue &&
@@ -75,7 +75,7 @@ test_expect_success 'rebase moves back to skip-reference' '
 test_expect_success 'checkout skip-merge' 'git checkout -f skip-merge'
 
 test_expect_success 'rebase with --merge' '
-	test_must_fail git rebase --merge master
+	test_must_fail git rebase --merge main
 '
 
 test_expect_success 'rebase --skip with --merge' '
t/t3405-rebase-malformed.sh +4 -4
index 860e63e444..7ef8bfa0ac 100755
@@ -52,7 +52,7 @@ test_expect_success setup '
 	git add file3 &&
 	git commit --allow-empty-message -m "" &&
 
-	git checkout master &&
+	git checkout main &&
 
 	echo One >file1 &&
 	test_tick &&
@@ -62,7 +62,7 @@ test_expect_success setup '
 
 test_expect_success 'rebase commit with multi-line subject' '
 
-	git rebase master multi-line-subject &&
+	git rebase main multi-line-subject &&
 	git cat-file commit HEAD | sed -e "1,/^\$/d" >F1 &&
 
 	test_cmp F0 F1 &&
@@ -70,14 +70,14 @@ test_expect_success 'rebase commit with multi-line subject' '
 '
 
 test_expect_success 'rebase commit with diff in message' '
-	git rebase master diff-in-message &&
+	git rebase main diff-in-message &&
 	git cat-file commit HEAD | sed -e "1,/^$/d" >G1 &&
 	test_cmp G0 G1 &&
 	test_cmp G G0
 '
 
 test_expect_success 'rebase -m commit with empty message' '
-	git rebase -m master empty-message-merge
+	git rebase -m main empty-message-merge
 '
 
 test_expect_success 'rebase -i commit with empty message' '
t/t3406-rebase-message.sh +12 -12
index 4afc528165..00e271fb36 100755
@@ -18,27 +18,27 @@ test_expect_success 'setup' '
 '
 
 test_expect_success 'rebase -m' '
-	git rebase -m master >actual &&
+	git rebase -m main >actual &&
 	test_must_be_empty actual
 '
 
-test_expect_success 'rebase against master twice' '
-	git rebase --apply master >out &&
+test_expect_success 'rebase against main twice' '
+	git rebase --apply main >out &&
 	test_i18ngrep "Current branch topic is up to date" out
 '
 
-test_expect_success 'rebase against master twice with --force' '
-	git rebase --force-rebase --apply master >out &&
+test_expect_success 'rebase against main twice with --force' '
+	git rebase --force-rebase --apply main >out &&
 	test_i18ngrep "Current branch topic is up to date, rebase forced" out
 '
 
-test_expect_success 'rebase against master twice from another branch' '
+test_expect_success 'rebase against main twice from another branch' '
 	git checkout topic^ &&
-	git rebase --apply master topic >out &&
+	git rebase --apply main topic >out &&
 	test_i18ngrep "Current branch topic is up to date" out
 '
 
-test_expect_success 'rebase fast-forward to master' '
+test_expect_success 'rebase fast-forward to main' '
 	git checkout topic^ &&
 	git rebase --apply topic >out &&
 	test_i18ngrep "Fast-forwarded HEAD to topic" out
@@ -46,21 +46,21 @@ test_expect_success 'rebase fast-forward to master' '
 
 test_expect_success 'rebase --stat' '
 	git reset --hard start &&
-	git rebase --stat master >diffstat.txt &&
+	git rebase --stat main >diffstat.txt &&
 	grep "^ fileX |  *1 +$" diffstat.txt
 '
 
 test_expect_success 'rebase w/config rebase.stat' '
 	git reset --hard start &&
 	git config rebase.stat true &&
-	git rebase master >diffstat.txt &&
+	git rebase main >diffstat.txt &&
 	grep "^ fileX |  *1 +$" diffstat.txt
 '
 
 test_expect_success 'rebase -n overrides config rebase.stat config' '
 	git reset --hard start &&
 	git config rebase.stat true &&
-	git rebase -n master >diffstat.txt &&
+	git rebase -n main >diffstat.txt &&
 	! grep "^ fileX |  *1 +$" diffstat.txt
 '
 
@@ -113,7 +113,7 @@ test_expect_success 'rebase -i onto unrelated history' '
 	git init unrelated &&
 	test_commit -C unrelated 1 &&
 	git -C unrelated remote add -f origin "$PWD" &&
-	git -C unrelated branch --set-upstream-to=origin/master &&
+	git -C unrelated branch --set-upstream-to=origin/main &&
 	git -C unrelated -c core.editor=true rebase -i -v --stat >actual &&
 	test_i18ngrep "Changes to " actual &&
 	test_i18ngrep "5 files changed" actual
t/t3407-rebase-abort.sh +9 -9
index 97efea0f56..2c2a5b9c10 100755
@@ -37,7 +37,7 @@ testrebase() {
 		cd "$work_dir" &&
 		# Clean up the state from the previous one
 		git reset --hard pre-rebase &&
-		test_must_fail git rebase$type master &&
+		test_must_fail git rebase$type main &&
 		test_path_is_dir "$dotest" &&
 		git rebase --abort &&
 		test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
@@ -48,10 +48,10 @@ testrebase() {
 		cd "$work_dir" &&
 		# Clean up the state from the previous one
 		git reset --hard pre-rebase &&
-		test_must_fail git rebase$type master &&
+		test_must_fail git rebase$type main &&
 		test_path_is_dir "$dotest" &&
 		test_must_fail git rebase --skip &&
-		test $(git rev-parse HEAD) = $(git rev-parse master) &&
+		test $(git rev-parse HEAD) = $(git rev-parse main) &&
 		git rebase --abort &&
 		test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
 		test ! -d "$dotest"
@@ -61,13 +61,13 @@ testrebase() {
 		cd "$work_dir" &&
 		# Clean up the state from the previous one
 		git reset --hard pre-rebase &&
-		test_must_fail git rebase$type master &&
+		test_must_fail git rebase$type main &&
 		test_path_is_dir "$dotest" &&
 		echo c > a &&
 		echo d >> a &&
 		git add a &&
 		test_must_fail git rebase --continue &&
-		test $(git rev-parse HEAD) != $(git rev-parse master) &&
+		test $(git rev-parse HEAD) != $(git rev-parse main) &&
 		git rebase --abort &&
 		test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
 		test ! -d "$dotest"
@@ -78,7 +78,7 @@ testrebase() {
 		# Clean up the state from the previous one
 		git reset --hard pre-rebase &&
 		git reflog show to-rebase > reflog_before &&
-		test_must_fail git rebase$type master &&
+		test_must_fail git rebase$type main &&
 		git rebase --abort &&
 		git reflog show to-rebase > reflog_after &&
 		test_cmp reflog_before reflog_after &&
@@ -89,7 +89,7 @@ testrebase() {
 		cd "$work_dir" &&
 		# Clean up the state from the previous one
 		git reset --hard pre-rebase &&
-		test_must_fail git rebase$type master &&
+		test_must_fail git rebase$type main &&
 		test_must_fail git rebase -v --abort &&
 		test_must_fail git rebase --abort -v &&
 		git rebase --abort
@@ -103,7 +103,7 @@ test_expect_success 'rebase --apply --quit' '
 	cd "$work_dir" &&
 	# Clean up the state from the previous one
 	git reset --hard pre-rebase &&
-	test_must_fail git rebase --apply master &&
+	test_must_fail git rebase --apply main &&
 	test_path_is_dir .git/rebase-apply &&
 	head_before=$(git rev-parse HEAD) &&
 	git rebase --quit &&
@@ -115,7 +115,7 @@ test_expect_success 'rebase --merge --quit' '
 	cd "$work_dir" &&
 	# Clean up the state from the previous one
 	git reset --hard pre-rebase &&
-	test_must_fail git rebase --merge master &&
+	test_must_fail git rebase --merge main &&
 	test_path_is_dir .git/rebase-merge &&
 	head_before=$(git rev-parse HEAD) &&
 	git rebase --quit &&
t/t3408-rebase-multi-line.sh +1 -1
index d2bd7c17b0..1cba82f001 100755
@@ -46,7 +46,7 @@ But otherwise with a sane description." side2 &&
 test_expect_success rebase '
 
 	git checkout side &&
-	git rebase master &&
+	git rebase main &&
 	git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
 	git cat-file commit side@{1} | sed -e "1,/^\$/d" >expect &&
 	test_cmp expect actual
t/t3409-rebase-preserve-merges.sh +5 -5
index 3b340f1ece..b078985b95 100755
@@ -18,7 +18,7 @@ export GIT_AUTHOR_EMAIL
 
 # Clone 2 (conflicting merge):
 #
-# A1--A2--B3   <-- origin/master
+# A1--A2--B3   <-- origin/main
 #  \       \
 #   B1------M  <-- topic
 #    \
@@ -26,7 +26,7 @@ export GIT_AUTHOR_EMAIL
 #
 # Clone 3 (no-ff merge):
 #
-# A1--A2--B3   <-- origin/master
+# A1--A2--B3   <-- origin/main
 #  \
 #   B1------M  <-- topic
 #    \     /
@@ -44,7 +44,7 @@ test_expect_success 'setup for merge-preserving rebase' \
 	echo Second > B &&
 	git add B &&
 	git commit -m "Add B1" &&
-	git checkout -f master &&
+	git checkout -f main &&
 	echo Third >> A &&
 	git commit -a -m "Modify A2" &&
 	echo Fifth > B &&
@@ -55,10 +55,10 @@ test_expect_success 'setup for merge-preserving rebase' \
 	(
 		cd clone2 &&
 		git checkout -b topic origin/topic &&
-		test_must_fail git merge origin/master &&
+		test_must_fail git merge origin/main &&
 		echo Resolved >B &&
 		git add B &&
-		git commit -m "Merge origin/master into topic"
+		git commit -m "Merge origin/main into topic"
 	) &&
 
 	git clone ./. clone3 &&
t/t3412-rebase-root.sh +14 -14
index 21632a984e..120315ac0e 100755
@@ -24,7 +24,7 @@ test_expect_success 'prepare repository' '
 
 test_expect_success 'rebase --root fails with too many args' '
 	git checkout -B fail other &&
-	test_must_fail git rebase --onto master --root fail fail
+	test_must_fail git rebase --onto main --root fail fail
 '
 
 test_expect_success 'setup pre-rebase hook' '
@@ -44,7 +44,7 @@ EOF
 
 test_expect_success 'rebase --root --onto <newbase>' '
 	git checkout -b work other &&
-	git rebase --root --onto master &&
+	git rebase --root --onto main &&
 	git log --pretty=tformat:"%s" > rebased &&
 	test_cmp expect rebased
 '
@@ -55,7 +55,7 @@ test_expect_success 'pre-rebase got correct input (1)' '
 
 test_expect_success 'rebase --root --onto <newbase> <branch>' '
 	git branch work2 other &&
-	git rebase --root --onto master work2 &&
+	git rebase --root --onto main work2 &&
 	git log --pretty=tformat:"%s" > rebased2 &&
 	test_cmp expect rebased2
 '
@@ -66,7 +66,7 @@ test_expect_success 'pre-rebase got correct input (2)' '
 
 test_expect_success 'rebase -i --root --onto <newbase>' '
 	git checkout -b work3 other &&
-	git rebase -i --root --onto master &&
+	git rebase -i --root --onto main &&
 	git log --pretty=tformat:"%s" > rebased3 &&
 	test_cmp expect rebased3
 '
@@ -77,7 +77,7 @@ test_expect_success 'pre-rebase got correct input (3)' '
 
 test_expect_success 'rebase -i --root --onto <newbase> <branch>' '
 	git branch work4 other &&
-	git rebase -i --root --onto master work4 &&
+	git rebase -i --root --onto main work4 &&
 	git log --pretty=tformat:"%s" > rebased4 &&
 	test_cmp expect rebased4
 '
@@ -88,7 +88,7 @@ test_expect_success 'pre-rebase got correct input (4)' '
 
 test_expect_success REBASE_P 'rebase -i -p with linear history' '
 	git checkout -b work5 other &&
-	git rebase -i -p --root --onto master &&
+	git rebase -i -p --root --onto main &&
 	git log --pretty=tformat:"%s" > rebased5 &&
 	test_cmp expect rebased5
 '
@@ -122,7 +122,7 @@ EOF
 
 test_expect_success REBASE_P 'rebase -i -p with merge' '
 	git checkout -b work6 other &&
-	git rebase -i -p --root --onto master &&
+	git rebase -i -p --root --onto main &&
 	log_with_names work6 > rebased6 &&
 	test_cmp expect-side rebased6
 '
@@ -157,7 +157,7 @@ EOF
 
 test_expect_success REBASE_P 'rebase -i -p with two roots' '
 	git checkout -b work7 other &&
-	git rebase -i -p --root --onto master &&
+	git rebase -i -p --root --onto main &&
 	log_with_names work7 > rebased7 &&
 	test_cmp expect-third rebased7
 '
@@ -173,14 +173,14 @@ EOF
 
 test_expect_success 'pre-rebase hook stops rebase' '
 	git checkout -b stops1 other &&
-	test_must_fail git rebase --root --onto master &&
+	test_must_fail git rebase --root --onto main &&
 	test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops1 &&
 	test 0 = $(git rev-list other...stops1 | wc -l)
 '
 
 test_expect_success 'pre-rebase hook stops rebase -i' '
 	git checkout -b stops2 other &&
-	test_must_fail git rebase --root --onto master &&
+	test_must_fail git rebase --root --onto main &&
 	test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops2 &&
 	test 0 = $(git rev-list other...stops2 | wc -l)
 '
@@ -190,7 +190,7 @@ test_expect_success 'remove pre-rebase hook' '
 '
 
 test_expect_success 'set up a conflict' '
-	git checkout master &&
+	git checkout main &&
 	echo conflict > B &&
 	git add B &&
 	git commit -m conflict
@@ -198,7 +198,7 @@ test_expect_success 'set up a conflict' '
 
 test_expect_success 'rebase --root with conflict (first part)' '
 	git checkout -b conflict1 other &&
-	test_must_fail git rebase --root --onto master &&
+	test_must_fail git rebase --root --onto main &&
 	git ls-files -u | grep "B$"
 '
 
@@ -225,7 +225,7 @@ test_expect_success 'rebase --root with conflict (second part)' '
 
 test_expect_success 'rebase -i --root with conflict (first part)' '
 	git checkout -b conflict2 other &&
-	test_must_fail git rebase -i --root --onto master &&
+	test_must_fail git rebase -i --root --onto main &&
 	git ls-files -u | grep "B$"
 '
 
@@ -263,7 +263,7 @@ EOF
 
 test_expect_success REBASE_P 'rebase -i -p --root with conflict (first part)' '
 	git checkout -b conflict3 other &&
-	test_must_fail git rebase -i -p --root --onto master &&
+	test_must_fail git rebase -i -p --root --onto main &&
 	git ls-files -u | grep "B$"
 '
 
t/t3413-rebase-hook.sh +21 -21

123 lines not on this page · raw message

t/t3415-rebase-autosquash.sh +1 -1
index 7bab6000dc..40bb7ac649 100755
@@ -407,7 +407,7 @@ test_expect_success 'wrapped original subject' '
 
 test_expect_success 'abort last squash' '
 	test_when_finished "test_might_fail git rebase --abort" &&
-	test_when_finished "git checkout master" &&
+	test_when_finished "git checkout main" &&
 
 	git checkout -b some-squashes &&
 	git commit --allow-empty -m first &&
t/t3416-rebase-onto-threedots.sh +27 -27

167 lines not on this page · raw message

t/t3418-rebase-continue.sh +12 -12
index 7a2da972fd..b9e059e168 100755
@@ -15,13 +15,13 @@ test_expect_success 'setup' '
 	git checkout -b topic HEAD^ &&
 	test_commit "commit-new-file-F2-on-topic-branch" F2 22 &&
 
-	git checkout master
+	git checkout main
 '
 
 test_expect_success 'interactive rebase --continue works with touched file' '
 	rm -fr .git/rebase-* &&
 	git reset --hard &&
-	git checkout master &&
+	git checkout main &&
 
 	FAKE_LINES="edit 1" git rebase -i HEAD^ &&
 	test-tool chmtime =-60 F1 &&
@@ -31,9 +31,9 @@ test_expect_success 'interactive rebase --continue works with touched file' '
 test_expect_success 'non-interactive rebase --continue works with touched file' '
 	rm -fr .git/rebase-* &&
 	git reset --hard &&
-	git checkout master &&
+	git checkout main &&
 
-	test_must_fail git rebase --onto master master topic &&
+	test_must_fail git rebase --onto main main topic &&
 	echo "Resolved" >F2 &&
 	git add F2 &&
 	test-tool chmtime =-60 F1 &&
@@ -61,7 +61,7 @@ test_expect_success 'rebase --continue remembers merge strategy and options' '
 	chmod +x test-bin/git-merge-funny &&
 	(
 		PATH=./test-bin:$PATH &&
-		test_must_fail git rebase -s funny -Xopt master topic
+		test_must_fail git rebase -s funny -Xopt main topic
 	) &&
 	test -f funny.was.run &&
 	rm funny.was.run &&
@@ -93,7 +93,7 @@ test_expect_success 'rebase -i --continue handles merge strategy and options' '
 	chmod +x test-bin/git-merge-funny &&
 	(
 		PATH=./test-bin:$PATH &&
-		test_must_fail git rebase -i -s funny -Xopt -Xfoo master topic
+		test_must_fail git rebase -i -s funny -Xopt -Xfoo main topic
 	) &&
 	test -f funny.was.run &&
 	rm funny.was.run &&
@@ -188,11 +188,11 @@ test_expect_success '--skip after failed fixup cleans commit message' '
 test_expect_success 'setup rerere database' '
 	rm -fr .git/rebase-* &&
 	git reset --hard commit-new-file-F3-on-topic-branch &&
-	git checkout master &&
+	git checkout main &&
 	test_commit "commit-new-file-F3" F3 3 &&
 	test_config rerere.enabled true &&
 	git update-ref refs/heads/topic commit-new-file-F3-on-topic-branch &&
-	test_must_fail git rebase -m master topic &&
+	test_must_fail git rebase -m main topic &&
 	echo "Resolved" >F2 &&
 	cp F2 expected-F2 &&
 	git add F2 &&
@@ -207,7 +207,7 @@ test_expect_success 'setup rerere database' '
 prepare () {
 	rm -fr .git/rebase-* &&
 	git reset --hard commit-new-file-F3-on-topic-branch &&
-	git checkout master &&
+	git checkout main &&
 	test_config rerere.enabled true
 }
 
@@ -215,7 +215,7 @@ test_rerere_autoupdate () {
 	action=$1 &&
 	test_expect_success "rebase $action --continue remembers --rerere-autoupdate" '
 		prepare &&
-		test_must_fail git rebase $action --rerere-autoupdate master topic &&
+		test_must_fail git rebase $action --rerere-autoupdate main topic &&
 		test_cmp expected-F2 F2 &&
 		git diff-files --quiet &&
 		test_must_fail git rebase --continue &&
@@ -227,7 +227,7 @@ test_rerere_autoupdate () {
 	test_expect_success "rebase $action --continue honors rerere.autoUpdate" '
 		prepare &&
 		test_config rerere.autoupdate true &&
-		test_must_fail git rebase $action master topic &&
+		test_must_fail git rebase $action main topic &&
 		test_cmp expected-F2 F2 &&
 		git diff-files --quiet &&
 		test_must_fail git rebase --continue &&
@@ -239,7 +239,7 @@ test_rerere_autoupdate () {
 	test_expect_success "rebase $action --continue remembers --no-rerere-autoupdate" '
 		prepare &&
 		test_config rerere.autoupdate true &&
-		test_must_fail git rebase $action --no-rerere-autoupdate master topic &&
+		test_must_fail git rebase $action --no-rerere-autoupdate main topic &&
 		test_cmp expected-F2 F2 &&
 		test_must_fail git diff-files --quiet &&
 		git add F2 &&
t/t3419-rebase-patch-id.sh +6 -6
index 1f32faa4a4..29fa76be4d 100755
@@ -24,7 +24,7 @@ test_expect_success 'setup' '
 
 test_expect_success 'setup: 500 lines' '
 	rm -f .gitattributes &&
-	git checkout -q -f master &&
+	git checkout -q -f main &&
 	git reset --hard root &&
 	test_seq 500 >file &&
 	git add file &&
@@ -40,7 +40,7 @@ test_expect_success 'setup: 500 lines' '
 	git add newfile &&
 	git commit -q -m "add small file" &&
 
-	git cherry-pick master >/dev/null 2>&1
+	git cherry-pick main >/dev/null 2>&1
 '
 
 test_expect_success 'setup attributes' '
@@ -48,18 +48,18 @@ test_expect_success 'setup attributes' '
 '
 
 test_expect_success 'detect upstream patch' '
-	git checkout -q master &&
+	git checkout -q main &&
 	scramble file &&
 	git add file &&
 	git commit -q -m "change big file again" &&
 	git checkout -q other^{} &&
-	git rebase master &&
-	git rev-list master...HEAD~ >revs &&
+	git rebase main &&
+	git rev-list main...HEAD~ >revs &&
 	test_must_be_empty revs
 '
 
 test_expect_success 'do not drop patch' '
-	git branch -f squashed master &&
+	git branch -f squashed main &&
 	git checkout -q -f squashed &&
 	git reset -q --soft HEAD~2 &&
 	git commit -q -m squashed &&
t/t3420-rebase-autostash.sh +4 -4
index ca331733fb..b1263e5a47 100755
@@ -21,12 +21,12 @@ test_expect_success setup '
 	git add . &&
 	test_tick &&
 	git commit -m "third commit" &&
-	git checkout -b unrelated-onto-branch master &&
+	git checkout -b unrelated-onto-branch main &&
 	echo unrelated >file4 &&
 	git add . &&
 	test_tick &&
 	git commit -m "unrelated commit" &&
-	git checkout -b related-onto-branch master &&
+	git checkout -b related-onto-branch main &&
 	echo conflicting-change >file2 &&
 	git add . &&
 	test_tick &&
@@ -305,7 +305,7 @@ test_expect_success 'autostash is saved on editor failure with conflict' '
 '
 
 test_expect_success 'autostash with dirty submodules' '
-	test_when_finished "git reset --hard && git checkout master" &&
+	test_when_finished "git reset --hard && git checkout main" &&
 	git checkout -b with-submodule &&
 	git submodule add ./ sub &&
 	test_tick &&
@@ -324,7 +324,7 @@ test_expect_success 'branch is left alone when possible' '
 
 test_expect_success 'never change active branch' '
 	git checkout -b not-the-feature-branch unrelated-onto-branch &&
-	test_when_finished "git reset --hard && git checkout master" &&
+	test_when_finished "git reset --hard && git checkout main" &&
 	echo changed >file0 &&
 	git rebase --autostash not-the-feature-branch feature-branch &&
 	test_cmp_rev not-the-feature-branch unrelated-onto-branch
t/t3423-rebase-reword.sh +3 -3
index 6963750794..4859bb8f72 100755
@@ -7,7 +7,7 @@ test_description='git rebase interactive with rewording'
 . "$TEST_DIRECTORY"/lib-rebase.sh
 
 test_expect_success 'setup' '
-	test_commit master file-1 test &&
+	test_commit main file-1 test &&
 
 	git checkout -b stuff &&
 
@@ -22,7 +22,7 @@ test_expect_success 'reword without issues functions as intended' '
 
 	set_fake_editor &&
 	FAKE_LINES="pick 1 reword 2" FAKE_COMMIT_MESSAGE="feature_b_reworded" \
-		git rebase -i -v master &&
+		git rebase -i -v main &&
 
 	test "$(git log -1 --format=%B)" = "feature_b_reworded" &&
 	test $(git rev-list --count HEAD) = 3
@@ -35,7 +35,7 @@ test_expect_success 'reword after a conflict preserves commit' '
 
 	set_fake_editor &&
 	test_must_fail env FAKE_LINES="reword 2" \
-		git rebase -i -v master &&
+		git rebase -i -v main &&
 
 	git checkout --theirs file-2 &&
 	git add file-2 &&
t/t3427-rebase-subtree.sh +10 -10
index 5839719ba1..265856ece6 100755
@@ -17,7 +17,7 @@ commit_message() {
 #
 # topic_1 - topic_2 - topic_3
 #                             \
-# README ---------------------- Add subproject master - topic_4 - files_subtree/topic_5
+# README ---------------------- Add subproject main - topic_4 - files_subtree/topic_5
 #
 # Where the merge moves the files topic_[123].t into the subdirectory
 # files_subtree/ and topic_4 as well as files_subtree/topic_5 add files to that
@@ -28,7 +28,7 @@ commit_message() {
 # an empty commit is added on top. The pre-rebase commit history looks like
 # this:
 #
-# Add subproject master - topic_4 - files_subtree/topic_5 - Empty commit
+# Add subproject main - topic_4 - files_subtree/topic_5 - Empty commit
 #
 # where the root commit adds three files: topic_1.t, topic_2.t and topic_3.t.
 #
@@ -48,11 +48,11 @@ test_expect_success 'setup' '
 	test_commit -C files topic_3 &&
 
 	: perform subtree merge into files_subtree/ &&
-	git fetch files refs/heads/master:refs/heads/files-master &&
+	git fetch files refs/heads/main:refs/heads/files-main &&
 	git merge -s ours --no-commit --allow-unrelated-histories \
-		files-master &&
-	git read-tree --prefix=files_subtree -u files-master &&
-	git commit -m "Add subproject master" &&
+		files-main &&
+	git read-tree --prefix=files_subtree -u files-main &&
+	git commit -m "Add subproject main" &&
 
 	: add two extra commits to rebase &&
 	test_commit -C files_subtree topic_4 &&
@@ -70,7 +70,7 @@ test_expect_success 'setup' '
 test_expect_failure REBASE_P 'Rebase -Xsubtree --preserve-merges --onto commit' '
 	reset_rebase &&
 	git checkout -b rebase-preserve-merges to-rebase &&
-	git rebase -Xsubtree=files_subtree --preserve-merges --onto files-master master &&
+	git rebase -Xsubtree=files_subtree --preserve-merges --onto files-main main &&
 	verbose test "$(commit_message HEAD~)" = "topic_4" &&
 	verbose test "$(commit_message HEAD)" = "files_subtree/topic_5"
 '
@@ -79,7 +79,7 @@ test_expect_failure REBASE_P 'Rebase -Xsubtree --preserve-merges --onto commit'
 test_expect_failure REBASE_P 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit' '
 	reset_rebase &&
 	git checkout -b rebase-keep-empty to-rebase &&
-	git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master &&
+	git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-main main &&
 	verbose test "$(commit_message HEAD~2)" = "topic_4" &&
 	verbose test "$(commit_message HEAD~)" = "files_subtree/topic_5" &&
 	verbose test "$(commit_message HEAD)" = "Empty commit"
@@ -88,7 +88,7 @@ test_expect_failure REBASE_P 'Rebase -Xsubtree --keep-empty --preserve-merges --
 test_expect_success 'Rebase -Xsubtree --empty=ask --onto commit' '
 	reset_rebase &&
 	git checkout -b rebase-onto to-rebase &&
-	test_must_fail git rebase -Xsubtree=files_subtree --empty=ask --onto files-master master &&
+	test_must_fail git rebase -Xsubtree=files_subtree --empty=ask --onto files-main main &&
 	: first pick results in no changes &&
 	git rebase --skip &&
 	verbose test "$(commit_message HEAD~2)" = "topic_4" &&
@@ -99,7 +99,7 @@ test_expect_success 'Rebase -Xsubtree --empty=ask --onto commit' '
 test_expect_success 'Rebase -Xsubtree --empty=ask --rebase-merges --onto commit' '
 	reset_rebase &&
 	git checkout -b rebase-merges-onto to-rebase &&
-	test_must_fail git rebase -Xsubtree=files_subtree --empty=ask --rebase-merges --onto files-master --root &&
+	test_must_fail git rebase -Xsubtree=files_subtree --empty=ask --rebase-merges --onto files-main --root &&
 	: first pick results in no changes &&
 	git rebase --skip &&
 	verbose test "$(commit_message HEAD~2)" = "topic_4" &&
t/t3430-rebase-merges.sh +8 -8
index b454f400eb..3cc99693af 100755
@@ -12,7 +12,7 @@ Initial setup:
 
     -- B --                   (first)
    /       \
- A - C - D - E - H            (master)
+ A - C - D - E - H            (main)
    \    \       /
     \    F - G                (second)
      \
@@ -37,7 +37,7 @@ test_expect_success 'setup' '
 	git checkout -b first &&
 	test_commit B &&
 	b=$(git rev-parse --short HEAD) &&
-	git checkout master &&
+	git checkout main &&
 	test_commit C &&
 	c=$(git rev-parse --short HEAD) &&
 	test_commit D &&
@@ -52,7 +52,7 @@ test_expect_success 'setup' '
 	f=$(git rev-parse --short HEAD) &&
 	test_commit G &&
 	g=$(git rev-parse --short HEAD) &&
-	git checkout master &&
+	git checkout main &&
 	git merge --no-commit G &&
 	test_tick &&
 	git commit -m H &&
@@ -82,7 +82,7 @@ test_expect_success 'create completely different structure' '
 	EOF
 	test_config sequence.editor \""$PWD"/replace-editor.sh\" &&
 	test_tick &&
-	git rebase -i -r A master &&
+	git rebase -i -r A main &&
 	test_cmp_graph <<-\EOF
 	*   Merge the topic branch '\''onebranch'\''
 	|\
@@ -183,7 +183,7 @@ test_expect_success 'fast-forward merge -c still rewords' '
 '
 
 test_expect_success 'with a branch tip that was cherry-picked already' '
-	git checkout -b already-upstream master &&
+	git checkout -b already-upstream main &&
 	base="$(git rev-parse --verify HEAD)" &&
 
 	test_commit A1 &&
@@ -211,7 +211,7 @@ test_expect_success 'with a branch tip that was cherry-picked already' '
 '
 
 test_expect_success 'do not rebase cousins unless asked for' '
-	git checkout -b cousins master &&
+	git checkout -b cousins main &&
 	before="$(git rev-parse --verify HEAD)" &&
 	test_tick &&
 	git rebase -r HEAD^ &&
@@ -340,7 +340,7 @@ test_expect_success 'a "merge" into a root commit is a fast-forward' '
 test_expect_success 'A root commit can be a cousin, treat it that way' '
 	git checkout --orphan khnum &&
 	test_commit yama &&
-	git checkout -b asherah master &&
+	git checkout -b asherah main &&
 	test_commit shamkat &&
 	git merge --allow-unrelated-histories khnum &&
 	test_tick &&
@@ -367,7 +367,7 @@ test_expect_success 'labels that are object IDs are rewritten' '
 	git checkout -b third B &&
 	test_commit I &&
 	third=$(git rev-parse HEAD) &&
-	git checkout -b labels master &&
+	git checkout -b labels main &&
 	git merge --no-commit third &&
 	test_tick &&
 	git commit -m "Merge commit '\''$third'\'' into labels" &&
t/t3431-rebase-fork-point.sh +16 -16
index 172562789e..d5d9b2304d 100755
@@ -7,11 +7,11 @@ test_description='git rebase --fork-point test'
 
 . ./test-lib.sh
 
-# A---B---D---E    (master)
+# A---B---D---E    (main)
 #      \
 #       C*---F---G (side)
 #
-# C was formerly part of master but master was rewound to remove C
+# C was formerly part of main but main was rewound to remove C
 #
 test_expect_success setup '
 	test_commit A &&
@@ -30,7 +30,7 @@ test_rebase () {
 	expected="$1" &&
 	shift &&
 	test_expect_success "git rebase $*" "
-		git checkout master &&
+		git checkout main &&
 		git reset --hard E &&
 		git checkout side &&
 		git reset --hard G &&
@@ -48,26 +48,26 @@ test_rebase 'G F C E D B A' --no-fork-point
 test_rebase 'G F C D B A' --no-fork-point --onto D
 test_rebase 'G F C B A' --no-fork-point --keep-base
 
-test_rebase 'G F E D B A' --fork-point refs/heads/master
-test_rebase 'G F E D B A' --fork-point master
+test_rebase 'G F E D B A' --fork-point refs/heads/main
+test_rebase 'G F E D B A' --fork-point main
 
-test_rebase 'G F D B A' --fork-point --onto D refs/heads/master
-test_rebase 'G F D B A' --fork-point --onto D master
+test_rebase 'G F D B A' --fork-point --onto D refs/heads/main
+test_rebase 'G F D B A' --fork-point --onto D main
 
-test_rebase 'G F B A' --fork-point --keep-base refs/heads/master
-test_rebase 'G F B A' --fork-point --keep-base master
+test_rebase 'G F B A' --fork-point --keep-base refs/heads/main
+test_rebase 'G F B A' --fork-point --keep-base main
 
-test_rebase 'G F C E D B A' refs/heads/master
-test_rebase 'G F C E D B A' master
+test_rebase 'G F C E D B A' refs/heads/main
+test_rebase 'G F C E D B A' main
 
-test_rebase 'G F C D B A' --onto D refs/heads/master
-test_rebase 'G F C D B A' --onto D master
+test_rebase 'G F C D B A' --onto D refs/heads/main
+test_rebase 'G F C D B A' --onto D main
 
-test_rebase 'G F C B A' --keep-base refs/heads/master
-test_rebase 'G F C B A' --keep-base master
+test_rebase 'G F C B A' --keep-base refs/heads/main
+test_rebase 'G F C B A' --keep-base main
 
 test_expect_success 'git rebase --fork-point with ambigous refname' '
-	git checkout master &&
+	git checkout main &&
 	git checkout -b one &&
 	git checkout side &&
 	git tag one &&
t/t3432-rebase-fast-forward.sh +17 -17
index a29eda87e9..b87537ca7d 100755
@@ -84,19 +84,19 @@ test_rebase_same_head_ () {
 
 changes='no changes'
 test_rebase_same_head success noop same success work same
-test_rebase_same_head success noop same success work same master
+test_rebase_same_head success noop same success work same main
 test_rebase_same_head success noop same success work diff --onto B B
 test_rebase_same_head success noop same success work diff --onto B... B
-test_rebase_same_head success noop same success work same --onto master... master
-test_rebase_same_head success noop same success work same --keep-base master
+test_rebase_same_head success noop same success work same --onto main... main
+test_rebase_same_head success noop same success work same --keep-base main
 test_rebase_same_head success noop same success work same --keep-base
 test_rebase_same_head success noop same success work same --no-fork-point
 test_rebase_same_head success noop same success work same --keep-base --no-fork-point
-test_rebase_same_head success noop same success work same --fork-point master
+test_rebase_same_head success noop same success work same --fork-point main
 test_rebase_same_head success noop same success work diff --fork-point --onto B B
 test_rebase_same_head success noop same success work diff --fork-point --onto B... B
-test_rebase_same_head success noop same success work same --fork-point --onto master... master
-test_rebase_same_head success noop same success work same --keep-base --keep-base master
+test_rebase_same_head success noop same success work same --fork-point --onto main... main
+test_rebase_same_head success noop same success work same --keep-base --keep-base main
 
 test_expect_success 'add work same to side' '
 	test_commit E
@@ -104,22 +104,22 @@ test_expect_success 'add work same to side' '
 
 changes='our changes'
 test_rebase_same_head success noop same success work same
-test_rebase_same_head success noop same success work same master
+test_rebase_same_head success noop same success work same main
 test_rebase_same_head success noop same success work diff --onto B B
 test_rebase_same_head success noop same success work diff --onto B... B
-test_rebase_same_head success noop same success work same --onto master... master
-test_rebase_same_head success noop same success work same --keep-base master
+test_rebase_same_head success noop same success work same --onto main... main
+test_rebase_same_head success noop same success work same --keep-base main
 test_rebase_same_head success noop same success work same --keep-base
 test_rebase_same_head success noop same success work same --no-fork-point
 test_rebase_same_head success noop same success work same --keep-base --no-fork-point
-test_rebase_same_head success noop same success work same --fork-point master
+test_rebase_same_head success noop same success work same --fork-point main
 test_rebase_same_head success noop same success work diff --fork-point --onto B B
 test_rebase_same_head success noop same success work diff --fork-point --onto B... B
-test_rebase_same_head success noop same success work same --fork-point --onto master... master
-test_rebase_same_head success noop same success work same --fork-point --keep-base master
+test_rebase_same_head success noop same success work same --fork-point --onto main... main
+test_rebase_same_head success noop same success work same --fork-point --keep-base main
 
 test_expect_success 'add work same to upstream' '
-	git checkout master &&
+	git checkout main &&
 	test_commit F &&
 	git checkout side
 '
@@ -127,12 +127,12 @@ test_expect_success 'add work same to upstream' '
 changes='our and their changes'
 test_rebase_same_head success noop same success work diff --onto B B
 test_rebase_same_head success noop same success work diff --onto B... B
-test_rebase_same_head success noop same success work diff --onto master... master
-test_rebase_same_head success noop same success work diff --keep-base master
+test_rebase_same_head success noop same success work diff --onto main... main
+test_rebase_same_head success noop same success work diff --keep-base main
 test_rebase_same_head success noop same success work diff --keep-base
 test_rebase_same_head failure work same success work diff --fork-point --onto B B
 test_rebase_same_head failure work same success work diff --fork-point --onto B... B
-test_rebase_same_head success noop same success work diff --fork-point --onto master... master
-test_rebase_same_head success noop same success work diff --fork-point --keep-base master
+test_rebase_same_head success noop same success work diff --fork-point --onto main... main
+test_rebase_same_head success noop same success work diff --fork-point --keep-base main
 
 test_done
t/t3434-rebase-i18n.sh +4 -4
index c7c835cde9..a252908d02 100755
@@ -7,7 +7,7 @@ test_description='rebase with changing encoding
 
 Initial setup:
 
-1 - 2              master
+1 - 2              main
  \
   3 - 4            first
    \
@@ -41,7 +41,7 @@ test_expect_success 'rebase --rebase-merges update encoding eucJP to UTF-8' '
 	git config i18n.commitencoding eucJP &&
 	git merge -F "$TEST_DIRECTORY/t3434/eucJP.txt" second &&
 	git config i18n.commitencoding UTF-8 &&
-	git rebase --rebase-merges master &&
+	git rebase --rebase-merges main &&
 	compare_msg eucJP.txt eucJP UTF-8
 '
 
@@ -50,7 +50,7 @@ test_expect_success 'rebase --rebase-merges update encoding eucJP to ISO-2022-JP
 	git config i18n.commitencoding eucJP &&
 	git merge -F "$TEST_DIRECTORY/t3434/eucJP.txt" second &&
 	git config i18n.commitencoding ISO-2022-JP &&
-	git rebase --rebase-merges master &&
+	git rebase --rebase-merges main &&
 	compare_msg eucJP.txt eucJP ISO-2022-JP
 '
 
@@ -66,7 +66,7 @@ test_rebase_continue_update_encode () {
 		git config i18n.commitencoding $old &&
 		git commit -F "$TEST_DIRECTORY/t3434/$msgfile" &&
 		git config i18n.commitencoding $new &&
-		test_must_fail git rebase -m master &&
+		test_must_fail git rebase -m main &&
 		test -f .git/rebase-merge/message &&
 		git stripspace <.git/rebase-merge/message >two.t &&
 		git add two.t &&
t/t3435-rebase-gpg-sign.sh +2 -2
index 54120b09d6..aab2b3aab8 100755
@@ -46,7 +46,7 @@ test_expect_success 'setup: merge commit' '
 	test_commit fork-point &&
 	git switch -c side &&
 	test_commit three &&
-	git switch master &&
+	git switch main &&
 	git merge --no-ff side &&
 	git tag merged
 '
@@ -64,7 +64,7 @@ test_rebase_gpg_sign   false -i --no-gpg-sign --gpg-sign
 test_expect_failure 'rebase -p --no-gpg-sign override commit.gpgsign' '
 	git reset --hard merged &&
 	git config commit.gpgsign true &&
-	git rebase -p --no-gpg-sign --onto=one fork-point master &&
+	git rebase -p --no-gpg-sign --onto=one fork-point main &&
 	test_must_fail git verify-commit HEAD
 '
 
t/t3436-rebase-more-options.sh +1 -1
index eaaf4c8d1d..4d106642ba 100755
@@ -28,7 +28,7 @@ test_expect_success 'setup' '
 	test_commit commit2 foo foo2 &&
 	test_commit commit3 foo foo3 &&
 
-	git checkout --orphan master &&
+	git checkout --orphan main &&
 	rm foo &&
 	test_write_lines "line 1" "        line 2" "line 3" >file &&
 	git commit -am "add file" &&
t/test-lib.sh +7 -1
index c464f8dcc8..4ae87a5c4e 100644
@@ -257,7 +257,13 @@ case "$TRASH_DIRECTORY" in
 esac
 
 case "$TEST_NUMBER" in
-[0-2]*|3[0-3]*)
+3404)
+	# Avoid conflicts with patch series that are cooking at the same time
+	# as the patch series changing the default of `init.defaultBranch`.
+	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
+	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+	;;
+[0-2]*|3[0-4]*)
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
Signature · 1 line
gitgitgadget
#1 lore raw

PATCH 1/28 t0060: preemptively adjust alignment

In reply to Johannes Schindelin via GitGitGadget

From: Johannes Schindelin <[email protected]>

We are about to adjust t0060 for the new default branch name main. This name is two characters shorter and therefore needs two spaces more padding to align correctly.

Adjusting the alignment before the big search-and-replace makes it easier to verify that the final result does not leave any misaligned lines behind.

---
 t/t0060-path-utils.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
t/t0060-path-utils.sh +2 -2
index b2e3cf3f4c..928eebbdc0 100755
@@ -312,8 +312,8 @@ test_git_path GIT_COMMON_DIR=bar info/sparse-checkout     .git/info/sparse-check
 test_git_path GIT_COMMON_DIR=bar info//sparse-checkout    .git/info//sparse-checkout
 test_git_path GIT_COMMON_DIR=bar remotes/bar              bar/remotes/bar
 test_git_path GIT_COMMON_DIR=bar branches/bar             bar/branches/bar
-test_git_path GIT_COMMON_DIR=bar logs/refs/heads/master   bar/logs/refs/heads/master
-test_git_path GIT_COMMON_DIR=bar refs/heads/master        bar/refs/heads/master
+test_git_path GIT_COMMON_DIR=bar logs/refs/heads/master     bar/logs/refs/heads/master
+test_git_path GIT_COMMON_DIR=bar refs/heads/master          bar/refs/heads/master
 test_git_path GIT_COMMON_DIR=bar refs/bisect/foo          .git/refs/bisect/foo
 test_git_path GIT_COMMON_DIR=bar hooks/me                 bar/hooks/me
 test_git_path GIT_COMMON_DIR=bar config                   bar/config
Signature · 1 line
gitgitgadget
#9 lore raw

PATCH 9/28 t5323: prepare centered comment for `master` -> `main`

In reply to Johannes Schindelin via GitGitGadget

From: Johannes Schindelin <[email protected]>

We are about to search-and-replace all mentions of master in t5323 by main, which is two characters shorter. To prepare for that, let's add padding to centered lines that will make them briefly uncentered, but will be re-centered in the commit that performs that rename.

Doing it this way (instead of padding after replacing) makes it easier to verify the validity of the patch that replaces master by main.

---
 t/t5323-pack-redundant.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
t/t5323-pack-redundant.sh +3 -3
index 6b4d1ca353..3903148926 100755
@@ -312,7 +312,7 @@ test_expect_success 'shared: all packs are redundant, but no output without --al
 #############################################################################
 # Chart of packs and objects for this test case
 #
-#     ================ master.git ===============
+#     ================= master.git ================
 #         | T A B C D E F G H I J K L M N O P Q R  <----------+
 #     ----+--------------------------------------             |
 #     P1  | x x x x x x x                       x             |
@@ -394,7 +394,7 @@ test_expect_success 'shared: no redundant without --alt-odb' '
 #############################################################################
 # Chart of packs and objects for this test case
 #
-#     ================ master.git ===============
+#     ================= master.git ================
 #         | T A B C D E F G H I J K L M N O P Q R  <----------------+
 #     ----+--------------------------------------                   |
 #     P1  | x x x x x x x                       x                   |
@@ -426,7 +426,7 @@ test_expect_success 'shared: one pack is redundant with --alt-odb' '
 #############################################################################
 # Chart of packs and objects for this test case
 #
-#     ================ master.git ===============
+#     ================= master.git ================
 #         | T A B C D E F G H I J K L M N O P Q R  <----------------+
 #     ----+--------------------------------------                   |
 #     P1  | x x x x x x x                       x                   |
Signature · 1 line
gitgitgadget
#13 lore raw

PATCH 13/28 t551*: adjust the references to the default branch name "main"

In reply to Johannes Schindelin via GitGitGadget

From: Johannes Schindelin <[email protected]>

This trick was performed via

	$ (cd t &&
	   sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
		-e 's/Master/Main/g' -- t551*.sh)

This allows us to define GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main for those tests.

---
 t/t5510-fetch.sh             | 158 +++++------
 t/t5511-refspec.sh           |  12 +-
 t/t5512-ls-remote.sh         |  26 +-
 t/t5514-fetch-multiple.sh    |  30 +--
 t/t5516-fetch-push.sh        | 500 +++++++++++++++++------------------
 t/t5517-push-mirror.sh       | 124 ++++-----
 t/t5518-fetch-exit-status.sh |   6 +-
 t/t5519-push-alternates.sh   |  12 +-
 t/test-lib.sh                |   2 +-
 9 files changed, 435 insertions(+), 435 deletions(-)
t/t5510-fetch.sh +79 -79
index 5d673358f9..206e3be695 100755
@@ -37,19 +37,19 @@ test_expect_success "clone and setup child repos" '
 	git clone . two &&
 	(
 		cd two &&
-		git config branch.master.remote one &&
+		git config branch.main.remote one &&
 		git config remote.one.url ../one/.git/ &&
-		git config remote.one.fetch refs/heads/master:refs/heads/one
+		git config remote.one.fetch refs/heads/main:refs/heads/one
 	) &&
 	git clone . three &&
 	(
 		cd three &&
-		git config branch.master.remote two &&
-		git config branch.master.merge refs/heads/one &&
+		git config branch.main.remote two &&
+		git config branch.main.merge refs/heads/one &&
 		mkdir -p .git/remotes &&
 		{
 			echo "URL: ../two/.git/"
-			echo "Pull: refs/heads/master:refs/heads/two"
+			echo "Pull: refs/heads/main:refs/heads/two"
 			echo "Pull: refs/heads/one:refs/heads/one"
 		} >.git/remotes/two
 	) &&
@@ -65,7 +65,7 @@ test_expect_success "fetch test" '
 	git fetch &&
 	git rev-parse --verify refs/heads/one &&
 	mine=$(git rev-parse refs/heads/one) &&
-	his=$(cd ../one && git rev-parse refs/heads/master) &&
+	his=$(cd ../one && git rev-parse refs/heads/main) &&
 	test "z$mine" = "z$his"
 '
 
@@ -75,11 +75,11 @@ test_expect_success "fetch test for-merge" '
 	git fetch &&
 	git rev-parse --verify refs/heads/two &&
 	git rev-parse --verify refs/heads/one &&
-	master_in_two=$(cd ../two && git rev-parse master) &&
+	main_in_two=$(cd ../two && git rev-parse main) &&
 	one_in_two=$(cd ../two && git rev-parse one) &&
 	{
 		echo "$one_in_two	"
-		echo "$master_in_two	not-for-merge"
+		echo "$main_in_two	not-for-merge"
 	} >expected &&
 	cut -f -2 .git/FETCH_HEAD >actual &&
 	test_cmp expected actual'
@@ -88,7 +88,7 @@ test_expect_success 'fetch --prune on its own works as expected' '
 	cd "$D" &&
 	git clone . prune &&
 	cd prune &&
-	git update-ref refs/remotes/origin/extrabranch master &&
+	git update-ref refs/remotes/origin/extrabranch main &&
 
 	git fetch --prune origin &&
 	test_must_fail git rev-parse origin/extrabranch
@@ -98,9 +98,9 @@ test_expect_success 'fetch --prune with a branch name keeps branches' '
 	cd "$D" &&
 	git clone . prune-branch &&
 	cd prune-branch &&
-	git update-ref refs/remotes/origin/extrabranch master &&
+	git update-ref refs/remotes/origin/extrabranch main &&
 
-	git fetch --prune origin master &&
+	git fetch --prune origin main &&
 	git rev-parse origin/extrabranch
 '
 
@@ -110,18 +110,18 @@ test_expect_success 'fetch --prune with a namespace keeps other namespaces' '
 	cd prune-namespace &&
 
 	git fetch --prune origin refs/heads/a/*:refs/remotes/origin/a/* &&
-	git rev-parse origin/master
+	git rev-parse origin/main
 '
 
 test_expect_success 'fetch --prune handles overlapping refspecs' '
 	cd "$D" &&
-	git update-ref refs/pull/42/head master &&
+	git update-ref refs/pull/42/head main &&
 	git clone . prune-overlapping &&
 	cd prune-overlapping &&
 	git config --add remote.origin.fetch refs/pull/*/head:refs/remotes/origin/pr/* &&
 
 	git fetch --prune origin &&
-	git rev-parse origin/master &&
+	git rev-parse origin/main &&
 	git rev-parse origin/pr/42 &&
 
 	git config --unset-all remote.origin.fetch &&
@@ -129,7 +129,7 @@ test_expect_success 'fetch --prune handles overlapping refspecs' '
 	git config --add remote.origin.fetch refs/heads/*:refs/remotes/origin/* &&
 
 	git fetch --prune origin &&
-	git rev-parse origin/master &&
+	git rev-parse origin/main &&
 	git rev-parse origin/pr/42
 '
 
@@ -137,13 +137,13 @@ test_expect_success 'fetch --prune --tags prunes branches but not tags' '
 	cd "$D" &&
 	git clone . prune-tags &&
 	cd prune-tags &&
-	git tag sometag master &&
+	git tag sometag main &&
 	# Create what looks like a remote-tracking branch from an earlier
 	# fetch that has since been deleted from the remote:
-	git update-ref refs/remotes/origin/fake-remote master &&
+	git update-ref refs/remotes/origin/fake-remote main &&
 
 	git fetch --prune --tags origin &&
-	git rev-parse origin/master &&
+	git rev-parse origin/main &&
 	test_must_fail git rev-parse origin/fake-remote &&
 	git rev-parse sometag
 '
@@ -152,10 +152,10 @@ test_expect_success 'fetch --prune --tags with branch does not prune other thing
 	cd "$D" &&
 	git clone . prune-tags-branch &&
 	cd prune-tags-branch &&
-	git tag sometag master &&
-	git update-ref refs/remotes/origin/extrabranch master &&
+	git tag sometag main &&
+	git update-ref refs/remotes/origin/extrabranch main &&
 
-	git fetch --prune --tags origin master &&
+	git fetch --prune --tags origin main &&
 	git rev-parse origin/extrabranch &&
 	git rev-parse sometag
 '
@@ -164,9 +164,9 @@ test_expect_success 'fetch --prune --tags with refspec prunes based on refspec'
 	cd "$D" &&
 	git clone . prune-tags-refspec &&
 	cd prune-tags-refspec &&
-	git tag sometag master &&
-	git update-ref refs/remotes/origin/foo/otherbranch master &&
-	git update-ref refs/remotes/origin/extrabranch master &&
+	git tag sometag main &&
+	git update-ref refs/remotes/origin/foo/otherbranch main &&
+	git update-ref refs/remotes/origin/extrabranch main &&
 
 	git fetch --prune --tags origin refs/heads/foo/*:refs/remotes/origin/foo/* &&
 	test_must_fail git rev-parse refs/remotes/origin/foo/otherbranch &&
@@ -177,20 +177,20 @@ test_expect_success 'fetch --prune --tags with refspec prunes based on refspec'
 test_expect_success '--refmap="" ignores configured refspec' '
 	cd "$TRASH_DIRECTORY" &&
 	git clone "$D" remote-refs &&
-	git -C remote-refs rev-parse remotes/origin/master >old &&
-	git -C remote-refs update-ref refs/remotes/origin/master master~1 &&
-	git -C remote-refs rev-parse remotes/origin/master >new &&
+	git -C remote-refs rev-parse remotes/origin/main >old &&
+	git -C remote-refs update-ref refs/remotes/origin/main main~1 &&
+	git -C remote-refs rev-parse remotes/origin/main >new &&
 	git -C remote-refs fetch --refmap= origin "+refs/heads/*:refs/hidden/origin/*" &&
-	git -C remote-refs rev-parse remotes/origin/master >actual &&
+	git -C remote-refs rev-parse remotes/origin/main >actual &&
 	test_cmp new actual &&
 	git -C remote-refs fetch origin &&
-	git -C remote-refs rev-parse remotes/origin/master >actual &&
+	git -C remote-refs rev-parse remotes/origin/main >actual &&
 	test_cmp old actual
 '
 
 test_expect_success '--refmap="" and --prune' '
-	git -C remote-refs update-ref refs/remotes/origin/foo/otherbranch master &&
-	git -C remote-refs update-ref refs/hidden/foo/otherbranch master &&
+	git -C remote-refs update-ref refs/remotes/origin/foo/otherbranch main &&
+	git -C remote-refs update-ref refs/hidden/foo/otherbranch main &&
 	git -C remote-refs fetch --prune --refmap="" origin +refs/heads/*:refs/hidden/* &&
 	git -C remote-refs rev-parse remotes/origin/foo/otherbranch &&
 	test_must_fail git -C remote-refs rev-parse refs/hidden/foo/otherbranch &&
@@ -250,7 +250,7 @@ test_expect_success 'fetch uses remote ref names to describe new refs' '
 		test_i18ngrep "new tag.* -> descriptive-tag$" actual &&
 		test_i18ngrep "new ref.* -> crazy$" actual
 	) &&
-	git checkout master
+	git checkout main
 '
 
 test_expect_success 'fetch must not resolve short tag name' '
@@ -281,7 +281,7 @@ test_expect_success 'create bundle 1' '
 	cd "$D" &&
 	echo >file updated again by origin &&
 	git commit -a -m "tip" &&
-	git bundle create --version=3 bundle1 master^..master
+	git bundle create --version=3 bundle1 main^..main
 '
 
 test_expect_success 'header of bundle looks right' '
@@ -289,7 +289,7 @@ test_expect_success 'header of bundle looks right' '
 	# v3 git bundle
 	@object-format=$(test_oid algo)
 	-OID updated by origin
-	OID refs/heads/master
+	OID refs/heads/main
 
 	EOF
 	sed -e "s/$OID_REGEX/OID/g" -e "5q" "$D"/bundle1 >actual &&
@@ -298,13 +298,13 @@ test_expect_success 'header of bundle looks right' '
 
 test_expect_success 'create bundle 2' '
 	cd "$D" &&
-	git bundle create bundle2 master~2..master
+	git bundle create bundle2 main~2..main
 '
 
 test_expect_success 'unbundle 1' '
 	cd "$D/bundle" &&
 	git checkout -b some-branch &&
-	test_must_fail git fetch "$D/bundle1" master:master
+	test_must_fail git fetch "$D/bundle1" main:main
 '
 
 
@@ -317,8 +317,8 @@ test_expect_success 'bundle 1 has only 3 files ' '
 
 test_expect_success 'unbundle 2' '
 	cd "$D/bundle" &&
-	git fetch ../bundle2 master:master &&
-	test "tip" = "$(git log -1 --pretty=oneline master | cut -d" " -f2)"
+	git fetch ../bundle2 main:main &&
+	test "tip" = "$(git log -1 --pretty=oneline main | cut -d" " -f2)"
 '
 
 test_expect_success 'bundle does not prerequisite objects' '
@@ -335,14 +335,14 @@ test_expect_success 'bundle does not prerequisite objects' '
 test_expect_success 'bundle should be able to create a full history' '
 
 	cd "$D" &&
-	git tag -a -m "1.0" v1.0 master &&
+	git tag -a -m "1.0" v1.0 main &&
 	git bundle create bundle4 v1.0
 
 '
 
 test_expect_success 'fetch with a non-applying branch.<name>.merge' '
-	git config branch.master.remote yeti &&
-	git config branch.master.merge refs/heads/bigfoot &&
+	git config branch.main.remote yeti &&
+	git config branch.main.merge refs/heads/bigfoot &&
 	git config remote.blub.url one &&
 	git config remote.blub.fetch "refs/heads/*:refs/remotes/one/*" &&
 	git fetch blub
@@ -362,8 +362,8 @@ test_expect_success 'fetch from GIT URL with a non-applying branch.<name>.merge
 # the merge spec matches the branch the remote HEAD points to
 test_expect_success 'fetch from GIT URL with a non-applying branch.<name>.merge [2]' '
 	one_ref=$(cd one && git symbolic-ref HEAD) &&
-	git config branch.master.remote blub &&
-	git config branch.master.merge "$one_ref" &&
+	git config branch.main.remote blub &&
+	git config branch.main.merge "$one_ref" &&
 	git update-ref -d FETCH_HEAD &&
 	git fetch one &&
 	test $one_head = "$(git rev-parse --verify FETCH_HEAD)" &&
@@ -373,7 +373,7 @@ test_expect_success 'fetch from GIT URL with a non-applying branch.<name>.merge
 # URL supplied to fetch matches the url of the configured branch's remote, but
 # the merge spec does not match the branch the remote HEAD points to
 test_expect_success 'fetch from GIT URL with a non-applying branch.<name>.merge [3]' '
-	git config branch.master.merge "${one_ref}_not" &&
+	git config branch.main.merge "${one_ref}_not" &&
 	git update-ref -d FETCH_HEAD &&
 	git fetch one &&
 	test $one_head = "$(git rev-parse --verify FETCH_HEAD)" &&
@@ -389,9 +389,9 @@ test_expect_success 'quoting of a strangely named repo' '
 test_expect_success 'bundle should record HEAD correctly' '
 
 	cd "$D" &&
-	git bundle create bundle5 HEAD master &&
+	git bundle create bundle5 HEAD main &&
 	git bundle list-heads bundle5 >actual &&
-	for h in HEAD refs/heads/master
+	for h in HEAD refs/heads/main
 	do
 		echo "$(git rev-parse --verify $h) $h"
 	done >expect &&
@@ -399,10 +399,10 @@ test_expect_success 'bundle should record HEAD correctly' '
 
 '
 
-test_expect_success 'mark initial state of origin/master' '
+test_expect_success 'mark initial state of origin/main' '
 	(
 		cd three &&
-		git tag base-origin-master refs/remotes/origin/master
+		git tag base-origin-main refs/remotes/origin/main
 	)
 '
 
@@ -412,10 +412,10 @@ test_expect_success 'explicit fetch should update tracking' '
 	git branch -f side &&
 	(
 		cd three &&
-		git update-ref refs/remotes/origin/master base-origin-master &&
-		o=$(git rev-parse --verify refs/remotes/origin/master) &&
-		git fetch origin master &&
-		n=$(git rev-parse --verify refs/remotes/origin/master) &&
+		git update-ref refs/remotes/origin/main base-origin-main &&
+		o=$(git rev-parse --verify refs/remotes/origin/main) &&
+		git fetch origin main &&
+		n=$(git rev-parse --verify refs/remotes/origin/main) &&
 		test "$o" != "$n" &&
 		test_must_fail git rev-parse --verify refs/remotes/origin/side
 	)
@@ -427,10 +427,10 @@ test_expect_success 'explicit pull should update tracking' '
 	git branch -f side &&
 	(
 		cd three &&
-		git update-ref refs/remotes/origin/master base-origin-master &&
-		o=$(git rev-parse --verify refs/remotes/origin/master) &&
-		git pull origin master &&
-		n=$(git rev-parse --verify refs/remotes/origin/master) &&
+		git update-ref refs/remotes/origin/main base-origin-main &&
+		o=$(git rev-parse --verify refs/remotes/origin/main) &&
+		git pull origin main &&
+		n=$(git rev-parse --verify refs/remotes/origin/main) &&
 		test "$o" != "$n" &&
 		test_must_fail git rev-parse --verify refs/remotes/origin/side
 	)
@@ -449,13 +449,13 @@ test_expect_success 'explicit --refmap option overrides remote.*.fetch' '
 	git branch -f side &&
 	(
 		cd three &&
-		git update-ref refs/remotes/origin/master base-origin-master &&
-		o=$(git rev-parse --verify refs/remotes/origin/master) &&
-		git fetch --refmap="refs/heads/*:refs/remotes/other/*" origin master &&
-		n=$(git rev-parse --verify refs/remotes/origin/master) &&
+		git update-ref refs/remotes/origin/main base-origin-main &&
+		o=$(git rev-parse --verify refs/remotes/origin/main) &&
+		git fetch --refmap="refs/heads/*:refs/remotes/other/*" origin main &&
+		n=$(git rev-parse --verify refs/remotes/origin/main) &&
 		test "$o" = "$n" &&
 		test_must_fail git rev-parse --verify refs/remotes/origin/side &&
-		git rev-parse --verify refs/remotes/other/master
+		git rev-parse --verify refs/remotes/other/main
 	)
 '
 
@@ -464,10 +464,10 @@ test_expect_success 'explicitly empty --refmap option disables remote.*.fetch' '
 	git branch -f side &&
 	(
 		cd three &&
-		git update-ref refs/remotes/origin/master base-origin-master &&
-		o=$(git rev-parse --verify refs/remotes/origin/master) &&
-		git fetch --refmap="" origin master &&
-		n=$(git rev-parse --verify refs/remotes/origin/master) &&
+		git update-ref refs/remotes/origin/main base-origin-main &&
+		o=$(git rev-parse --verify refs/remotes/origin/main) &&
+		git fetch --refmap="" origin main &&
+		n=$(git rev-parse --verify refs/remotes/origin/main) &&
 		test "$o" = "$n" &&
 		test_must_fail git rev-parse --verify refs/remotes/origin/side
 	)
@@ -479,10 +479,10 @@ test_expect_success 'configured fetch updates tracking' '
 	git branch -f side &&
 	(
 		cd three &&
-		git update-ref refs/remotes/origin/master base-origin-master &&
-		o=$(git rev-parse --verify refs/remotes/origin/master) &&
+		git update-ref refs/remotes/origin/main base-origin-main &&
+		o=$(git rev-parse --verify refs/remotes/origin/main) &&
 		git fetch origin &&
-		n=$(git rev-parse --verify refs/remotes/origin/master) &&
+		n=$(git rev-parse --verify refs/remotes/origin/main) &&
 		test "$o" != "$n" &&
 		git rev-parse --verify refs/remotes/origin/side
 	)
@@ -493,12 +493,12 @@ test_expect_success 'non-matching refspecs do not confuse tracking update' '
 	git update-ref refs/odd/location HEAD &&
 	(
 		cd three &&
-		git update-ref refs/remotes/origin/master base-origin-master &&
+		git update-ref refs/remotes/origin/main base-origin-main &&
 		git config --add remote.origin.fetch \
 			refs/odd/location:refs/remotes/origin/odd &&
-		o=$(git rev-parse --verify refs/remotes/origin/master) &&
-		git fetch origin master &&
-		n=$(git rev-parse --verify refs/remotes/origin/master) &&
+		o=$(git rev-parse --verify refs/remotes/origin/main) &&
+		git fetch origin main &&
+		n=$(git rev-parse --verify refs/remotes/origin/main) &&
 		test "$o" != "$n" &&
 		test_must_fail git rev-parse --verify refs/remotes/origin/odd
 	)
@@ -524,7 +524,7 @@ test_expect_success 'auto tag following fetches minimum' '
 			git tag -a -m $i excess-$i || exit 1
 		done
 	) &&
-	git checkout master &&
+	git checkout main &&
 	(
 		cd follow &&
 		git fetch
@@ -533,13 +533,13 @@ test_expect_success 'auto tag following fetches minimum' '
 
 test_expect_success 'refuse to fetch into the current branch' '
 
-	test_must_fail git fetch . side:master
+	test_must_fail git fetch . side:main
 
 '
 
 test_expect_success 'fetch into the current branch with --update-head-ok' '
 
-	git fetch --update-head-ok . side:master
+	git fetch --update-head-ok . side:main
 
 '
 
@@ -568,7 +568,7 @@ test_expect_success "should be able to fetch with duplicate refspecs" '
 	(
 		cd dups &&
 		git init &&
-		git config branch.master.remote three &&
+		git config branch.main.remote three &&
 		git config remote.three.url ../three/.git &&
 		git config remote.three.fetch +refs/heads/*:refs/remotes/origin/* &&
 		git config --add remote.three.fetch +refs/heads/*:refs/remotes/origin/* &&
@@ -877,11 +877,11 @@ test_expect_success 'all boundary commits are excluded' '
 	test_commit oneside &&
 	git checkout HEAD^ &&
 	test_commit otherside &&
-	git checkout master &&
+	git checkout main &&
 	test_tick &&
 	git merge otherside &&
 	ad=$(git log --no-walk --format=%ad HEAD) &&
-	git bundle create twoside-boundary.bdl master --since="$ad" &&
+	git bundle create twoside-boundary.bdl main --since="$ad" &&
 	convert_bundle_to_pack <twoside-boundary.bdl >twoside-boundary.pack &&
 	pack=$(git index-pack --fix-thin --stdin <twoside-boundary.pack) &&
 	test_bundle_object_count .git/objects/pack/pack-${pack##pack	}.pack 3
@@ -1017,7 +1017,7 @@ setup_negotiation_tip () {
 	fi &&
 
 	test_commit -C "$SERVER" beta_s &&
-	git -C "$SERVER" checkout master &&
+	git -C "$SERVER" checkout main &&
 	test_commit -C "$SERVER" alpha_s &&
 	git -C "$SERVER" tag -d alpha_1 alpha_2 beta_1 beta_2
 }
t/t5511-refspec.sh +6 -6
index f541f30bc2..847a9d4c27 100755
@@ -33,7 +33,7 @@ test_refspec fetch '::'						invalid
 test_refspec push 'refs/heads/*:refs/remotes/frotz/*'
 test_refspec push 'refs/heads/*:refs/remotes/frotz'		invalid
 test_refspec push 'refs/heads:refs/remotes/frotz/*'		invalid
-test_refspec push 'refs/heads/master:refs/remotes/frotz/xyzzy'
+test_refspec push 'refs/heads/main:refs/remotes/frotz/xyzzy'
 
 
 # These have invalid LHS, but we do not have a formal "valid sha-1
@@ -41,18 +41,18 @@ test_refspec push 'refs/heads/master:refs/remotes/frotz/xyzzy'
 # code.  They will be caught downstream anyway, but we may want to
 # have tighter check later...
 
-: test_refspec push 'refs/heads/master::refs/remotes/frotz/xyzzy'	invalid
+: test_refspec push 'refs/heads/main::refs/remotes/frotz/xyzzy'	invalid
 : test_refspec push 'refs/heads/maste :refs/remotes/frotz/xyzzy'	invalid
 
 test_refspec fetch 'refs/heads/*:refs/remotes/frotz/*'
 test_refspec fetch 'refs/heads/*:refs/remotes/frotz'		invalid
 test_refspec fetch 'refs/heads:refs/remotes/frotz/*'		invalid
-test_refspec fetch 'refs/heads/master:refs/remotes/frotz/xyzzy'
-test_refspec fetch 'refs/heads/master::refs/remotes/frotz/xyzzy'	invalid
+test_refspec fetch 'refs/heads/main:refs/remotes/frotz/xyzzy'
+test_refspec fetch 'refs/heads/main::refs/remotes/frotz/xyzzy'	invalid
 test_refspec fetch 'refs/heads/maste :refs/remotes/frotz/xyzzy'	invalid
 
-test_refspec push 'master~1:refs/remotes/frotz/backup'
-test_refspec fetch 'master~1:refs/remotes/frotz/backup'		invalid
+test_refspec push 'main~1:refs/remotes/frotz/backup'
+test_refspec fetch 'main~1:refs/remotes/frotz/backup'		invalid
 test_refspec push 'HEAD~4:refs/remotes/frotz/new'
 test_refspec fetch 'HEAD~4:refs/remotes/frotz/new'		invalid
 
t/t5512-ls-remote.sh +13 -13
index e98c3a0174..fb122fb7b8 100755
@@ -118,7 +118,7 @@ test_expect_success 'use branch.<name>.remote if possible' '
 	echo "From $URL" >exp_err &&
 
 	git remote add other $URL &&
-	git config branch.master.remote other &&
+	git config branch.main.remote other &&
 
 	git ls-remote 2>actual_err >actual &&
 	test_cmp exp_err actual_err &&
@@ -129,9 +129,9 @@ test_expect_success 'confuses pattern as remote when no remote specified' '
 	if test_have_prereq MINGW
 	then
 		# Windows does not like asterisks in pathname
-		does_not_exist=master
+		does_not_exist=main
 	else
-		does_not_exist="refs*master"
+		does_not_exist="refs*main"
 	fi &&
 	cat >exp <<-EOF &&
 	fatal: '\''$does_not_exist'\'' does not appear to be a git repository
@@ -144,7 +144,7 @@ test_expect_success 'confuses pattern as remote when no remote specified' '
 	# Do not expect "git ls-remote <pattern>" to work; ls-remote needs
 	# <remote> if you want to feed <pattern>, just like you cannot say
 	# fetch <branch>.
-	# We could just as easily have used "master"; the "*" emphasizes its
+	# We could just as easily have used "main"; the "*" emphasizes its
 	# role as a pattern.
 	test_must_fail git ls-remote "$does_not_exist" >actual 2>&1 &&
 	test_i18ncmp exp actual
@@ -217,14 +217,14 @@ test_expect_success 'protocol v2 supports hiderefs' '
 
 test_expect_success 'ls-remote --symref' '
 	git fetch origin &&
-	echo "ref: refs/heads/master	HEAD" >expect &&
+	echo "ref: refs/heads/main	HEAD" >expect &&
 	generate_references \
 		HEAD \
-		refs/heads/master >>expect &&
+		refs/heads/main >>expect &&
 	oid=$(git rev-parse HEAD) &&
 	echo "$oid	refs/remotes/origin/HEAD" >>expect &&
 	generate_references \
-		refs/remotes/origin/master \
+		refs/remotes/origin/main \
 		refs/tags/mark \
 		refs/tags/mark1.1 \
 		refs/tags/mark1.10 \
@@ -238,7 +238,7 @@ test_expect_success 'ls-remote --symref' '
 test_expect_success 'ls-remote with filtered symref (refname)' '
 	rev=$(git rev-parse HEAD) &&
 	cat >expect <<-EOF &&
-	ref: refs/heads/master	HEAD
+	ref: refs/heads/main	HEAD
 	$rev	HEAD
 	EOF
 	# Protocol v2 supports sending symrefs for refs other than HEAD, so use
@@ -252,7 +252,7 @@ test_expect_failure 'ls-remote with filtered symref (--heads)' '
 	cat >expect <<-EOF &&
 	ref: refs/tags/mark	refs/heads/foo
 	$rev	refs/heads/foo
-	$rev	refs/heads/master
+	$rev	refs/heads/main
 	EOF
 	# Protocol v2 supports sending symrefs for refs other than HEAD, so use
 	# protocol v0 here.
@@ -263,7 +263,7 @@ test_expect_failure 'ls-remote with filtered symref (--heads)' '
 test_expect_success 'ls-remote --symref omits filtered-out matches' '
 	cat >expect <<-EOF &&
 	$rev	refs/heads/foo
-	$rev	refs/heads/master
+	$rev	refs/heads/main
 	EOF
 	# Protocol v2 supports sending symrefs for refs other than HEAD, so use
 	# protocol v0 here.
@@ -330,10 +330,10 @@ test_expect_success 'ls-remote --sort fails gracefully outside repository' '
 
 test_expect_success 'ls-remote patterns work with all protocol versions' '
 	git for-each-ref --format="%(objectname)	%(refname)" \
-		refs/heads/master refs/remotes/origin/master >expect &&
-	git -c protocol.version=1 ls-remote . master >actual.v1 &&
+		refs/heads/main refs/remotes/origin/main >expect &&
+	git -c protocol.version=1 ls-remote . main >actual.v1 &&
 	test_cmp expect actual.v1 &&
-	git -c protocol.version=2 ls-remote . master >actual.v2 &&
+	git -c protocol.version=2 ls-remote . main >actual.v2 &&
 	test_cmp expect actual.v2
 '
 
t/t5514-fetch-multiple.sh +15 -15
index bd202ec6f3..1b0560f901 100755
@@ -17,7 +17,7 @@ setup_repository () {
 	git add elif &&
 	test_tick &&
 	git commit -m "Second" &&
-	git checkout master
+	git checkout main
 	)
 }
 
@@ -32,16 +32,16 @@ test_expect_success setup '
 '
 
 cat > test/expect << EOF
-  one/master
+  one/main
   one/side
-  origin/HEAD -> origin/master
-  origin/master
+  origin/HEAD -> origin/main
+  origin/main
   origin/side
   three/another
-  three/master
+  three/main
   three/side
   two/another
-  two/master
+  two/main
   two/side
 EOF
 
@@ -70,15 +70,15 @@ test_expect_success 'git fetch --all should continue if a remote has errors' '
 test_expect_success 'git fetch --all does not allow non-option arguments' '
 	(cd test &&
 	 test_must_fail git fetch --all origin &&
-	 test_must_fail git fetch --all origin master)
+	 test_must_fail git fetch --all origin main)
 '
 
 cat > expect << EOF
-  origin/HEAD -> origin/master
-  origin/master
+  origin/HEAD -> origin/main
+  origin/main
   origin/side
   three/another
-  three/master
+  three/main
   three/side
 EOF
 
@@ -92,10 +92,10 @@ test_expect_success 'git fetch --multiple (but only one remote)' '
 '
 
 cat > expect << EOF
-  one/master
+  one/main
   one/side
   two/another
-  two/master
+  two/main
   two/side
 EOF
 
@@ -133,13 +133,13 @@ test_expect_success 'git fetch --all (skipFetchAll)' '
 '
 
 cat > expect << EOF
-  one/master
+  one/main
   one/side
   three/another
-  three/master
+  three/main
   three/side
   two/another
-  two/master
+  two/main
   two/side
 EOF
 
t/t5516-fetch-push.sh +250 -250

1,290 lines not on this page · raw message

t/t5517-push-mirror.sh +62 -62

265 lines not on this page · raw message

t/t5518-fetch-exit-status.sh +3 -3
index c2060bb870..78ba5c290a 100755
@@ -17,20 +17,20 @@ test_expect_success setup '
 	echo side >file &&
 	git commit -a -m side &&
 
-	git checkout master &&
+	git checkout main &&
 	echo next >file &&
 	git commit -a -m next
 '
 
 test_expect_success 'non-fast-forward fetch' '
 
-	test_must_fail git fetch . master:side
+	test_must_fail git fetch . main:side
 
 '
 
 test_expect_success 'forced update' '
 
-	git fetch . +master:side
+	git fetch . +main:side
 
 '
 
t/t5519-push-alternates.sh +6 -6
index 11fcd37700..1696eb5125 100755
@@ -17,7 +17,7 @@ test_expect_success setup '
 		>file &&
 		git add . &&
 		git commit -m initial &&
-		git push ../alice-pub master
+		git push ../alice-pub main
 	) &&
 
 	# Project Bob is a fork of project Alice
@@ -31,7 +31,7 @@ test_expect_success setup '
 	git clone alice-pub bob-work &&
 	(
 		cd bob-work &&
-		git push ../bob-pub master
+		git push ../bob-pub main
 	)
 '
 
@@ -54,7 +54,7 @@ test_expect_success 'bob fetches from alice, works and pushes' '
 		# has at her public repository are available to it
 		# via its alternates.
 		cd bob-work &&
-		git pull ../alice-pub master &&
+		git pull ../alice-pub main &&
 		echo more bob >file &&
 		git commit -a -m third &&
 		git push ../bob-pub :
@@ -93,7 +93,7 @@ test_expect_success 'alice works and pushes again' '
 test_expect_success 'bob works and pushes' '
 	(
 		# This time Bob does not pull from Alice, and
-		# the master branch at her public repository points
+		# the main branch at her public repository points
 		# at a commit Bob does not know about.  This should
 		# not prevent the push by Bob from succeeding.
 		cd bob-work &&
@@ -122,11 +122,11 @@ test_expect_success 'alice works and pushes yet again' '
 test_expect_success 'bob works and pushes again' '
 	(
 		cd alice-pub &&
-		git cat-file commit master >../bob-work/commit
+		git cat-file commit main >../bob-work/commit
 	) &&
 	(
 		# This time Bob does not pull from Alice, and
-		# the master branch at her public repository points
+		# the main branch at her public repository points
 		# at a commit Bob does not fully know about, but
 		# he happens to have the commit object (but not the
 		# necessary tree) in his repository from Alice.
t/test-lib.sh +1 -1
index ca86f666e6..a12a1993d0 100644
@@ -263,7 +263,7 @@ case "$TEST_NUMBER" in
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
-[0-4]*|5[0-4]*|550*)
+[0-4]*|5[0-4]*|55[01]*)
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
Signature · 1 line
gitgitgadget
#18 lore raw

PATCH 15/28 t55[4-9]*: adjust the references to the default branch name "main"

In reply to Johannes Schindelin via GitGitGadget

From: Johannes Schindelin <[email protected]>

This trick was performed via

	$ (cd t &&
	   sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
		-e 's/Master/Main/g' -e 's/retsam/niam/g' \
		-- t55[4-9]*.sh t556x*)

This allows us to define GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main for those tests.

Note that t5541 uses the reversed master name: retsam. We replace it by the equivalent for main: niam.

---
 t/t5540-http-push-webdav.sh          |  8 +--
 t/t5541-http-push-smart.sh           | 40 +++++++-------
 t/t5542-push-http-shallow.sh         |  8 +--
 t/t5543-atomic-push.sh               | 80 +++++++++++++--------------
 t/t5545-push-options.sh              | 62 ++++++++++-----------
 t/t5548-push-porcelain.sh            | 64 +++++++++++-----------
 t/t5550-http-fetch-dumb.sh           | 20 +++----
 t/t5551-http-fetch-smart.sh          | 20 +++----
 t/t5552-skipping-fetch-negotiator.sh |  2 +-
 t/t5553-set-upstream.sh              | 82 ++++++++++++++--------------
 t/t5561-http-backend.sh              |  4 +-
 t/t556x_common                       |  8 +--
 t/t5570-git-daemon.sh                | 16 +++---
 t/t5571-pre-push-hook.sh             |  4 +-
 t/t5572-pull-submodule.sh            |  4 +-
 t/t5580-unc-paths.sh                 |  2 +-
 t/t5581-http-curl-verbose.sh         |  2 +-
 t/t5582-fetch-negative-refspec.sh    | 22 ++++----
 t/test-lib.sh                        |  2 +-
 19 files changed, 225 insertions(+), 225 deletions(-)
t/t5540-http-push-webdav.sh +4 -4
index 450321fddb..1973d8bb32 100755
@@ -71,7 +71,7 @@ test_expect_success 'push already up-to-date' '
 test_expect_success 'push to remote repository with unpacked refs' '
 	(cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&
 	 rm packed-refs &&
-	 git update-ref refs/heads/master $ORIG_HEAD &&
+	 git update-ref refs/heads/main $ORIG_HEAD &&
 	 git --bare update-server-info) &&
 	git push &&
 	(cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&
@@ -91,7 +91,7 @@ test_expect_success 'http-push fetches unpacked objects' '
 	 git remote rm origin &&
 	 git reflog expire --expire=0 --all &&
 	 git prune &&
-	 git push -f -v $HTTPD_URL/dumb/test_repo_unpacked.git master)
+	 git push -f -v $HTTPD_URL/dumb/test_repo_unpacked.git main)
 '
 
 test_expect_success 'http-push fetches packed objects' '
@@ -111,7 +111,7 @@ test_expect_success 'http-push fetches packed objects' '
 	 git remote remove origin &&
 	 git reflog expire --expire=0 --all &&
 	 git prune &&
-	 git push -f -v $HTTPD_URL/dumb/test_repo_packed.git master)
+	 git push -f -v $HTTPD_URL/dumb/test_repo_packed.git main)
 '
 
 test_expect_success 'create and delete remote branch' '
@@ -163,7 +163,7 @@ test_expect_success 'PUT and MOVE sends object to URLs with SHA-1 hash suffix' '
 '
 
 test_http_push_nonff "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git \
-	"$ROOT_PATH"/test_repo_clone master
+	"$ROOT_PATH"/test_repo_clone main
 
 test_expect_success 'push to password-protected repository (user in URL)' '
 	test_commit pw-user &&
t/t5541-http-push-smart.sh +20 -20
index 187454f5dd..ae90ed230b 100755
@@ -142,23 +142,23 @@ test_expect_success 'used receive-pack service' '
 '
 
 test_http_push_nonff "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git \
-	"$ROOT_PATH"/test_repo_clone master 		success
+	"$ROOT_PATH"/test_repo_clone main 		success
 
 test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper' '
 	# create a dissimilarly-named remote ref so that git is unable to match the
 	# two refs (viz. local, remote) unless an explicit refspec is provided.
-	git push origin master:retsam &&
+	git push origin main:niam &&
 
 	echo "change changed" > path2 &&
 	git commit -a -m path2 --amend &&
 
-	# push master too; this ensures there is at least one '"'push'"' command to
+	# push main too; this ensures there is at least one '"'push'"' command to
 	# the remote helper and triggers interaction with the helper.
-	test_must_fail git push -v origin +master master:retsam >output 2>&1'
+	test_must_fail git push -v origin +main main:niam >output 2>&1'
 
 test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper: remote output' '
-	grep "^ + [a-f0-9]*\.\.\.[a-f0-9]* *master -> master (forced update)$" output &&
-	grep "^ ! \[rejected\] *master -> retsam (non-fast-forward)$" output
+	grep "^ + [a-f0-9]*\.\.\.[a-f0-9]* *main -> main (forced update)$" output &&
+	grep "^ ! \[rejected\] *main -> niam (non-fast-forward)$" output
 '
 
 test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper: our output' '
@@ -167,7 +167,7 @@ test_expect_success 'push fails for non-fast-forward refs unmatched by remote he
 '
 
 test_expect_success 'push (chunked)' '
-	git checkout master &&
+	git checkout main &&
 	test_commit commit path3 &&
 	HEAD=$(git rev-parse --verify HEAD) &&
 	test_config http.postbuffer 4 &&
@@ -177,9 +177,9 @@ test_expect_success 'push (chunked)' '
 	 test $HEAD = $(git rev-parse --verify HEAD))
 '
 
-## References of remote: atomic1(1)            master(2) collateral(2) other(2)
-## References of local :            atomic2(2) master(1) collateral(3) other(2) collateral1(3) atomic(1)
-## Atomic push         :                       master(1) collateral(3)                         atomic(1)
+## References of remote: atomic1(1)            main(2) collateral(2) other(2)
+## References of local :            atomic2(2) main(1) collateral(3) other(2) collateral1(3) atomic(1)
+## Atomic push         :                       main(1) collateral(3)                         atomic(1)
 test_expect_success 'push --atomic also prevents branch creation, reports collateral' '
 	# Setup upstream repo - empty for now
 	d=$HTTPD_DOCUMENT_ROOT_PATH/atomic-branches.git &&
@@ -192,15 +192,15 @@ test_expect_success 'push --atomic also prevents branch creation, reports collat
 	test_commit atomic2 &&
 	git branch collateral &&
 	git branch other &&
-	git push "$up" atomic1 master collateral other &&
+	git push "$up" atomic1 main collateral other &&
 	git tag -d atomic1 &&
 
 	# collateral is a valid push, but should be failed by atomic push
 	git checkout collateral &&
 	test_commit collateral1 &&
 
-	# Make master incompatible with upstream to provoke atomic
-	git checkout master &&
+	# Make main incompatible with upstream to provoke atomic
+	git checkout main &&
 	git reset --hard HEAD^ &&
 
 	# Add a new branch which should be failed by atomic push. This is a
@@ -208,7 +208,7 @@ test_expect_success 'push --atomic also prevents branch creation, reports collat
 	git branch atomic &&
 
 	# --atomic should cause entire push to be rejected
-	test_must_fail git push --atomic "$up" master atomic collateral 2>output &&
+	test_must_fail git push --atomic "$up" main atomic collateral 2>output &&
 
 	# the new branch should not have been created upstream
 	test_must_fail git -C "$d" show-ref --verify refs/heads/atomic &&
@@ -216,15 +216,15 @@ test_expect_success 'push --atomic also prevents branch creation, reports collat
 	# upstream should still reflect atomic2, the last thing we pushed
 	# successfully
 	git rev-parse atomic2 >expected &&
-	# on master...
-	git -C "$d" rev-parse refs/heads/master >actual &&
+	# on main...
+	git -C "$d" rev-parse refs/heads/main >actual &&
 	test_cmp expected actual &&
 	# ...and collateral.
 	git -C "$d" rev-parse refs/heads/collateral >actual &&
 	test_cmp expected actual &&
 
 	# the failed refs should be indicated to the user
-	grep "^ ! .*rejected.* master -> master" output &&
+	grep "^ ! .*rejected.* main -> main" output &&
 
 	# the collateral failure refs should be indicated to the user
 	grep "^ ! .*rejected.* atomic -> atomic .*atomic push failed" output &&
@@ -472,9 +472,9 @@ test_expect_success 'clone/fetch scrubs password from reflogs' '
 	test_commit prepare-for-force-fetch &&
 	git switch -c away &&
 	git fetch "$HTTPD_URL_USER_PASS/smart/test_repo.git" \
-		+master:master &&
+		+main:main &&
 	# should have been scrubbed down to vanilla URL
-	git log -g master >reflog &&
+	git log -g main >reflog &&
 	grep "$HTTPD_URL" reflog &&
 	! grep "$HTTPD_URL_USER_PASS" reflog
 '
@@ -498,7 +498,7 @@ test_expect_success 'colorize errors/hints' '
 	cd "$ROOT_PATH"/test_repo_clone &&
 	test_must_fail git -c color.transport=always -c color.advice=always \
 		-c color.push=always \
-		push origin origin/master^:master 2>act &&
+		push origin origin/main^:main 2>act &&
 	test_decode_color <act >decoded &&
 	test_i18ngrep "<RED>.*rejected.*<RESET>" decoded &&
 	test_i18ngrep "<RED>error: failed to push some refs" decoded &&
t/t5542-push-http-shallow.sh +4 -4
index ddc1db722d..0d8f5219da 100755
@@ -51,12 +51,12 @@ test_expect_success 'push to shallow repo via http' '
 	(
 	cd full &&
 	commit 9 &&
-	git push $HTTPD_URL/smart/repo.git +master:refs/remotes/top/master
+	git push $HTTPD_URL/smart/repo.git +main:refs/remotes/top/main
 	) &&
 	(
 	cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
 	git fsck &&
-	git log --format=%s top/master >actual &&
+	git log --format=%s top/main >actual &&
 	cat <<EOF >expect &&
 9
 4
@@ -74,11 +74,11 @@ test_expect_success 'push from shallow repo via http' '
 	git config http.receivepack true
 	) &&
 	commit 10 &&
-	git push $HTTPD_URL/smart/repo.git +master:refs/remotes/top/master &&
+	git push $HTTPD_URL/smart/repo.git +main:refs/remotes/top/main &&
 	(
 	cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
 	git fsck &&
-	git log --format=%s top/master >actual &&
+	git log --format=%s top/main >actual &&
 	cat <<EOF >expect &&
 10
 4
t/t5543-atomic-push.sh +40 -40

223 lines not on this page · raw message

t/t5545-push-options.sh +31 -31

159 lines not on this page · raw message

t/t5548-push-porcelain.sh +32 -32

174 lines not on this page · raw message

t/t5550-http-fetch-dumb.sh +10 -10
index 483578b2d7..6fdcd0c036 100755
@@ -26,7 +26,7 @@ test_expect_success 'create http-accessible bare repository with loose objects'
 	 hooks/post-update
 	) &&
 	git remote add public "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
-	git push public master:master
+	git push public main:main
 '
 
 test_expect_success 'clone http repository' '
@@ -37,8 +37,8 @@ test_expect_success 'clone http repository' '
 
 test_expect_success 'list refs from outside any repository' '
 	cat >expect <<-EOF &&
-	$(git rev-parse master)	HEAD
-	$(git rev-parse master)	refs/heads/master
+	$(git rev-parse main)	HEAD
+	$(git rev-parse main)	refs/heads/main
 	EOF
 	nongit git ls-remote "$HTTPD_URL/dumb/repo.git" >actual &&
 	test_cmp expect actual
@@ -181,8 +181,8 @@ test_expect_success 'fetch changes via manual http-fetch' '
 
 	HEAD=$(git rev-parse --verify HEAD) &&
 	(cd clone2 &&
-	 git http-fetch -a -w heads/master-new $HEAD $(git config remote.origin.url) &&
-	 git checkout master-new &&
+	 git http-fetch -a -w heads/main-new $HEAD $(git config remote.origin.url) &&
+	 git checkout main-new &&
 	 test $HEAD = $(git rev-parse --verify HEAD)) &&
 	test_cmp file clone2/file
 '
@@ -192,19 +192,19 @@ test_expect_success 'manual http-fetch without -a works just as well' '
 
 	HEAD=$(git rev-parse --verify HEAD) &&
 	(cd clone3 &&
-	 git http-fetch -w heads/master-new $HEAD $(git config remote.origin.url) &&
-	 git checkout master-new &&
+	 git http-fetch -w heads/main-new $HEAD $(git config remote.origin.url) &&
+	 git checkout main-new &&
 	 test $HEAD = $(git rev-parse --verify HEAD)) &&
 	test_cmp file clone3/file
 '
 
 test_expect_success 'http remote detects correct HEAD' '
-	git push public master:other &&
+	git push public main:other &&
 	(cd clone &&
 	 git remote set-head origin -d &&
 	 git remote set-head origin -a &&
 	 git symbolic-ref refs/remotes/origin/HEAD > output &&
-	 echo refs/remotes/origin/master > expect &&
+	 echo refs/remotes/origin/main > expect &&
 	 test_cmp expect output
 	)
 '
@@ -416,7 +416,7 @@ test_expect_success 'set up evil alternates scheme' '
 	evil=$HTTPD_DOCUMENT_ROOT_PATH/evil.git &&
 	git init --bare "$evil" &&
 	# do this by hand to avoid object existence check
-	printf "%s\\t%s\\n" $sha1 refs/heads/master >"$evil/info/refs"
+	printf "%s\\t%s\\n" $sha1 refs/heads/main >"$evil/info/refs"
 '
 
 # Here we'll just redirect via HTTP. In a real-world attack these would be on
t/t5551-http-fetch-smart.sh +10 -10
index e40e9ed52f..2215bbcce7 100755
@@ -18,7 +18,7 @@ test_expect_success 'create http-accessible bare repository' '
 	 git --bare init
 	) &&
 	git remote add public "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
-	git push public master:master
+	git push public main:main
 '
 
 setup_askpass_helper
@@ -238,9 +238,9 @@ test_expect_success 'invalid Content-Type rejected' '
 
 test_expect_success 'create namespaced refs' '
 	test_commit namespaced &&
-	git push public HEAD:refs/namespaces/ns/refs/heads/master &&
+	git push public HEAD:refs/namespaces/ns/refs/heads/main &&
 	git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \
-		symbolic-ref refs/namespaces/ns/HEAD refs/namespaces/ns/refs/heads/master
+		symbolic-ref refs/namespaces/ns/HEAD refs/namespaces/ns/refs/heads/main
 '
 
 test_expect_success 'smart clone respects namespace' '
@@ -271,7 +271,7 @@ test_expect_success 'cookies stored in http.cookiefile when http.savecookies set
 	EOF
 	git config http.cookiefile cookies.txt &&
 	git config http.savecookies true &&
-	git ls-remote $HTTPD_URL/smart_cookies/repo.git master &&
+	git ls-remote $HTTPD_URL/smart_cookies/repo.git main &&
 
 	# NEEDSWORK: If the overspecification of the expected result is reduced, we
 	# might be able to run this test in all protocol versions.
@@ -344,12 +344,12 @@ test_expect_success 'large fetch-pack requests can be sent using chunked encodin
 test_expect_success 'test allowreachablesha1inwant' '
 	test_when_finished "rm -rf test_reachable.git" &&
 	server="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
-	master_sha=$(git -C "$server" rev-parse refs/heads/master) &&
+	main_sha=$(git -C "$server" rev-parse refs/heads/main) &&
 	git -C "$server" config uploadpack.allowreachablesha1inwant 1 &&
 
 	git init --bare test_reachable.git &&
 	git -C test_reachable.git remote add origin "$HTTPD_URL/smart/repo.git" &&
-	git -C test_reachable.git fetch origin "$master_sha"
+	git -C test_reachable.git fetch origin "$main_sha"
 '
 
 test_expect_success 'test allowreachablesha1inwant with unreachable' '
@@ -363,7 +363,7 @@ test_expect_success 'test allowreachablesha1inwant with unreachable' '
 	git push public :refs/heads/doomed &&
 
 	server="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
-	master_sha=$(git -C "$server" rev-parse refs/heads/master) &&
+	main_sha=$(git -C "$server" rev-parse refs/heads/main) &&
 	git -C "$server" config uploadpack.allowreachablesha1inwant 1 &&
 
 	git init --bare test_reachable.git &&
@@ -385,7 +385,7 @@ test_expect_success 'test allowanysha1inwant with unreachable' '
 	git push public :refs/heads/doomed &&
 
 	server="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
-	master_sha=$(git -C "$server" rev-parse refs/heads/master) &&
+	main_sha=$(git -C "$server" rev-parse refs/heads/main) &&
 	git -C "$server" config uploadpack.allowreachablesha1inwant 1 &&
 
 	git init --bare test_reachable.git &&
@@ -444,8 +444,8 @@ test_expect_success 'using fetch command in remote-curl updates refs' '
 	test_commit -C "$SERVER" bar &&
 	git -C client -c protocol.version=0 fetch &&
 
-	git -C "$SERVER" rev-parse master >expect &&
-	git -C client rev-parse origin/master >actual &&
+	git -C "$SERVER" rev-parse main >expect &&
+	git -C client rev-parse origin/main >actual &&
 	test_cmp expect actual
 '
 
t/t5552-skipping-fetch-negotiator.sh +1 -1
index 156c704040..7b9fb4ff02 100755
@@ -100,7 +100,7 @@ test_expect_success 'use ref advertisement to filter out commits' '
 	git -C server checkout --orphan anotherbranch &&
 	test_commit -C server to_fetch &&
 
-	# The server advertising "c3" (as "refs/heads/master") means that we do
+	# The server advertising "c3" (as "refs/heads/main") means that we do
 	# not need to send any ancestors of "c3", but we still need to send "c3"
 	# itself.
 	test_config -C client fetch.negotiationalgorithm skipping &&
t/t5553-set-upstream.sh +41 -41

172 lines not on this page · raw message

t/t5561-http-backend.sh +2 -2
index 6eb0294978..c8a9f7f9bb 100755
@@ -39,9 +39,9 @@ POST() {
 
 grep '^[^#]' >exp <<EOF
 
-###  refs/heads/master
+###  refs/heads/main
 ###
-GET  /smart/repo.git/refs/heads/master HTTP/1.1 404 -
+GET  /smart/repo.git/refs/heads/main HTTP/1.1 404 -
 
 ###  getanyfile default
 ###
t/t556x_common +4 -4
index 359fcfe32b..670fb89477 100755
@@ -22,7 +22,7 @@ test_expect_success 'setup repository' '
 	 : >objects/info/http-alternates
 	) &&
 	git remote add public "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
-	git push public master:master &&
+	git push public main:main &&
 
 	(cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
 	 git repack -a -d
@@ -31,7 +31,7 @@ test_expect_success 'setup repository' '
 	echo other >file &&
 	git add file &&
 	git commit -m two &&
-	git push public master:master &&
+	git push public main:main &&
 
 	LOOSE_URL=$(find_file objects/??) &&
 	PACK_URL=$(find_file objects/pack/*.pack) &&
@@ -51,8 +51,8 @@ get_static_files() {
 
 SMART=smart
 GIT_HTTP_EXPORT_ALL=1 && export GIT_HTTP_EXPORT_ALL
-test_expect_success 'direct refs/heads/master not found' '
-	GET refs/heads/master "404 Not Found"
+test_expect_success 'direct refs/heads/main not found' '
+	GET refs/heads/main "404 Not Found"
 '
 test_expect_success 'static file is ok' '
 	get_static_files "200 OK"
t/t5570-git-daemon.sh +8 -8
index 8f69a7854f..864d5c985c 100755
@@ -26,7 +26,7 @@ test_expect_success 'create git-accessible bare repository' '
 	 : >git-daemon-export-ok
 	) &&
 	git remote add public "$GIT_DAEMON_DOCUMENT_ROOT_PATH/repo.git" &&
-	git push public master:master
+	git push public main:main
 '
 
 test_expect_success 'clone git repository' '
@@ -55,12 +55,12 @@ test_expect_success 'no-op fetch without "-v" is quiet' '
 '
 
 test_expect_success 'remote detects correct HEAD' '
-	git push public master:other &&
+	git push public main:other &&
 	(cd clone &&
 	 git remote set-head -d origin &&
 	 git remote set-head -a origin &&
 	 git symbolic-ref refs/remotes/origin/HEAD > output &&
-	 echo refs/remotes/origin/master > expect &&
+	 echo refs/remotes/origin/main > expect &&
 	 test_cmp expect output
 	)
 '
@@ -148,7 +148,7 @@ test_remote_error()
 
 msg="access denied or repository not exported"
 test_expect_success 'clone non-existent' "test_remote_error    '$msg' clone nowhere.git"
-test_expect_success 'push disabled'      "test_remote_error    '$msg' push  repo.git master"
+test_expect_success 'push disabled'      "test_remote_error    '$msg' push  repo.git main"
 test_expect_success 'read access denied' "test_remote_error -x '$msg' fetch repo.git"
 test_expect_success 'not exported'       "test_remote_error -n '$msg' fetch repo.git"
 
@@ -156,7 +156,7 @@ stop_git_daemon
 start_git_daemon --informative-errors
 
 test_expect_success 'clone non-existent' "test_remote_error    'no such repository'      clone nowhere.git"
-test_expect_success 'push disabled'      "test_remote_error    'service not enabled'     push  repo.git master"
+test_expect_success 'push disabled'      "test_remote_error    'service not enabled'     push  repo.git main"
 test_expect_success 'read access denied' "test_remote_error -x 'no such repository'      fetch repo.git"
 test_expect_success 'not exported'       "test_remote_error -n 'repository not exported' fetch repo.git"
 
@@ -192,10 +192,10 @@ test_expect_success FAKENC 'hostname interpolation works after LF-stripping' '
 	fake_nc "$GIT_DAEMON_HOST_PORT" <input >output &&
 	depacketize <output >output.raw &&
 
-	# just pick out the value of master, which avoids any protocol
+	# just pick out the value of main, which avoids any protocol
 	# particulars
-	perl -lne "print \$1 if m{^(\\S+) refs/heads/master}" <output.raw >actual &&
-	git -C "$repo" rev-parse master >expect &&
+	perl -lne "print \$1 if m{^(\\S+) refs/heads/main}" <output.raw >actual &&
+	git -C "$repo" rev-parse main >expect &&
 	test_cmp expect actual
 '
 
t/t5571-pre-push-hook.sh +2 -2
index ac53d63869..891f03cd59 100755
@@ -48,11 +48,11 @@ EOF
 cat >expected <<EOF
 parent1
 repo1
-refs/heads/master $COMMIT2 refs/heads/foreign $COMMIT1
+refs/heads/main $COMMIT2 refs/heads/foreign $COMMIT1
 EOF
 
 test_expect_success 'push with hook' '
-	git push parent1 master:foreign &&
+	git push parent1 main:foreign &&
 	diff expected actual
 '
 
t/t5572-pull-submodule.sh +2 -2
index 1d75e3b12b..d6a75964d8 100755
@@ -148,8 +148,8 @@ test_expect_success 'branch has no merge base with remote-tracking counterpart'
 
 	git clone parent child &&
 
-	# Reset master so that it has no merge base with
-	# refs/remotes/origin/master.
+	# Reset main so that it has no merge base with
+	# refs/remotes/origin/main.
 	OTHER=$(git -C child commit-tree -m bar \
 		$(git -C child rev-parse HEAD^{tree})) &&
 	git -C child reset --hard "$OTHER" &&
t/t5580-unc-paths.sh +1 -1
index cf768b3a27..511c1ba51d 100755
@@ -53,7 +53,7 @@ test_expect_success fetch '
 	git init to-fetch &&
 	(
 		cd to-fetch &&
-		git fetch "$UNCPATH" master
+		git fetch "$UNCPATH" main
 	)
 '
 
t/t5581-http-curl-verbose.sh +1 -1
index 927aad0820..0c6e3b7665 100755
@@ -13,7 +13,7 @@ test_expect_success 'setup repository' '
 	git add file &&
 	git commit -m one &&
 	git remote add public "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
-	git push public master:master
+	git push public main:main
 '
 
 test_expect_success 'failure in git-upload-pack is shown' '
t/t5582-fetch-negative-refspec.sh +11 -11
index 8c61e28fec..9c2b19cae2 100755
@@ -22,12 +22,12 @@ test_expect_success "clone and setup child repos" '
 		git switch -c alternate &&
 		echo >file updated again by one &&
 		git commit -a -m "updated by one again" &&
-		git switch master
+		git switch main
 	) &&
 	git clone . two &&
 	(
 		cd two &&
-		git config branch.master.remote one &&
+		git config branch.main.remote one &&
 		git config remote.one.url ../one/.git/ &&
 		git config remote.one.fetch +refs/heads/*:refs/remotes/one/* &&
 		git config --add remote.one.fetch ^refs/heads/alternate
@@ -43,9 +43,9 @@ test_expect_success "fetch one" '
 		test_must_fail git rev-parse --verify refs/remotes/one/alternate &&
 		git fetch one &&
 		test_must_fail git rev-parse --verify refs/remotes/one/alternate &&
-		git rev-parse --verify refs/remotes/one/master &&
-		mine=$(git rev-parse refs/remotes/one/master) &&
-		his=$(cd ../one && git rev-parse refs/heads/master) &&
+		git rev-parse --verify refs/remotes/one/main &&
+		mine=$(git rev-parse refs/remotes/one/main) &&
+		his=$(cd ../one && git rev-parse refs/heads/main) &&
 		test "z$mine" = "z$his"
 	)
 '
@@ -57,7 +57,7 @@ test_expect_success "fetch with negative refspec on commandline" '
 		cd three &&
 		alternate_in_one=$(cd ../one && git rev-parse refs/heads/alternate) &&
 		echo $alternate_in_one >expect &&
-		git fetch ../one/.git refs/heads/*:refs/remotes/one/* ^refs/heads/master &&
+		git fetch ../one/.git refs/heads/*:refs/remotes/one/* ^refs/heads/main &&
 		cut -f -1 .git/FETCH_HEAD >actual &&
 		test_cmp expect actual
 	)
@@ -68,8 +68,8 @@ test_expect_success "fetch with negative sha1 refspec fails" '
 	git commit -a -m "updated by origin yet again" &&
 	(
 		cd three &&
-		master_in_one=$(cd ../one && git rev-parse refs/heads/master) &&
-		test_must_fail git fetch ../one/.git refs/heads/*:refs/remotes/one/* ^$master_in_one
+		main_in_one=$(cd ../one && git rev-parse refs/heads/main) &&
+		test_must_fail git fetch ../one/.git refs/heads/*:refs/remotes/one/* ^$main_in_one
 	)
 '
 
@@ -92,10 +92,10 @@ test_expect_success "fetch with negative pattern refspec does not expand prefix"
 	(
 		cd three &&
 		alternate_in_one=$(cd ../one && git rev-parse refs/heads/alternate) &&
-		master_in_one=$(cd ../one && git rev-parse refs/heads/master) &&
+		main_in_one=$(cd ../one && git rev-parse refs/heads/main) &&
 		echo $alternate_in_one >expect &&
-		echo $master_in_one >>expect &&
-		git fetch ../one/.git refs/heads/*:refs/remotes/one/* ^master &&
+		echo $main_in_one >>expect &&
+		git fetch ../one/.git refs/heads/*:refs/remotes/one/* ^main &&
 		cut -f -1 .git/FETCH_HEAD >actual &&
 		test_cmp expect actual
 	)
t/test-lib.sh +1 -1
index ecaa0f36f3..f919021063 100644
@@ -263,7 +263,7 @@ case "$TEST_NUMBER" in
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
-[0-4]*|5[0-4]*|55[0-3]*)
+[0-4]*|5[0-5]*)
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
Signature · 1 line
gitgitgadget
#7 lore raw

PATCH 7/28 t3[5-9]*: adjust the references to the default branch name "main"

In reply to Johannes Schindelin via GitGitGadget

From: Johannes Schindelin <[email protected]>

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[5-9]*.sh)

This allows us to define GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main for those tests.

---
 t/t3500-cherry.sh                   | 12 ++++-----
 t/t3501-revert-cherry-pick.sh       |  4 +--
 t/t3502-cherry-pick-merge.sh        |  2 +-
 t/t3503-cherry-pick-root.sh         | 10 ++++----
 t/t3504-cherry-pick-rerere.sh       | 24 ++++++++---------
 t/t3505-cherry-pick-empty.sh        | 24 ++++++++---------
 t/t3506-cherry-pick-ff.sh           |  8 +++---
 t/t3507-cherry-pick-conflict.sh     |  2 +-
 t/t3508-cherry-pick-many-commits.sh | 38 +++++++++++++--------------
 t/t3509-cherry-pick-merge-df.sh     |  2 +-
 t/t3512-cherry-pick-submodule.sh    |  2 +-
 t/t3600-rm.sh                       | 10 ++++----
 t/t3701-add-interactive.sh          |  4 +--
 t/t3901-i18n-patch.sh               | 40 ++++++++++++++---------------
 t/t3903-stash.sh                    | 32 +++++++++++------------
 t/t3910-mac-os-precompose.sh        |  6 ++---
 t/test-lib.sh                       |  2 +-
 17 files changed, 111 insertions(+), 111 deletions(-)
t/t3500-cherry.sh +6 -6
index 2b8d9cb38e..2528e773a6 100755
@@ -5,7 +5,7 @@
 
 test_description='git cherry should detect patches integrated upstream
 
-This test cherry-picks one local change of two into master branch, and
+This test cherry-picks one local change of two into main branch, and
 checks that git cherry only returns the second patch in the local branch
 '
 . ./test-lib.sh
@@ -32,7 +32,7 @@ test_expect_success \
      test_tick &&
      git commit -m "Add C." &&
 
-     git checkout -f master &&
+     git checkout -f main &&
      rm -f B C &&
 
      echo Third >> A &&
@@ -40,19 +40,19 @@ test_expect_success \
      test_tick &&
      git commit -m "Modify A." &&
 
-     expr "$(echo $(git cherry master my-topic-branch) )" : "+ [^ ]* + .*"
+     expr "$(echo $(git cherry main my-topic-branch) )" : "+ [^ ]* + .*"
 '
 
 test_expect_success \
     'check that cherry with limit returns only the top patch'\
-    'expr "$(echo $(git cherry master my-topic-branch my-topic-branch^1) )" : "+ [^ ]*"
+    'expr "$(echo $(git cherry main my-topic-branch my-topic-branch^1) )" : "+ [^ ]*"
 '
 
 test_expect_success \
     'cherry-pick one of the 2 patches, and check cherry recognized one and only one as new' \
     'git cherry-pick my-topic-branch^0 &&
-     echo $(git cherry master my-topic-branch) &&
-     expr "$(echo $(git cherry master my-topic-branch) )" : "+ [^ ]* - .*"
+     echo $(git cherry main my-topic-branch) &&
+     expr "$(echo $(git cherry main my-topic-branch) )" : "+ [^ ]* - .*"
 '
 
 test_expect_success 'cherry ignores whitespace' '
t/t3501-revert-cherry-pick.sh +2 -2
index 3669dfb1be..0adfdb4b6c 100755
@@ -112,7 +112,7 @@ test_expect_success 'cherry-pick on unborn branch' '
 test_expect_success 'cherry-pick "-" to pick from previous branch' '
 	git checkout unborn &&
 	test_commit to-pick actual content &&
-	git checkout master &&
+	git checkout main &&
 	git cherry-pick - &&
 	echo content >expect &&
 	test_cmp expect actual
@@ -132,7 +132,7 @@ test_expect_success 'cherry-pick "-" is meaningless without checkout' '
 test_expect_success 'cherry-pick "-" works with arguments' '
 	git checkout -b side-branch &&
 	test_commit change actual change &&
-	git checkout master &&
+	git checkout main &&
 	git cherry-pick -s - &&
 	echo "Signed-off-by: C O Mitter <[email protected]>" >expect &&
 	git cat-file commit HEAD | grep ^Signed-off-by: >signoff &&
t/t3502-cherry-pick-merge.sh +1 -1
index 8b635a196d..4d6ff14eb6 100755
@@ -25,7 +25,7 @@ test_expect_success setup '
 	echo new line >B &&
 	git commit -m "add line to B" B &&
 	git tag b &&
-	git checkout master &&
+	git checkout main &&
 	git merge side &&
 	git tag c
 
t/t3503-cherry-pick-root.sh +5 -5
index e27f39d1e5..59496a56b7 100755
@@ -30,7 +30,7 @@ test_expect_success setup '
 test_expect_success 'cherry-pick a root commit' '
 
 	git checkout second^0 &&
-	git cherry-pick master &&
+	git cherry-pick main &&
 	echo first >expect &&
 	test_cmp expect file1
 
@@ -38,14 +38,14 @@ test_expect_success 'cherry-pick a root commit' '
 
 test_expect_success 'revert a root commit' '
 
-	git revert master &&
+	git revert main &&
 	test_path_is_missing file1
 
 '
 
 test_expect_success 'cherry-pick a root commit with an external strategy' '
 
-	git cherry-pick --strategy=resolve master &&
+	git cherry-pick --strategy=resolve main &&
 	echo first >expect &&
 	test_cmp expect file1
 
@@ -53,7 +53,7 @@ test_expect_success 'cherry-pick a root commit with an external strategy' '
 
 test_expect_success 'revert a root commit with an external strategy' '
 
-	git revert --strategy=resolve master &&
+	git revert --strategy=resolve main &&
 	test_path_is_missing file1
 
 '
@@ -65,7 +65,7 @@ test_expect_success 'cherry-pick two root commits' '
 	echo third >expect.file3 &&
 
 	git checkout second^0 &&
-	git cherry-pick master third &&
+	git cherry-pick main third &&
 
 	test_cmp expect.file1 file1 &&
 	test_cmp expect.file2 file2 &&
t/t3504-cherry-pick-rerere.sh +12 -12
index 80a0d08706..3804527e2e 100755
@@ -6,8 +6,8 @@ test_description='cherry-pick should rerere for conflicts'
 
 test_expect_success setup '
 	test_commit foo &&
-	test_commit foo-master foo &&
-	test_commit bar-master bar &&
+	test_commit foo-main foo &&
+	test_commit bar-main bar &&
 
 	git checkout -b dev foo &&
 	test_commit foo-dev foo &&
@@ -16,7 +16,7 @@ test_expect_success setup '
 '
 
 test_expect_success 'conflicting merge' '
-	test_must_fail git merge master
+	test_must_fail git merge main
 '
 
 test_expect_success 'fixup' '
@@ -29,7 +29,7 @@ test_expect_success 'fixup' '
 '
 
 test_expect_success 'cherry-pick conflict with --rerere-autoupdate' '
-	test_must_fail git cherry-pick --rerere-autoupdate foo..bar-master &&
+	test_must_fail git cherry-pick --rerere-autoupdate foo..bar-main &&
 	test_cmp foo-expect foo &&
 	git diff-files --quiet &&
 	test_must_fail git cherry-pick --continue &&
@@ -41,7 +41,7 @@ test_expect_success 'cherry-pick conflict with --rerere-autoupdate' '
 
 test_expect_success 'cherry-pick conflict repsects rerere.autoUpdate' '
 	test_config rerere.autoUpdate true &&
-	test_must_fail git cherry-pick foo..bar-master &&
+	test_must_fail git cherry-pick foo..bar-main &&
 	test_cmp foo-expect foo &&
 	git diff-files --quiet &&
 	test_must_fail git cherry-pick --continue &&
@@ -53,7 +53,7 @@ test_expect_success 'cherry-pick conflict repsects rerere.autoUpdate' '
 
 test_expect_success 'cherry-pick conflict with --no-rerere-autoupdate' '
 	test_config rerere.autoUpdate true &&
-	test_must_fail git cherry-pick --no-rerere-autoupdate foo..bar-master &&
+	test_must_fail git cherry-pick --no-rerere-autoupdate foo..bar-main &&
 	test_cmp foo-expect foo &&
 	test_must_fail git diff-files --quiet &&
 	git add foo &&
@@ -66,7 +66,7 @@ test_expect_success 'cherry-pick conflict with --no-rerere-autoupdate' '
 '
 
 test_expect_success 'cherry-pick --continue rejects --rerere-autoupdate' '
-	test_must_fail git cherry-pick --rerere-autoupdate foo..bar-master &&
+	test_must_fail git cherry-pick --rerere-autoupdate foo..bar-main &&
 	test_cmp foo-expect foo &&
 	git diff-files --quiet &&
 	test_must_fail git cherry-pick --continue --rerere-autoupdate >actual 2>&1 &&
@@ -79,25 +79,25 @@ test_expect_success 'cherry-pick --continue rejects --rerere-autoupdate' '
 '
 
 test_expect_success 'cherry-pick --rerere-autoupdate more than once' '
-	test_must_fail git cherry-pick --rerere-autoupdate --rerere-autoupdate foo..bar-master &&
+	test_must_fail git cherry-pick --rerere-autoupdate --rerere-autoupdate foo..bar-main &&
 	test_cmp foo-expect foo &&
 	git diff-files --quiet &&
 	git cherry-pick --abort &&
-	test_must_fail git cherry-pick --rerere-autoupdate --no-rerere-autoupdate --rerere-autoupdate foo..bar-master &&
+	test_must_fail git cherry-pick --rerere-autoupdate --no-rerere-autoupdate --rerere-autoupdate foo..bar-main &&
 	test_cmp foo-expect foo &&
 	git diff-files --quiet &&
 	git cherry-pick --abort &&
-	test_must_fail git cherry-pick --rerere-autoupdate --no-rerere-autoupdate foo..bar-master &&
+	test_must_fail git cherry-pick --rerere-autoupdate --no-rerere-autoupdate foo..bar-main &&
 	test_must_fail git diff-files --quiet &&
 	git cherry-pick --abort
 '
 
 test_expect_success 'cherry-pick conflict without rerere' '
 	test_config rerere.enabled false &&
-	test_must_fail git cherry-pick foo-master &&
+	test_must_fail git cherry-pick foo-main &&
 	grep ===== foo &&
 	grep foo-dev foo &&
-	grep foo-master foo
+	grep foo-main foo
 '
 
 test_done
t/t3505-cherry-pick-empty.sh +12 -12
index 5f911bb529..07419a4e4a 100755
@@ -17,7 +17,7 @@ test_expect_success setup '
 	test_tick &&
 	git commit --allow-empty-message -m "" &&
 
-	git checkout master &&
+	git checkout main &&
 	git checkout -b empty-change-branch &&
 	test_tick &&
 	git commit --allow-empty -m "empty"
@@ -25,7 +25,7 @@ test_expect_success setup '
 '
 
 test_expect_success 'cherry-pick an empty commit' '
-	git checkout master &&
+	git checkout main &&
 	test_expect_code 1 git cherry-pick empty-change-branch
 '
 
@@ -35,7 +35,7 @@ test_expect_success 'index lockfile was removed' '
 
 test_expect_success 'cherry-pick a commit with an empty message' '
 	test_when_finished "git reset --hard empty-message-branch~1" &&
-	git checkout master &&
+	git checkout main &&
 	git cherry-pick empty-message-branch
 '
 
@@ -44,12 +44,12 @@ test_expect_success 'index lockfile was removed' '
 '
 
 test_expect_success 'cherry-pick a commit with an empty message with --allow-empty-message' '
-	git checkout -f master &&
+	git checkout -f main &&
 	git cherry-pick --allow-empty-message empty-message-branch
 '
 
 test_expect_success 'cherry pick an empty non-ff commit without --allow-empty' '
-	git checkout master &&
+	git checkout main &&
 	echo fourth >>file2 &&
 	git add file2 &&
 	git commit -m "fourth" &&
@@ -57,22 +57,22 @@ test_expect_success 'cherry pick an empty non-ff commit without --allow-empty' '
 '
 
 test_expect_success 'cherry pick an empty non-ff commit with --allow-empty' '
-	git checkout master &&
+	git checkout main &&
 	git cherry-pick --allow-empty empty-change-branch
 '
 
 test_expect_success 'cherry pick with --keep-redundant-commits' '
-	git checkout master &&
+	git checkout main &&
 	git cherry-pick --keep-redundant-commits HEAD^
 '
 
 test_expect_success 'cherry-pick a commit that becomes no-op (prep)' '
-	git checkout master &&
+	git checkout main &&
 	git branch fork &&
 	echo foo >file2 &&
 	git add file2 &&
 	test_tick &&
-	git commit -m "add file2 on master" &&
+	git commit -m "add file2 on main" &&
 
 	git checkout fork &&
 	echo foo >file2 &&
@@ -84,15 +84,15 @@ test_expect_success 'cherry-pick a commit that becomes no-op (prep)' '
 test_expect_success 'cherry-pick a no-op without --keep-redundant' '
 	git reset --hard &&
 	git checkout fork^0 &&
-	test_must_fail git cherry-pick master
+	test_must_fail git cherry-pick main
 '
 
 test_expect_success 'cherry-pick a no-op with --keep-redundant' '
 	git reset --hard &&
 	git checkout fork^0 &&
-	git cherry-pick --keep-redundant-commits master &&
+	git cherry-pick --keep-redundant-commits main &&
 	git show -s --format=%s >actual &&
-	echo "add file2 on master" >expect &&
+	echo "add file2 on main" >expect &&
 	test_cmp expect actual
 '
 
t/t3506-cherry-pick-ff.sh +4 -4
index 9d5adbc130..08b461dfcf 100755
@@ -24,7 +24,7 @@ test_expect_success setup '
 '
 
 test_expect_success 'cherry-pick using --ff fast forwards' '
-	git checkout master &&
+	git checkout main &&
 	git reset --hard first &&
 	test_tick &&
 	git cherry-pick --ff second &&
@@ -32,7 +32,7 @@ test_expect_success 'cherry-pick using --ff fast forwards' '
 '
 
 test_expect_success 'cherry-pick not using --ff does not fast forwards' '
-	git checkout master &&
+	git checkout main &&
 	git reset --hard first &&
 	test_tick &&
 	git cherry-pick second &&
@@ -49,7 +49,7 @@ test_expect_success 'cherry-pick not using --ff does not fast forwards' '
 # (This has been taken from t3502-cherry-pick-merge.sh)
 #
 test_expect_success 'merge setup' '
-	git checkout master &&
+	git checkout main &&
 	git reset --hard first &&
 	echo new line >A &&
 	git add A &&
@@ -62,7 +62,7 @@ test_expect_success 'merge setup' '
 	test_tick &&
 	git commit -m "add line to B" B &&
 	git tag B &&
-	git checkout master &&
+	git checkout main &&
 	git merge side &&
 	git tag C &&
 	git checkout -b new A
t/t3507-cherry-pick-conflict.sh +1 -1
index a21adcf0e4..e0f77ba6ad 100755
@@ -29,7 +29,7 @@ test_expect_success setup '
 	test_commit redundant-pick foo c redundant &&
 	git commit --allow-empty --allow-empty-message &&
 	git tag empty &&
-	git checkout master &&
+	git checkout main &&
 	git config advice.detachedhead false
 
 '
t/t3508-cherry-pick-many-commits.sh +19 -19
index 23070a7b73..bdb995235f 100755
@@ -31,7 +31,7 @@ test_expect_success setup '
 '
 
 test_expect_success 'cherry-pick first..fourth works' '
-	git checkout -f master &&
+	git checkout -f main &&
 	git reset --hard first &&
 	test_tick &&
 	git cherry-pick first..fourth &&
@@ -45,7 +45,7 @@ test_expect_success 'cherry-pick three one two works' '
 	test_commit one &&
 	test_commit two &&
 	test_commit three &&
-	git checkout -f master &&
+	git checkout -f main &&
 	git reset --hard first &&
 	git cherry-pick three one two &&
 	git diff --quiet three &&
@@ -56,28 +56,28 @@ two"
 '
 
 test_expect_success 'cherry-pick three one two: fails' '
-	git checkout -f master &&
+	git checkout -f main &&
 	git reset --hard first &&
 	test_must_fail git cherry-pick three one two:
 '
 
 test_expect_success 'output to keep user entertained during multi-pick' '
 	cat <<-\EOF >expected &&
-	[master OBJID] second
+	[main OBJID] second
 	 Author: A U Thor <[email protected]>
 	 Date: Thu Apr 7 15:14:13 2005 -0700
 	 1 file changed, 1 insertion(+)
-	[master OBJID] third
+	[main OBJID] third
 	 Author: A U Thor <[email protected]>
 	 Date: Thu Apr 7 15:15:13 2005 -0700
 	 1 file changed, 1 insertion(+)
-	[master OBJID] fourth
+	[main OBJID] fourth
 	 Author: A U Thor <[email protected]>
 	 Date: Thu Apr 7 15:16:13 2005 -0700
 	 1 file changed, 1 insertion(+)
 	EOF
 
-	git checkout -f master &&
+	git checkout -f main &&
 	git reset --hard first &&
 	test_tick &&
 	git cherry-pick first..fourth >actual &&
@@ -87,7 +87,7 @@ test_expect_success 'output to keep user entertained during multi-pick' '
 '
 
 test_expect_success 'cherry-pick --strategy resolve first..fourth works' '
-	git checkout -f master &&
+	git checkout -f main &&
 	git reset --hard first &&
 	test_tick &&
 	git cherry-pick --strategy resolve first..fourth &&
@@ -99,23 +99,23 @@ test_expect_success 'cherry-pick --strategy resolve first..fourth works' '
 test_expect_success 'output during multi-pick indicates merge strategy' '
 	cat <<-\EOF >expected &&
 	Trying simple merge.
-	[master OBJID] second
+	[main OBJID] second
 	 Author: A U Thor <[email protected]>
 	 Date: Thu Apr 7 15:14:13 2005 -0700
 	 1 file changed, 1 insertion(+)
 	Trying simple merge.
-	[master OBJID] third
+	[main OBJID] third
 	 Author: A U Thor <[email protected]>
 	 Date: Thu Apr 7 15:15:13 2005 -0700
 	 1 file changed, 1 insertion(+)
 	Trying simple merge.
-	[master OBJID] fourth
+	[main OBJID] fourth
 	 Author: A U Thor <[email protected]>
 	 Date: Thu Apr 7 15:16:13 2005 -0700
 	 1 file changed, 1 insertion(+)
 	EOF
 
-	git checkout -f master &&
+	git checkout -f main &&
 	git reset --hard first &&
 	test_tick &&
 	git cherry-pick --strategy resolve first..fourth >actual &&
@@ -124,7 +124,7 @@ test_expect_success 'output during multi-pick indicates merge strategy' '
 '
 
 test_expect_success 'cherry-pick --ff first..fourth works' '
-	git checkout -f master &&
+	git checkout -f main &&
 	git reset --hard first &&
 	test_tick &&
 	git cherry-pick --ff first..fourth &&
@@ -134,7 +134,7 @@ test_expect_success 'cherry-pick --ff first..fourth works' '
 '
 
 test_expect_success 'cherry-pick -n first..fourth works' '
-	git checkout -f master &&
+	git checkout -f main &&
 	git reset --hard first &&
 	test_tick &&
 	git cherry-pick -n first..fourth &&
@@ -144,7 +144,7 @@ test_expect_success 'cherry-pick -n first..fourth works' '
 '
 
 test_expect_success 'revert first..fourth works' '
-	git checkout -f master &&
+	git checkout -f main &&
 	git reset --hard fourth &&
 	test_tick &&
 	git revert first..fourth &&
@@ -154,7 +154,7 @@ test_expect_success 'revert first..fourth works' '
 '
 
 test_expect_success 'revert ^first fourth works' '
-	git checkout -f master &&
+	git checkout -f main &&
 	git reset --hard fourth &&
 	test_tick &&
 	git revert ^first fourth &&
@@ -164,7 +164,7 @@ test_expect_success 'revert ^first fourth works' '
 '
 
 test_expect_success 'revert fourth fourth~1 fourth~2 works' '
-	git checkout -f master &&
+	git checkout -f main &&
 	git reset --hard fourth &&
 	test_tick &&
 	git revert fourth fourth~1 fourth~2 &&
@@ -174,7 +174,7 @@ test_expect_success 'revert fourth fourth~1 fourth~2 works' '
 '
 
 test_expect_success 'cherry-pick -3 fourth works' '
-	git checkout -f master &&
+	git checkout -f main &&
 	git reset --hard first &&
 	test_tick &&
 	git cherry-pick -3 fourth &&
@@ -184,7 +184,7 @@ test_expect_success 'cherry-pick -3 fourth works' '
 '
 
 test_expect_success 'cherry-pick --stdin works' '
-	git checkout -f master &&
+	git checkout -f main &&
 	git reset --hard first &&
 	test_tick &&
 	git rev-list --reverse first..fourth | git cherry-pick --stdin &&
t/t3509-cherry-pick-merge-df.sh +1 -1
index 1e5b3948df..dfc5e9f914 100755
@@ -28,7 +28,7 @@ test_expect_success 'Setup rename across paths each below D/F conflicts' '
 
 test_expect_success 'Cherry-pick succeeds with rename across D/F conflicts' '
 	git reset --hard &&
-	git checkout master^0 &&
+	git checkout main^0 &&
 	git cherry-pick branch
 '
 
t/t3512-cherry-pick-submodule.sh +1 -1
index 6ece1d8573..ec09d7d8a8 100755
@@ -35,7 +35,7 @@ test_expect_success 'unrelated submodule/file conflict is ignored' '
 		git add a_file &&
 		git commit -m "modify a file" &&
 
-		git checkout master &&
+		git checkout main &&
 
 		git submodule add ../sub sub &&
 		git submodule update sub &&
t/t3600-rm.sh +5 -5
index efec8d13b6..243087d9c6 100755
@@ -483,16 +483,16 @@ test_expect_success 'setup submodule conflict' '
 	echo 1 >nitfol &&
 	git add nitfol &&
 	git commit -m "added nitfol 1" &&
-	git checkout -b branch2 master &&
+	git checkout -b branch2 main &&
 	echo 2 >nitfol &&
 	git add nitfol &&
 	git commit -m "added nitfol 2" &&
-	git checkout -b conflict1 master &&
+	git checkout -b conflict1 main &&
 	git -C submod fetch &&
 	git -C submod checkout branch1 &&
 	git add submod &&
 	git commit -m "submod 1" &&
-	git checkout -b conflict2 master &&
+	git checkout -b conflict2 main &&
 	git -C submod checkout branch2 &&
 	git add submod &&
 	git commit -m "submod 2"
@@ -604,7 +604,7 @@ test_expect_success 'rm of a conflicted unpopulated submodule succeeds' '
 '
 
 test_expect_success 'rm of a populated submodule with a .git directory migrates git dir' '
-	git checkout -f master &&
+	git checkout -f main &&
 	git reset --hard &&
 	git submodule update &&
 	(
@@ -717,7 +717,7 @@ test_expect_success 'checking out a commit after submodule removal needs manual
 	git checkout HEAD^ &&
 	git submodule update &&
 	git checkout -q HEAD^ &&
-	git checkout -q master 2>actual &&
+	git checkout -q main 2>actual &&
 	test_i18ngrep "^warning: unable to rmdir '\''submod'\'':" actual &&
 	git status -s submod >actual &&
 	echo "?? submod/" >expected &&
t/t3701-add-interactive.sh +2 -2
index ca04fac417..4abaa9be02 100755
@@ -549,8 +549,8 @@ test_expect_success 'patch mode ignores unmerged entries' '
 	test_commit non-conflict &&
 	git checkout -b side &&
 	test_commit side conflict.t &&
-	git checkout master &&
-	test_commit master conflict.t &&
+	git checkout main &&
+	test_commit main conflict.t &&
 	test_must_fail git merge side &&
 	echo changed >non-conflict.t &&
 	echo y | git add -p >output &&
t/t3901-i18n-patch.sh +20 -20
index 923eb01f0e..6a96959e06 100755
@@ -45,7 +45,7 @@ test_expect_success setup '
 
 	# the first commit on the side branch is UTF-8
 	test_tick &&
-	git checkout -b side master^ &&
+	git checkout -b side main^ &&
 	echo Another file >yours &&
 	git add yours &&
 	git commit -s -m "Second on side" &&
@@ -69,7 +69,7 @@ test_expect_success setup '
 test_expect_success 'format-patch output (ISO-8859-1)' '
 	git config i18n.logoutputencoding ISO8859-1 &&
 
-	git format-patch --stdout master..HEAD^ >out-l1 &&
+	git format-patch --stdout main..HEAD^ >out-l1 &&
 	git format-patch --stdout HEAD^ >out-l2 &&
 	grep "^Content-Type: text/plain; charset=ISO8859-1" out-l1 &&
 	grep "^From: =?ISO8859-1?q?=C1=E9=ED=20=F3=FA?=" out-l1 &&
@@ -80,7 +80,7 @@ test_expect_success 'format-patch output (ISO-8859-1)' '
 test_expect_success 'format-patch output (UTF-8)' '
 	git config i18n.logoutputencoding UTF-8 &&
 
-	git format-patch --stdout master..HEAD^ >out-u1 &&
+	git format-patch --stdout main..HEAD^ >out-u1 &&
 	git format-patch --stdout HEAD^ >out-u2 &&
 	grep "^Content-Type: text/plain; charset=UTF-8" out-u1 &&
 	grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD=20=C3=B3=C3=BA?=" out-u1 &&
@@ -102,7 +102,7 @@ test_expect_success 'rebase (U/U)' '
 	# we want UTF-8 encoded name.
 	. "$TEST_DIRECTORY"/t3901/utf8.txt &&
 	git checkout -b test &&
-	git rebase master &&
+	git rebase main &&
 
 	check_encoding 2
 '
@@ -113,7 +113,7 @@ test_expect_success 'rebase (U/L)' '
 	. "$TEST_DIRECTORY"/t3901/utf8.txt &&
 
 	git reset --hard side &&
-	git rebase master &&
+	git rebase main &&
 
 	check_encoding 2
 '
@@ -125,7 +125,7 @@ test_expect_success !MINGW 'rebase (L/L)' '
 	. "$TEST_DIRECTORY"/t3901/8859-1.txt &&
 
 	git reset --hard side &&
-	git rebase master &&
+	git rebase main &&
 
 	check_encoding 2 8859
 '
@@ -138,7 +138,7 @@ test_expect_success !MINGW 'rebase (L/U)' '
 	. "$TEST_DIRECTORY"/t3901/8859-1.txt &&
 
 	git reset --hard side &&
-	git rebase master &&
+	git rebase main &&
 
 	check_encoding 2 8859
 '
@@ -150,7 +150,7 @@ test_expect_success 'cherry-pick(U/U)' '
 	git config i18n.logoutputencoding UTF-8 &&
 	. "$TEST_DIRECTORY"/t3901/utf8.txt &&
 
-	git reset --hard master &&
+	git reset --hard main &&
 	git cherry-pick side^ &&
 	git cherry-pick side &&
 	git revert HEAD &&
@@ -165,7 +165,7 @@ test_expect_success !MINGW 'cherry-pick(L/L)' '
 	git config i18n.logoutputencoding ISO8859-1 &&
 	. "$TEST_DIRECTORY"/t3901/8859-1.txt &&
 
-	git reset --hard master &&
+	git reset --hard main &&
 	git cherry-pick side^ &&
 	git cherry-pick side &&
 	git revert HEAD &&
@@ -180,7 +180,7 @@ test_expect_success 'cherry-pick(U/L)' '
 	git config i18n.logoutputencoding ISO8859-1 &&
 	. "$TEST_DIRECTORY"/t3901/utf8.txt &&
 
-	git reset --hard master &&
+	git reset --hard main &&
 	git cherry-pick side^ &&
 	git cherry-pick side &&
 	git revert HEAD &&
@@ -196,7 +196,7 @@ test_expect_success !MINGW 'cherry-pick(L/U)' '
 	git config i18n.logoutputencoding UTF-8 &&
 	. "$TEST_DIRECTORY"/t3901/8859-1.txt &&
 
-	git reset --hard master &&
+	git reset --hard main &&
 	git cherry-pick side^ &&
 	git cherry-pick side &&
 	git revert HEAD &&
@@ -210,7 +210,7 @@ test_expect_success 'rebase --merge (U/U)' '
 	. "$TEST_DIRECTORY"/t3901/utf8.txt &&
 
 	git reset --hard side &&
-	git rebase --merge master &&
+	git rebase --merge main &&
 
 	check_encoding 2
 '
@@ -221,7 +221,7 @@ test_expect_success 'rebase --merge (U/L)' '
 	. "$TEST_DIRECTORY"/t3901/utf8.txt &&
 
 	git reset --hard side &&
-	git rebase --merge master &&
+	git rebase --merge main &&
 
 	check_encoding 2
 '
@@ -233,7 +233,7 @@ test_expect_success 'rebase --merge (L/L)' '
 	. "$TEST_DIRECTORY"/t3901/8859-1.txt &&
 
 	git reset --hard side &&
-	git rebase --merge master &&
+	git rebase --merge main &&
 
 	check_encoding 2 8859
 '
@@ -246,7 +246,7 @@ test_expect_success 'rebase --merge (L/U)' '
 	. "$TEST_DIRECTORY"/t3901/8859-1.txt &&
 
 	git reset --hard side &&
-	git rebase --merge master &&
+	git rebase --merge main &&
 
 	check_encoding 2 8859
 '
@@ -256,7 +256,7 @@ test_expect_success 'am (U/U)' '
 	git config i18n.commitencoding UTF-8 &&
 	. "$TEST_DIRECTORY"/t3901/utf8.txt &&
 
-	git reset --hard master &&
+	git reset --hard main &&
 	git am out-u1 out-u2 &&
 
 	check_encoding 2
@@ -267,7 +267,7 @@ test_expect_success !MINGW 'am (L/L)' '
 	git config i18n.commitencoding ISO8859-1 &&
 	. "$TEST_DIRECTORY"/t3901/8859-1.txt &&
 
-	git reset --hard master &&
+	git reset --hard main &&
 	git am out-l1 out-l2 &&
 
 	check_encoding 2 8859
@@ -277,7 +277,7 @@ test_expect_success 'am (U/L)' '
 	# Apply ISO-8859-1 patches with UTF-8 commitencoding
 	git config i18n.commitencoding UTF-8 &&
 	. "$TEST_DIRECTORY"/t3901/utf8.txt &&
-	git reset --hard master &&
+	git reset --hard main &&
 
 	# am specifies --utf8 by default.
 	git am out-l1 out-l2 &&
@@ -290,7 +290,7 @@ test_expect_success 'am --no-utf8 (U/L)' '
 	git config i18n.commitencoding UTF-8 &&
 	. "$TEST_DIRECTORY"/t3901/utf8.txt &&
 
-	git reset --hard master &&
+	git reset --hard main &&
 	git am --no-utf8 out-l1 out-l2 2>err &&
 
 	# commit-tree will warn that the commit message does not contain valid UTF-8
@@ -305,7 +305,7 @@ test_expect_success !MINGW 'am (L/U)' '
 	git config i18n.commitencoding ISO8859-1 &&
 	. "$TEST_DIRECTORY"/t3901/8859-1.txt &&
 
-	git reset --hard master &&
+	git reset --hard main &&
 	# mailinfo will re-code the commit message to the charset specified by
 	# i18n.commitencoding
 	git am out-u1 out-u2 &&
t/t3903-stash.sh +16 -16
index 9f7ca98967..97374f393a 100755
@@ -220,14 +220,14 @@ test_expect_success 'stash branch' '
 	git commit file -m second &&
 	git stash branch stashbranch &&
 	test refs/heads/stashbranch = $(git symbolic-ref HEAD) &&
-	test $(git rev-parse HEAD) = $(git rev-parse master^) &&
+	test $(git rev-parse HEAD) = $(git rev-parse main^) &&
 	git diff --cached >output &&
 	diff_cmp expect output &&
 	git diff >output &&
 	diff_cmp expect1 output &&
 	git add file &&
 	git commit -m alternate\ second &&
-	git diff master..stashbranch >output &&
+	git diff main..stashbranch >output &&
 	diff_cmp output expect2 &&
 	test 0 = $(git stash list | wc -l)
 '
@@ -520,7 +520,7 @@ test_expect_success 'stash branch - no stashes on stack, stash-like argument' '
 	STASH_ID=$(git stash create) &&
 	git reset --hard &&
 	git stash branch stash-branch ${STASH_ID} &&
-	test_when_finished "git reset --hard HEAD && git checkout master &&
+	test_when_finished "git reset --hard HEAD && git checkout main &&
 	git branch -D stash-branch" &&
 	test $(git ls-files --modified | wc -l) -eq 1
 '
@@ -536,7 +536,7 @@ test_expect_success 'stash branch - stashes on stack, stash-like argument' '
 	STASH_ID=$(git stash create) &&
 	git reset --hard &&
 	git stash branch stash-branch ${STASH_ID} &&
-	test_when_finished "git reset --hard HEAD && git checkout master &&
+	test_when_finished "git reset --hard HEAD && git checkout main &&
 	git branch -D stash-branch" &&
 	test $(git ls-files --modified | wc -l) -eq 1
 '
@@ -738,7 +738,7 @@ test_expect_success 'valid ref of the form "n", n < N' '
 	git stash &&
 	git stash show 0 &&
 	git stash branch tmp 0 &&
-	git checkout master &&
+	git checkout main &&
 	git stash &&
 	git stash apply 0 &&
 	git reset --hard &&
@@ -755,7 +755,7 @@ test_expect_success 'branch: do not drop the stash if the branch exists' '
 	git commit -m initial &&
 	echo bar >file &&
 	git stash &&
-	test_must_fail git stash branch master stash@{0} &&
+	test_must_fail git stash branch main stash@{0} &&
 	git rev-parse stash@{0} --
 '
 
@@ -768,7 +768,7 @@ test_expect_success 'branch: should not drop the stash if the apply fails' '
 	echo bar >file &&
 	git stash &&
 	echo baz >file &&
-	test_when_finished "git checkout master" &&
+	test_when_finished "git checkout main" &&
 	test_must_fail git stash branch new_branch stash@{0} &&
 	git rev-parse stash@{0} --
 '
@@ -902,7 +902,7 @@ test_expect_success 'push -m shows right message' '
 	>foo &&
 	git add foo &&
 	git stash push -m "test message" &&
-	echo "stash@{0}: On master: test message" >expect &&
+	echo "stash@{0}: On main: test message" >expect &&
 	git stash list -1 >actual &&
 	test_cmp expect actual
 '
@@ -911,7 +911,7 @@ test_expect_success 'push -m also works without space' '
 	>foo &&
 	git add foo &&
 	git stash push -m"unspaced test message" &&
-	echo "stash@{0}: On master: unspaced test message" >expect &&
+	echo "stash@{0}: On main: unspaced test message" >expect &&
 	git stash list -1 >actual &&
 	test_cmp expect actual
 '
@@ -968,7 +968,7 @@ test_expect_success 'push -mfoo uses right message' '
 	>foo &&
 	git add foo &&
 	git stash push -m"test mfoo" &&
-	echo "stash@{0}: On master: test mfoo" >expect &&
+	echo "stash@{0}: On main: test mfoo" >expect &&
 	git stash list -1 >actual &&
 	test_cmp expect actual
 '
@@ -977,7 +977,7 @@ test_expect_success 'push --message foo is synonym for -mfoo' '
 	>foo &&
 	git add foo &&
 	git stash push --message "test message foo" &&
-	echo "stash@{0}: On master: test message foo" >expect &&
+	echo "stash@{0}: On main: test message foo" >expect &&
 	git stash list -1 >actual &&
 	test_cmp expect actual
 '
@@ -986,7 +986,7 @@ test_expect_success 'push --message=foo is synonym for -mfoo' '
 	>foo &&
 	git add foo &&
 	git stash push --message="test message=foo" &&
-	echo "stash@{0}: On master: test message=foo" >expect &&
+	echo "stash@{0}: On main: test message=foo" >expect &&
 	git stash list -1 >actual &&
 	test_cmp expect actual
 '
@@ -995,7 +995,7 @@ test_expect_success 'push -m shows right message' '
 	>foo &&
 	git add foo &&
 	git stash push -m "test m foo" &&
-	echo "stash@{0}: On master: test m foo" >expect &&
+	echo "stash@{0}: On main: test m foo" >expect &&
 	git stash list -1 >actual &&
 	test_cmp expect actual
 '
@@ -1004,7 +1004,7 @@ test_expect_success 'create stores correct message' '
 	>foo &&
 	git add foo &&
 	STASH_ID=$(git stash create "create test message") &&
-	echo "On master: create test message" >expect &&
+	echo "On main: create test message" >expect &&
 	git show --pretty=%s -s ${STASH_ID} >actual &&
 	test_cmp expect actual
 '
@@ -1013,13 +1013,13 @@ test_expect_success 'create with multiple arguments for the message' '
 	>foo &&
 	git add foo &&
 	STASH_ID=$(git stash create test untracked) &&
-	echo "On master: test untracked" >expect &&
+	echo "On main: test untracked" >expect &&
 	git show --pretty=%s -s ${STASH_ID} >actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'create in a detached state' '
-	test_when_finished "git checkout master" &&
+	test_when_finished "git checkout main" &&
 	git checkout HEAD~1 &&
 	>foo &&
 	git add foo &&
t/t3910-mac-os-precompose.sh +3 -3
index 54ce19e353..7e03823537 100755
@@ -151,7 +151,7 @@ test_expect_success "git checkout link nfd" '
 	git checkout l.$Odiarnfd
 '
 test_expect_success "setup case mac2" '
-	git checkout master &&
+	git checkout main &&
 	git reset --hard &&
 	git checkout -b mac_os_2
 '
@@ -163,7 +163,7 @@ test_expect_success "commit file d2.Adiarnfd/f.Adiarnfd" '
 	git commit -m "add d2.$Adiarnfd/f.$Adiarnfd" -- d2.$Adiarnfd/f.$Adiarnfd
 '
 test_expect_success "setup for long decomposed filename" '
-	git checkout master &&
+	git checkout main &&
 	git reset --hard &&
 	git checkout -b mac_os_long_nfd_fn
 '
@@ -173,7 +173,7 @@ test_expect_success "Add long decomposed filename" '
 	git commit -m "Long filename"
 '
 test_expect_success "setup for long precomposed filename" '
-	git checkout master &&
+	git checkout main &&
 	git reset --hard &&
 	git checkout -b mac_os_long_nfc_fn
 '
t/test-lib.sh +1 -1
index 4ae87a5c4e..76ab747b53 100644
@@ -263,7 +263,7 @@ case "$TEST_NUMBER" in
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
-[0-2]*|3[0-4]*)
+[0-3]*)
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
Signature · 1 line
gitgitgadget
#19 lore raw

PATCH 16/28 t5[6-9]*: adjust the references to the default branch name "main"

In reply to Johannes Schindelin via GitGitGadget

From: Johannes Schindelin <[email protected]>

This trick was performed via

	$ (cd t &&
	   sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
		-e 's/Master/Main/g' -- t5[6-9]*.sh)

This allows us to define GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main for those tests.

---
 t/t5601-clone.sh                    |  4 +-
 t/t5604-clone-reference.sh          | 12 +++---
 t/t5605-clone-local.sh              | 10 ++---
 t/t5606-clone-options.sh            |  8 ++--
 t/t5607-clone-bundle.sh             | 14 +++----
 t/t5608-clone-2gb.sh                |  2 +-
 t/t5609-clone-branch.sh             |  6 +--
 t/t5610-clone-detached.sh           |  4 +-
 t/t5611-clone-config.sh             | 16 ++++----
 t/t5612-clone-refspec.sh            | 42 ++++++++++-----------
 t/t5614-clone-submodules-shallow.sh |  2 +-
 t/t5616-partial-clone.sh            | 50 ++++++++++++-------------
 t/t5617-clone-submodules-remote.sh  |  6 +--
 t/t5700-protocol-v1.sh              | 16 ++++----
 t/t5701-git-serve.sh                | 16 ++++----
 t/t5702-protocol-v2.sh              | 50 ++++++++++++-------------
 t/t5703-upload-pack-ref-in-want.sh  | 58 ++++++++++++++---------------
 t/t5801-remote-helpers.sh           | 24 ++++++------
 t/test-lib.sh                       |  2 +-
 19 files changed, 171 insertions(+), 171 deletions(-)
t/t5601-clone.sh +2 -2
index 7df3c5373a..f5058be718 100755
@@ -217,7 +217,7 @@ test_expect_success 'clone respects global branch.autosetuprebase' '
 		rm -fr dst &&
 		git clone src dst &&
 		cd dst &&
-		actual="z$(git config branch.master.rebase)" &&
+		actual="z$(git config branch.main.rebase)" &&
 		test ztrue = $actual
 	)
 '
@@ -591,7 +591,7 @@ test_expect_success 'clone from a repository with two identical branches' '
 
 	(
 		cd src &&
-		git checkout -b another master
+		git checkout -b another main
 	) &&
 	git clone src target-11 &&
 	test "z$( cd target-11 && git symbolic-ref HEAD )" = zrefs/heads/another
t/t5604-clone-reference.sh +6 -6
index 2f7be23044..db86a84af9 100755
@@ -49,7 +49,7 @@ test_expect_success 'existence of info/alternates' '
 '
 
 test_expect_success 'pulling from reference' '
-	git -C C pull ../B master
+	git -C C pull ../B main
 '
 
 test_expect_success 'that reference gets used' '
@@ -70,7 +70,7 @@ test_expect_success 'existence of info/alternates' '
 '
 
 test_expect_success 'pulling from reference' '
-	git -C D pull ../B master
+	git -C D pull ../B main
 '
 
 test_expect_success 'that reference gets used' '
@@ -136,11 +136,11 @@ test_expect_success 'prepare branched repository' '
 	git clone A J &&
 	(
 		cd J &&
-		git checkout -b other master^ &&
+		git checkout -b other main^ &&
 		echo other >otherfile &&
 		git add otherfile &&
 		git commit -m other &&
-		git checkout master
+		git checkout main
 	)
 '
 
@@ -152,9 +152,9 @@ test_expect_success 'fetch with incomplete alternates' '
 		git remote add J "file://$base_dir/J" &&
 		GIT_TRACE_PACKET=$U.K git fetch J
 	) &&
-	master_object=$(cd A && git for-each-ref --format="%(objectname)" refs/heads/master) &&
+	main_object=$(cd A && git for-each-ref --format="%(objectname)" refs/heads/main) &&
 	test -s "$U.K" &&
-	! grep " want $master_object" "$U.K" &&
+	! grep " want $main_object" "$U.K" &&
 	tag_object=$(cd A && git for-each-ref --format="%(objectname)" refs/tags/HEAD) &&
 	! grep " want $tag_object" "$U.K"
 '
t/t5605-clone-local.sh +5 -5
index af23419ebf..a7756e9622 100755
@@ -15,7 +15,7 @@ test_expect_success 'preparing origin repository' '
 	test "$(cd a.git && git config --bool core.bare)" = true &&
 	test "$(cd x && git config --bool core.bare)" = true &&
 	git bundle create b1.bundle --all &&
-	git bundle create b2.bundle master &&
+	git bundle create b2.bundle main &&
 	mkdir dir &&
 	cp b1.bundle dir/b3 &&
 	cp b1.bundle b4
@@ -84,7 +84,7 @@ test_expect_success 'bundle clone with nonexistent HEAD' '
 	git clone b2.bundle b2 &&
 	(cd b2 &&
 	git fetch &&
-	test_must_fail git rev-parse --verify refs/heads/master)
+	test_must_fail git rev-parse --verify refs/heads/main)
 '
 
 test_expect_success 'clone empty repository' '
@@ -98,9 +98,9 @@ test_expect_success 'clone empty repository' '
 	 echo "content" >> foo &&
 	 git add foo &&
 	 git commit -m "Initial commit" &&
-	 git push origin master &&
-	 expected=$(git rev-parse master) &&
-	 actual=$(git --git-dir=../empty/.git rev-parse master) &&
+	 git push origin main &&
+	 expected=$(git rev-parse main) &&
+	 actual=$(git --git-dir=../empty/.git rev-parse main) &&
 	 test $actual = $expected)
 '
 
t/t5606-clone-options.sh +4 -4
index 7f082fb23b..80caff9266 100755
@@ -15,7 +15,7 @@ test_expect_success 'setup' '
 test_expect_success 'clone -o' '
 
 	git clone -o foo parent clone-o &&
-	git -C clone-o rev-parse --verify refs/remotes/foo/master
+	git -C clone-o rev-parse --verify refs/remotes/foo/main
 
 '
 
@@ -45,7 +45,7 @@ test_expect_success 'disallows --bare with --separate-git-dir' '
 test_expect_success 'uses "origin" for default remote name' '
 
 	git clone parent clone-default-origin &&
-	git -C clone-default-origin rev-parse --verify refs/remotes/origin/master
+	git -C clone-default-origin rev-parse --verify refs/remotes/origin/main
 
 '
 
@@ -74,14 +74,14 @@ test_expect_success 'prefers config "clone.defaultRemoteName" over default' '
 
 	test_config_global clone.defaultRemoteName from_config &&
 	git clone parent clone-config-origin &&
-	git -C clone-config-origin rev-parse --verify refs/remotes/from_config/master
+	git -C clone-config-origin rev-parse --verify refs/remotes/from_config/main
 
 '
 
 test_expect_success 'prefers --origin over -c config' '
 
 	git clone -c clone.defaultRemoteName=inline --origin from_option parent clone-o-and-inline-config &&
-	git -C clone-o-and-inline-config rev-parse --verify refs/remotes/from_option/master
+	git -C clone-o-and-inline-config rev-parse --verify refs/remotes/from_option/main
 
 '
 
t/t5607-clone-bundle.sh +7 -7
index 26985f4b44..4f2db37981 100755
@@ -19,7 +19,7 @@ test_expect_success 'setup' '
 '
 
 test_expect_success '"verify" needs a worktree' '
-	git bundle create tip.bundle -1 master &&
+	git bundle create tip.bundle -1 main &&
 	nongit test_must_fail git bundle verify ../tip.bundle 2>err &&
 	test_i18ngrep "need a repository" err
 '
@@ -39,15 +39,15 @@ test_expect_success 'die if bundle file cannot be created' '
 '
 
 test_expect_failure 'bundle --stdin' '
-	echo master | git bundle create stdin-bundle.bdl --stdin &&
+	echo main | git bundle create stdin-bundle.bdl --stdin &&
 	git ls-remote stdin-bundle.bdl >output &&
-	grep master output
+	grep main output
 '
 
 test_expect_failure 'bundle --stdin <rev-list options>' '
-	echo master | git bundle create hybrid-bundle.bdl --stdin tag &&
+	echo main | git bundle create hybrid-bundle.bdl --stdin tag &&
 	git ls-remote hybrid-bundle.bdl >output &&
-	grep master output
+	grep main output
 '
 
 test_expect_success 'empty bundle file is rejected' '
@@ -83,14 +83,14 @@ test_expect_success 'prerequisites with an empty commit message' '
 
 test_expect_success 'failed bundle creation does not leave cruft' '
 	# This fails because the bundle would be empty.
-	test_must_fail git bundle create fail.bundle master..master &&
+	test_must_fail git bundle create fail.bundle main..main &&
 	test_path_is_missing fail.bundle.lock
 '
 
 test_expect_success 'fetch SHA-1 from bundle' '
 	test_create_repo foo &&
 	test_commit -C foo x &&
-	git -C foo bundle create tip.bundle -1 master &&
+	git -C foo bundle create tip.bundle -1 main &&
 	git -C foo rev-parse HEAD >hash &&
 
 	# Exercise to ensure that fetching a SHA-1 from a bundle works with no
t/t5608-clone-2gb.sh +1 -1
index 4c476d2fa1..87a8cd9f98 100755
@@ -26,7 +26,7 @@ test_expect_success 'setup' '
 		i=$(($i+1)) ||
 		echo $? > exit-status
 	 done &&
-	 echo "commit refs/heads/master" &&
+	 echo "commit refs/heads/main" &&
 	 echo "author A U Thor <[email protected]> 123456789 +0000" &&
 	 echo "committer C O Mitter <[email protected]> 123456789 +0000" &&
 	 echo "data 5" &&
t/t5609-clone-branch.sh +3 -3
index 6e7a7be052..2652dbe4e4 100755
@@ -20,7 +20,7 @@ test_expect_success 'setup' '
 	 echo one >file && git add file && git commit -m one &&
 	 git checkout -b two &&
 	 echo two >file && git add file && git commit -m two &&
-	 git checkout master) &&
+	 git checkout main) &&
 	mkdir empty &&
 	(cd empty && git init)
 '
@@ -28,7 +28,7 @@ test_expect_success 'setup' '
 test_expect_success 'vanilla clone chooses HEAD' '
 	git clone parent clone &&
 	(cd clone &&
-	 check_HEAD master &&
+	 check_HEAD main &&
 	 check_file one
 	)
 '
@@ -53,7 +53,7 @@ test_expect_success 'clone -b sets up tracking' '
 
 test_expect_success 'clone -b does not munge remotes/origin/HEAD' '
 	(cd clone-two &&
-	 echo refs/remotes/origin/master >expect &&
+	 echo refs/remotes/origin/main >expect &&
 	 git symbolic-ref refs/remotes/origin/HEAD >actual &&
 	 test_cmp expect actual
 	)
t/t5610-clone-detached.sh +2 -2
index 8b0d607df1..985f0d7303 100755
@@ -20,7 +20,7 @@ test_expect_success 'setup' '
 '
 
 test_expect_success 'clone repo (detached HEAD points to branch)' '
-	git checkout master^0 &&
+	git checkout main^0 &&
 	git clone "file://$PWD" detached-branch
 '
 test_expect_success 'cloned HEAD matches' '
@@ -59,7 +59,7 @@ test_expect_success 'cloned HEAD is detached' '
 '
 
 test_expect_success 'clone repo (orphan detached HEAD)' '
-	git checkout master^0 &&
+	git checkout main^0 &&
 	echo four >file &&
 	git commit -a -m four &&
 	git clone "file://$PWD" detached-orphan
t/t5611-clone-config.sh +8 -8
index 8e0fd39823..6e10ac9a9f 100755
@@ -47,16 +47,16 @@ test_expect_success 'clone -c config is available during clone' '
 
 test_expect_success 'clone -c remote.origin.fetch=<refspec> works' '
 	rm -rf child &&
-	git update-ref refs/grab/it refs/heads/master &&
-	git update-ref refs/leave/out refs/heads/master &&
+	git update-ref refs/grab/it refs/heads/main &&
+	git update-ref refs/leave/out refs/heads/main &&
 	git clone -c "remote.origin.fetch=+refs/grab/*:refs/grab/*" . child &&
 	git -C child for-each-ref --format="%(refname)" >actual &&
 
 	cat >expect <<-\EOF &&
 	refs/grab/it
-	refs/heads/master
+	refs/heads/main
 	refs/remotes/origin/HEAD
-	refs/remotes/origin/master
+	refs/remotes/origin/main
 	EOF
 	test_cmp expect actual
 '
@@ -68,9 +68,9 @@ test_expect_success 'git -c remote.origin.fetch=<refspec> clone works' '
 
 	cat >expect <<-\EOF &&
 	refs/grab/it
-	refs/heads/master
+	refs/heads/main
 	refs/remotes/origin/HEAD
-	refs/remotes/origin/master
+	refs/remotes/origin/main
 	EOF
 	test_cmp expect actual
 '
@@ -85,9 +85,9 @@ test_expect_success 'clone -c remote.<remote>.fetch=<refspec> --origin=<name>' '
 
 	cat >expect <<-\EOF &&
 	refs/grab/it
-	refs/heads/master
+	refs/heads/main
 	refs/remotes/upstream/HEAD
-	refs/remotes/upstream/master
+	refs/remotes/upstream/main
 	EOF
 	test_cmp expect actual
 '
t/t5612-clone-refspec.sh +21 -21

118 lines not on this page · raw message

t/t5614-clone-submodules-shallow.sh +1 -1
index e4e6ea4d52..5504b519c7 100755
@@ -7,7 +7,7 @@ test_description='Test shallow cloning of repos with submodules'
 pwd=$(pwd)
 
 test_expect_success 'setup' '
-	git checkout -b master &&
+	git checkout -b main &&
 	test_commit commit1 &&
 	test_commit commit2 &&
 	mkdir sub &&
t/t5616-partial-clone.sh +25 -25

161 lines not on this page · raw message

t/t5617-clone-submodules-remote.sh +3 -3
index 1a041df10b..abab358119 100755
@@ -7,7 +7,7 @@ test_description='Test cloning repos with submodules using remote-tracking branc
 pwd=$(pwd)
 
 test_expect_success 'setup' '
-	git checkout -b master &&
+	git checkout -b main &&
 	test_commit commit1 &&
 	mkdir sub &&
 	(
@@ -39,7 +39,7 @@ test_expect_success 'clone with --remote-submodules' '
 	git clone --recurse-submodules --remote-submodules "file://$pwd/." super_clone &&
 	(
 		cd super_clone/sub &&
-		git diff --exit-code remotes/origin/master
+		git diff --exit-code remotes/origin/main
 	)
 '
 
@@ -57,7 +57,7 @@ test_expect_success 'clone with --single-branch' '
 	git clone --recurse-submodules --single-branch "file://$pwd/." super_clone &&
 	(
 		cd super_clone/sub &&
-		git rev-parse --verify origin/master &&
+		git rev-parse --verify origin/main &&
 		test_must_fail git rev-parse --verify origin/other
 	)
 '
t/t5700-protocol-v1.sh +8 -8
index 022901b9eb..bfa7e3379a 100755
@@ -41,7 +41,7 @@ test_expect_success 'fetch with git:// using protocol v1' '
 	GIT_TRACE_PACKET=1 git -C daemon_child -c protocol.version=1 \
 		fetch 2>log &&
 
-	git -C daemon_child log -1 --format=%s origin/master >actual &&
+	git -C daemon_child log -1 --format=%s origin/main >actual &&
 	git -C "$daemon_parent" log -1 --format=%s >expect &&
 	test_cmp expect actual &&
 
@@ -69,7 +69,7 @@ test_expect_success 'push with git:// using protocol v1' '
 	test_commit -C daemon_child three &&
 
 	# Push to another branch, as the target repository has the
-	# master branch checked out and we cannot push into it.
+	# main branch checked out and we cannot push into it.
 	GIT_TRACE_PACKET=1 git -C daemon_child -c protocol.version=1 \
 		push origin HEAD:client_branch 2>log &&
 
@@ -110,7 +110,7 @@ test_expect_success 'fetch with file:// using protocol v1' '
 	GIT_TRACE_PACKET=1 git -C file_child -c protocol.version=1 \
 		fetch 2>log &&
 
-	git -C file_child log -1 --format=%s origin/master >actual &&
+	git -C file_child log -1 --format=%s origin/main >actual &&
 	git -C file_parent log -1 --format=%s >expect &&
 	test_cmp expect actual &&
 
@@ -134,7 +134,7 @@ test_expect_success 'push with file:// using protocol v1' '
 	test_commit -C file_child three &&
 
 	# Push to another branch, as the target repository has the
-	# master branch checked out and we cannot push into it.
+	# main branch checked out and we cannot push into it.
 	GIT_TRACE_PACKET=1 git -C file_child -c protocol.version=1 \
 		push origin HEAD:client_branch 2>log &&
 
@@ -188,7 +188,7 @@ test_expect_success 'fetch with ssh:// using protocol v1' '
 		fetch 2>log &&
 	expect_ssh git-upload-pack &&
 
-	git -C ssh_child log -1 --format=%s origin/master >actual &&
+	git -C ssh_child log -1 --format=%s origin/main >actual &&
 	git -C ssh_parent log -1 --format=%s >expect &&
 	test_cmp expect actual &&
 
@@ -213,7 +213,7 @@ test_expect_success 'push with ssh:// using protocol v1' '
 	test_commit -C ssh_child three &&
 
 	# Push to another branch, as the target repository has the
-	# master branch checked out and we cannot push into it.
+	# main branch checked out and we cannot push into it.
 	GIT_TRACE_PACKET=1 git -C ssh_child -c protocol.version=1 \
 		push origin HEAD:client_branch 2>log &&
 	expect_ssh git-receive-pack &&
@@ -257,7 +257,7 @@ test_expect_success 'fetch with http:// using protocol v1' '
 	GIT_TRACE_PACKET=1 git -C http_child -c protocol.version=1 \
 		fetch 2>log &&
 
-	git -C http_child log -1 --format=%s origin/master >actual &&
+	git -C http_child log -1 --format=%s origin/main >actual &&
 	git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" log -1 --format=%s >expect &&
 	test_cmp expect actual &&
 
@@ -281,7 +281,7 @@ test_expect_success 'push with http:// using protocol v1' '
 	test_commit -C http_child three &&
 
 	# Push to another branch, as the target repository has the
-	# master branch checked out and we cannot push into it.
+	# main branch checked out and we cannot push into it.
 	GIT_TRACE_PACKET=1 git -C http_child -c protocol.version=1 \
 		push origin HEAD:client_branch && #2>log &&
 
t/t5701-git-serve.sh +8 -8
index a1f5fdc9fd..3a04a56c2c 100755
@@ -83,9 +83,9 @@ test_expect_success 'wrong object-format' '
 #
 test_expect_success 'setup some refs and tags' '
 	test_commit one &&
-	git branch dev master &&
+	git branch dev main &&
 	test_commit two &&
-	git symbolic-ref refs/heads/release refs/heads/master &&
+	git symbolic-ref refs/heads/release refs/heads/main &&
 	git tag -a -m "annotated tag" annotated-tag
 '
 
@@ -99,7 +99,7 @@ test_expect_success 'basics of ls-refs' '
 	cat >expect <<-EOF &&
 	$(git rev-parse HEAD) HEAD
 	$(git rev-parse refs/heads/dev) refs/heads/dev
-	$(git rev-parse refs/heads/master) refs/heads/master
+	$(git rev-parse refs/heads/main) refs/heads/main
 	$(git rev-parse refs/heads/release) refs/heads/release
 	$(git rev-parse refs/tags/annotated-tag) refs/tags/annotated-tag
 	$(git rev-parse refs/tags/one) refs/tags/one
@@ -117,13 +117,13 @@ test_expect_success 'basic ref-prefixes' '
 	command=ls-refs
 	object-format=$(test_oid algo)
 	0001
-	ref-prefix refs/heads/master
+	ref-prefix refs/heads/main
 	ref-prefix refs/tags/one
 	0000
 	EOF
 
 	cat >expect <<-EOF &&
-	$(git rev-parse refs/heads/master) refs/heads/master
+	$(git rev-parse refs/heads/main) refs/heads/main
 	$(git rev-parse refs/tags/one) refs/tags/one
 	0000
 	EOF
@@ -144,7 +144,7 @@ test_expect_success 'refs/heads prefix' '
 
 	cat >expect <<-EOF &&
 	$(git rev-parse refs/heads/dev) refs/heads/dev
-	$(git rev-parse refs/heads/master) refs/heads/master
+	$(git rev-parse refs/heads/main) refs/heads/main
 	$(git rev-parse refs/heads/release) refs/heads/release
 	0000
 	EOF
@@ -188,8 +188,8 @@ test_expect_success 'symrefs parameter' '
 
 	cat >expect <<-EOF &&
 	$(git rev-parse refs/heads/dev) refs/heads/dev
-	$(git rev-parse refs/heads/master) refs/heads/master
-	$(git rev-parse refs/heads/release) refs/heads/release symref-target:refs/heads/master
+	$(git rev-parse refs/heads/main) refs/heads/main
+	$(git rev-parse refs/heads/release) refs/heads/release symref-target:refs/heads/main
 	0000
 	EOF
 
t/t5702-protocol-v2.sh +25 -25

172 lines not on this page · raw message

t/t5703-upload-pack-ref-in-want.sh +29 -29

171 lines not on this page · raw message

t/t5801-remote-helpers.sh +12 -12
index 0f04b6cddb..306fe9e5e1 100755
@@ -71,18 +71,18 @@ test_expect_success 'fetch multiple branches' '
 	(cd local &&
 	 git fetch
 	) &&
-	compare_refs server master local refs/remotes/origin/master &&
+	compare_refs server main local refs/remotes/origin/main &&
 	compare_refs server new local refs/remotes/origin/new
 '
 
 test_expect_success 'push when remote has extra refs' '
 	(cd local &&
-	 git reset --hard origin/master &&
+	 git reset --hard origin/main &&
 	 echo content >>file &&
 	 git commit -a -m six &&
 	 git push
 	) &&
-	compare_refs local master server master
+	compare_refs local main server main
 '
 
 test_expect_success 'push new branch by name' '
@@ -174,7 +174,7 @@ test_expect_failure 'pushing without marks' '
 
 test_expect_success 'push all with existing object' '
 	(cd local &&
-	git branch dup2 master &&
+	git branch dup2 main &&
 	git push origin --all
 	) &&
 	compare_refs local dup2 server dup2
@@ -182,7 +182,7 @@ test_expect_success 'push all with existing object' '
 
 test_expect_success 'push ref with existing object' '
 	(cd local &&
-	git branch dup master &&
+	git branch dup main &&
 	git push origin dup
 	) &&
 	compare_refs local dup server dup
@@ -190,7 +190,7 @@ test_expect_success 'push ref with existing object' '
 
 test_expect_success GPG 'push signed tag' '
 	(cd local &&
-	git checkout master &&
+	git checkout main &&
 	git tag -s -m signed-tag signed-tag &&
 	git push origin signed-tag
 	) &&
@@ -200,7 +200,7 @@ test_expect_success GPG 'push signed tag' '
 
 test_expect_success GPG 'push signed tag with signed-tags capability' '
 	(cd local &&
-	git checkout master &&
+	git checkout main &&
 	git tag -s -m signed-tag signed-tag-2 &&
 	GIT_REMOTE_TESTGIT_SIGNED_TAGS=1 git push origin signed-tag-2
 	) &&
@@ -209,7 +209,7 @@ test_expect_success GPG 'push signed tag with signed-tags capability' '
 
 test_expect_success 'push update refs' '
 	(cd local &&
-	git checkout -b update master &&
+	git checkout -b update main &&
 	echo update >>file &&
 	git commit -a -m update &&
 	git push origin update &&
@@ -260,7 +260,7 @@ test_expect_success 'proper failure checks for fetching' '
 test_expect_success 'proper failure checks for pushing' '
 	test_when_finished "rm -rf local/git.marks local/testgit.marks" &&
 	(cd local &&
-	git checkout -b crash master &&
+	git checkout -b crash main &&
 	echo crash >>file &&
 	git commit -a -m crash &&
 	test_must_fail env GIT_REMOTE_TESTGIT_FAILURE=1 git push --all &&
@@ -272,7 +272,7 @@ test_expect_success 'proper failure checks for pushing' '
 
 test_expect_success 'push messages' '
 	(cd local &&
-	git checkout -b new_branch master &&
+	git checkout -b new_branch main &&
 	echo new >>file &&
 	git commit -a -m new &&
 	git push origin new_branch &&
@@ -286,7 +286,7 @@ test_expect_success 'push messages' '
 
 test_expect_success 'fetch HEAD' '
 	(cd server &&
-	git checkout master &&
+	git checkout main &&
 	echo more >>file &&
 	git commit -a -m more
 	) &&
@@ -298,7 +298,7 @@ test_expect_success 'fetch HEAD' '
 
 test_expect_success 'fetch url' '
 	(cd server &&
-	git checkout master &&
+	git checkout main &&
 	echo more >>file &&
 	git commit -a -m more
 	) &&
t/test-lib.sh +1 -1
index f919021063..a78ff1e57e 100644
@@ -263,7 +263,7 @@ case "$TEST_NUMBER" in
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
-[0-4]*|5[0-5]*)
+[0-5]*)
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
Signature · 1 line
gitgitgadget
#12 lore raw

PATCH 12/28 t550*: adjust the references to the default branch name "main"

In reply to Johannes Schindelin via GitGitGadget

From: Johannes Schindelin <[email protected]>

This trick was performed via

	$ (cd t &&
	   sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
		-e 's/Master/Main/g' -- t550*.sh)

This allows us to define GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main for those tests.

---
 t/t5500-fetch-pack.sh            |  28 +++----
 t/t5501-fetch-push-alternates.sh |   4 +-
 t/t5502-quickfetch.sh            |   6 +-
 t/t5503-tagfollow.sh             |  12 +--
 t/t5504-fetch-receive-strict.sh  |  20 ++---
 t/t5505-remote.sh                | 140 +++++++++++++++----------------
 t/t5506-remote-groups.sh         |   4 +-
 t/t5509-fetch-push-namespaces.sh |  30 +++----
 t/test-lib.sh                    |   2 +-
 9 files changed, 123 insertions(+), 123 deletions(-)
t/t5500-fetch-pack.sh +14 -14
index 3557374312..70e41ada01 100755
@@ -407,14 +407,14 @@ test_expect_success 'in_vain resetted upon ACK' '
 	rm -rf myserver myclient &&
 	git init myserver &&
 
-	# Linked list of commits on master. The first is common; the rest are
+	# Linked list of commits on main. The first is common; the rest are
 	# not.
-	test_commit -C myserver first_master_commit &&
+	test_commit -C myserver first_main_commit &&
 	git clone "file://$(pwd)/myserver" myclient &&
 	test_commit_bulk -C myclient 255 &&
 
 	# Another linked list of commits on anotherbranch with no connection to
-	# master. The first is common; the rest are not.
+	# main. The first is common; the rest are not.
 	git -C myserver checkout --orphan anotherbranch &&
 	test_commit -C myserver first_anotherbranch_commit &&
 	git -C myclient fetch origin anotherbranch:refs/heads/anotherbranch &&
@@ -422,14 +422,14 @@ test_expect_success 'in_vain resetted upon ACK' '
 	test_commit_bulk -C myclient 255 &&
 
 	# The new commit that the client wants to fetch.
-	git -C myserver checkout master &&
+	git -C myserver checkout main &&
 	test_commit -C myserver to_fetch &&
 
 	# The client will send (as "have"s) all 256 commits in anotherbranch
 	# first. The 256th commit is common between the client and the server,
 	# and should reset in_vain. This allows negotiation to continue until
 	# the client reports that first_anotherbranch_commit is common.
-	git -C myclient fetch --progress origin master 2>log &&
+	git -C myclient fetch --progress origin main 2>log &&
 	test_i18ngrep "Total 3 " log
 '
 
@@ -637,7 +637,7 @@ test_expect_success 'shallow fetch with tags does not break the repository' '
 		mkdir repo2 &&
 		cd repo2 &&
 		git init &&
-		git fetch --depth=2 ../.git master:branch &&
+		git fetch --depth=2 ../.git main:branch &&
 		git fsck
 	)
 '
@@ -662,7 +662,7 @@ test_expect_success 'fetch-pack can fetch a raw sha1 that is advertised as a ref
 
 	git init client &&
 	git -C client fetch-pack ../server \
-		$(git -C server rev-parse refs/heads/master)
+		$(git -C server rev-parse refs/heads/main)
 '
 
 test_expect_success 'fetch-pack can fetch a raw sha1 overlapping a named ref' '
@@ -688,7 +688,7 @@ test_expect_success 'fetch-pack cannot fetch a raw sha1 that is not advertised a
 	# Some protocol versions (e.g. 2) support fetching
 	# unadvertised objects, so restrict this test to v0.
 	test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 git -C client fetch-pack ../server \
-		$(git -C server rev-parse refs/heads/master^) 2>err &&
+		$(git -C server rev-parse refs/heads/main^) 2>err &&
 	test_i18ngrep "Server does not allow request for unadvertised object" err
 '
 
@@ -822,7 +822,7 @@ test_expect_success 'clone shallow since ...' '
 
 test_expect_success 'fetch shallow since ...' '
 	git -C shallow11 fetch --shallow-since "200000000 +0700" origin &&
-	git -C shallow11 log --pretty=tformat:%s origin/master >actual &&
+	git -C shallow11 log --pretty=tformat:%s origin/main >actual &&
 	cat >expected <<-\EOF &&
 	three
 	two
@@ -863,7 +863,7 @@ test_expect_success 'shallow since with commit graph and already-seen commit' '
 	(
 	cd shallow-since-graph &&
 	test_commit base &&
-	test_commit master &&
+	test_commit main &&
 	git checkout -b other HEAD^ &&
 	test_commit other &&
 	git commit-graph write --reachable &&
@@ -874,7 +874,7 @@ test_expect_success 'shallow since with commit graph and already-seen commit' '
 	$(echo "object-format=$(test_oid algo)" | packetize)
 	00010013deepen-since 1
 	$(echo "want $(git rev-parse other)" | packetize)
-	$(echo "have $(git rev-parse master)" | packetize)
+	$(echo "have $(git rev-parse main)" | packetize)
 	0000
 	EOF
 	)
@@ -896,7 +896,7 @@ test_expect_success 'shallow clone exclude tag two' '
 
 test_expect_success 'fetch exclude tag one' '
 	git -C shallow12 fetch --shallow-exclude one origin &&
-	git -C shallow12 log --pretty=tformat:%s origin/master >actual &&
+	git -C shallow12 log --pretty=tformat:%s origin/main >actual &&
 	test_write_lines three two >expected &&
 	test_cmp expected actual
 '
@@ -910,11 +910,11 @@ test_expect_success 'fetching deepen' '
 	test_commit three &&
 	git clone --depth 1 "file://$(pwd)/." deepen &&
 	test_commit four &&
-	git -C deepen log --pretty=tformat:%s master >actual &&
+	git -C deepen log --pretty=tformat:%s main >actual &&
 	echo three >expected &&
 	test_cmp expected actual &&
 	git -C deepen fetch --deepen=1 &&
-	git -C deepen log --pretty=tformat:%s origin/master >actual &&
+	git -C deepen log --pretty=tformat:%s origin/main >actual &&
 	cat >expected <<-\EOF &&
 	four
 	three
t/t5501-fetch-push-alternates.sh +2 -2
index 1bc57ac03f..0054163ce4 100755
@@ -45,7 +45,7 @@ test_expect_success setup '
 test_expect_success 'pushing into a repository with the same alternate' '
 	(
 		cd one &&
-		git push ../receiver master:refs/heads/it
+		git push ../receiver main:refs/heads/it
 	) &&
 	(
 		cd receiver &&
@@ -57,7 +57,7 @@ test_expect_success 'pushing into a repository with the same alternate' '
 test_expect_success 'fetching from a repository with the same alternate' '
 	(
 		cd fetcher &&
-		git fetch ../one master:refs/heads/it &&
+		git fetch ../one main:refs/heads/it &&
 		count_objects >../fetcher.count
 	) &&
 	test_cmp one.count fetcher.count
t/t5502-quickfetch.sh +3 -3
index 7a46cbdbe6..b163787a05 100755
@@ -108,14 +108,14 @@ test_expect_success 'quickfetch should not copy from alternate' '
 				q
 			}"
 	) ) &&
-	origin_master=$( (
+	origin_main=$( (
 		cd quickclone &&
-		git rev-parse origin/master
+		git rev-parse origin/main
 	) ) &&
 	echo "loose objects: $obj_cnt, packfiles: $pck_cnt" &&
 	test $obj_cnt -eq 0 &&
 	test $pck_cnt -eq 0 &&
-	test z$origin_master = z$(git rev-parse master)
+	test z$origin_main = z$(git rev-parse main)
 
 '
 
t/t5503-tagfollow.sh +6 -6
index 6dafbe4543..b3e5f810e0 100755
@@ -11,7 +11,7 @@ test_description='test automatic tag following'
 #   L - A ------ O ------ B
 #    \   \                 \
 #     \   C - origin/cat    \
-#      origin/master           master
+#      origin/main           main
 
 test_expect_success setup '
 	test_tick &&
@@ -57,7 +57,7 @@ test_expect_success 'fetch A (new commit : 1 connection)' '
 	(
 		cd cloned &&
 		GIT_TRACE_PACKET=$UPATH git fetch &&
-		test $A = $(git rev-parse --verify origin/master)
+		test $A = $(git rev-parse --verify origin/main)
 	) &&
 	get_needs $U >actual &&
 	test_cmp expect actual
@@ -72,7 +72,7 @@ test_expect_success "create tag T on A, create C on branch cat" '
 	git add file &&
 	git commit -m C &&
 	C=$(git rev-parse --verify HEAD) &&
-	git checkout master
+	git checkout main
 '
 
 test_expect_success 'setup expect' '
@@ -123,7 +123,7 @@ test_expect_success 'fetch B, S (commit and tag : 1 connection)' '
 	(
 		cd cloned &&
 		GIT_TRACE_PACKET=$UPATH git fetch &&
-		test $B = $(git rev-parse --verify origin/master) &&
+		test $B = $(git rev-parse --verify origin/main) &&
 		test $B = $(git rev-parse --verify tag2^0) &&
 		test $S = $(git rev-parse --verify tag2)
 	) &&
@@ -138,7 +138,7 @@ want $S
 EOF
 '
 
-test_expect_success 'new clone fetch master and tags' '
+test_expect_success 'new clone fetch main and tags' '
 	test_might_fail git branch -D cat &&
 	rm -f $U &&
 	(
@@ -147,7 +147,7 @@ test_expect_success 'new clone fetch master and tags' '
 		git init &&
 		git remote add origin .. &&
 		GIT_TRACE_PACKET=$UPATH git fetch &&
-		test $B = $(git rev-parse --verify origin/master) &&
+		test $B = $(git rev-parse --verify origin/main) &&
 		test $S = $(git rev-parse --verify tag2) &&
 		test $B = $(git rev-parse --verify tag2^0) &&
 		test $T = $(git rev-parse --verify tag1) &&
t/t5504-fetch-receive-strict.sh +10 -10
index 1a16ac4c0d..d2ba19ce68 100755
@@ -25,7 +25,7 @@ test_expect_success 'fetch without strict' '
 		cd dst &&
 		git config fetch.fsckobjects false &&
 		git config transfer.fsckobjects false &&
-		test_must_fail git fetch ../.git master
+		test_must_fail git fetch ../.git main
 	)
 '
 
@@ -36,7 +36,7 @@ test_expect_success 'fetch with !fetch.fsckobjects' '
 		cd dst &&
 		git config fetch.fsckobjects false &&
 		git config transfer.fsckobjects true &&
-		test_must_fail git fetch ../.git master
+		test_must_fail git fetch ../.git main
 	)
 '
 
@@ -47,7 +47,7 @@ test_expect_success 'fetch with fetch.fsckobjects' '
 		cd dst &&
 		git config fetch.fsckobjects true &&
 		git config transfer.fsckobjects false &&
-		test_must_fail git fetch ../.git master
+		test_must_fail git fetch ../.git main
 	)
 '
 
@@ -57,13 +57,13 @@ test_expect_success 'fetch with transfer.fsckobjects' '
 	(
 		cd dst &&
 		git config transfer.fsckobjects true &&
-		test_must_fail git fetch ../.git master
+		test_must_fail git fetch ../.git main
 	)
 '
 
 cat >exp <<EOF
 To dst
-!	refs/heads/master:refs/heads/test	[remote rejected] (missing necessary objects)
+!	refs/heads/main:refs/heads/test	[remote rejected] (missing necessary objects)
 Done
 EOF
 
@@ -75,7 +75,7 @@ test_expect_success 'push without strict' '
 		git config fetch.fsckobjects false &&
 		git config transfer.fsckobjects false
 	) &&
-	test_must_fail git push --porcelain dst master:refs/heads/test >act &&
+	test_must_fail git push --porcelain dst main:refs/heads/test >act &&
 	test_cmp exp act
 '
 
@@ -87,13 +87,13 @@ test_expect_success 'push with !receive.fsckobjects' '
 		git config receive.fsckobjects false &&
 		git config transfer.fsckobjects true
 	) &&
-	test_must_fail git push --porcelain dst master:refs/heads/test >act &&
+	test_must_fail git push --porcelain dst main:refs/heads/test >act &&
 	test_cmp exp act
 '
 
 cat >exp <<EOF
 To dst
-!	refs/heads/master:refs/heads/test	[remote rejected] (unpacker error)
+!	refs/heads/main:refs/heads/test	[remote rejected] (unpacker error)
 EOF
 
 test_expect_success 'push with receive.fsckobjects' '
@@ -104,7 +104,7 @@ test_expect_success 'push with receive.fsckobjects' '
 		git config receive.fsckobjects true &&
 		git config transfer.fsckobjects false
 	) &&
-	test_must_fail git push --porcelain dst master:refs/heads/test >act &&
+	test_must_fail git push --porcelain dst main:refs/heads/test >act &&
 	test_cmp exp act
 '
 
@@ -115,7 +115,7 @@ test_expect_success 'push with transfer.fsckobjects' '
 		cd dst &&
 		git config transfer.fsckobjects true
 	) &&
-	test_must_fail git push --porcelain dst master:refs/heads/test >act &&
+	test_must_fail git push --porcelain dst main:refs/heads/test >act &&
 	test_cmp exp act
 '
 
t/t5505-remote.sh +70 -70

430 lines not on this page · raw message

t/t5506-remote-groups.sh +2 -2
index 83d5558c0e..f2df3944e0 100755
@@ -31,8 +31,8 @@ repo_fetched() {
 test_expect_success 'setup' '
 	mkdir one && (cd one && git init) &&
 	mkdir two && (cd two && git init) &&
-	git remote add -m master one one &&
-	git remote add -m master two two
+	git remote add -m main one one &&
+	git remote add -m main two two
 '
 
 test_expect_success 'no group updates all' '
t/t5509-fetch-push-namespaces.sh +15 -15
index a67f792adf..ad4a3f5c6e 100755
@@ -27,9 +27,9 @@ test_expect_success setup '
 test_expect_success 'pushing into a repository using a ref namespace' '
 	(
 		cd original &&
-		git push pushee-namespaced master &&
+		git push pushee-namespaced main &&
 		git ls-remote pushee-namespaced >actual &&
-		printf "$commit1\trefs/heads/master\n" >expected &&
+		printf "$commit1\trefs/heads/main\n" >expected &&
 		test_cmp expected actual &&
 		git push pushee-namespaced --tags &&
 		git ls-remote pushee-namespaced >actual &&
@@ -56,7 +56,7 @@ test_expect_success 'pulling from a repository using a ref namespace' '
 		cd puller &&
 		git remote add -f pushee-namespaced "ext::git --namespace=namespace %s ../pushee" &&
 		git for-each-ref refs/ >actual &&
-		printf "$commit1 commit\trefs/remotes/pushee-namespaced/master\n" >expected &&
+		printf "$commit1 commit\trefs/remotes/pushee-namespaced/main\n" >expected &&
 		printf "$commit0 commit\trefs/tags/0\n" >>expected &&
 		printf "$commit1 commit\trefs/tags/1\n" >>expected &&
 		test_cmp expected actual
@@ -76,7 +76,7 @@ test_expect_success 'mirroring a repository using a ref namespace' '
 	(
 		cd mirror &&
 		git for-each-ref refs/ >actual &&
-		printf "$commit1 commit\trefs/namespaces/namespace/refs/heads/master\n" >expected &&
+		printf "$commit1 commit\trefs/namespaces/namespace/refs/heads/main\n" >expected &&
 		printf "$commit0 commit\trefs/namespaces/namespace/refs/tags/0\n" >>expected &&
 		printf "$commit1 commit\trefs/namespaces/namespace/refs/tags/1\n" >>expected &&
 		test_cmp expected actual
@@ -87,7 +87,7 @@ test_expect_success 'hide namespaced refs with transfer.hideRefs' '
 	GIT_NAMESPACE=namespace \
 		git -C pushee -c transfer.hideRefs=refs/tags \
 		ls-remote "ext::git %s ." >actual &&
-	printf "$commit1\trefs/heads/master\n" >expected &&
+	printf "$commit1\trefs/heads/main\n" >expected &&
 	test_cmp expected actual
 '
 
@@ -95,7 +95,7 @@ test_expect_success 'check that transfer.hideRefs does not match unstripped refs
 	GIT_NAMESPACE=namespace \
 		git -C pushee -c transfer.hideRefs=refs/namespaces/namespace/refs/tags \
 		ls-remote "ext::git %s ." >actual &&
-	printf "$commit1\trefs/heads/master\n" >expected &&
+	printf "$commit1\trefs/heads/main\n" >expected &&
 	printf "$commit0\trefs/tags/0\n" >>expected &&
 	printf "$commit1\trefs/tags/1\n" >>expected &&
 	test_cmp expected actual
@@ -105,23 +105,23 @@ test_expect_success 'hide full refs with transfer.hideRefs' '
 	GIT_NAMESPACE=namespace \
 		git -C pushee -c transfer.hideRefs="^refs/namespaces/namespace/refs/tags" \
 		ls-remote "ext::git %s ." >actual &&
-	printf "$commit1\trefs/heads/master\n" >expected &&
+	printf "$commit1\trefs/heads/main\n" >expected &&
 	test_cmp expected actual
 '
 
 test_expect_success 'try to update a hidden ref' '
-	test_config -C pushee transfer.hideRefs refs/heads/master &&
-	test_must_fail git -C original push pushee-namespaced master
+	test_config -C pushee transfer.hideRefs refs/heads/main &&
+	test_must_fail git -C original push pushee-namespaced main
 '
 
 test_expect_success 'try to update a ref that is not hidden' '
-	test_config -C pushee transfer.hideRefs refs/namespaces/namespace/refs/heads/master &&
-	git -C original push pushee-namespaced master
+	test_config -C pushee transfer.hideRefs refs/namespaces/namespace/refs/heads/main &&
+	git -C original push pushee-namespaced main
 '
 
 test_expect_success 'try to update a hidden full ref' '
-	test_config -C pushee transfer.hideRefs "^refs/namespaces/namespace/refs/heads/master" &&
-	test_must_fail git -C original push pushee-namespaced master
+	test_config -C pushee transfer.hideRefs "^refs/namespaces/namespace/refs/heads/main" &&
+	test_must_fail git -C original push pushee-namespaced main
 '
 
 test_expect_success 'set up ambiguous HEAD' '
@@ -157,9 +157,9 @@ test_expect_success 'denyCurrentBranch and unborn branch with ref namespace' '
 		cd original &&
 		git init unborn &&
 		git remote add unborn-namespaced "ext::git --namespace=namespace %s unborn" &&
-		test_must_fail git push unborn-namespaced HEAD:master &&
+		test_must_fail git push unborn-namespaced HEAD:main &&
 		git -C unborn config receive.denyCurrentBranch updateInstead &&
-		git push unborn-namespaced HEAD:master
+		git push unborn-namespaced HEAD:main
 	)
 '
 
t/test-lib.sh +1 -1
index 155bfad454..ca86f666e6 100644
@@ -263,7 +263,7 @@ case "$TEST_NUMBER" in
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
-[0-4]*|5[0-4]*)
+[0-4]*|5[0-4]*|550*)
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
Signature · 1 line
gitgitgadget
#25 lore raw

PATCH 22/28 t8*: adjust the references to the default branch name "main"

In reply to Johannes Schindelin via GitGitGadget

From: Johannes Schindelin <[email protected]>

This trick was performed via

	$ (cd t &&
	   sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
		-e 's/Master/Main/g' -- t8*.sh annotate*.sh)

This allows us to define GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main for those tests.

---
 t/annotate-tests.sh             |  8 ++++----
 t/t8001-annotate.sh             |  2 +-
 t/t8003-blame-corner-cases.sh   |  4 ++--
 t/t8004-blame-with-conflicts.sh | 14 +++++++-------
 t/test-lib.sh                   |  2 +-
 5 files changed, 15 insertions(+), 15 deletions(-)
t/annotate-tests.sh +4 -4
index 3aee61d2cc..ee5d2d4cf8 100644
@@ -95,7 +95,7 @@ test_expect_success 'blame 2 authors' '
 '
 
 test_expect_success 'setup B1 lines (branch1)' '
-	git checkout -b branch1 master &&
+	git checkout -b branch1 main &&
 	echo "3A slow green fox jumps into the" >>file &&
 	echo "well." >>file &&
 	GIT_AUTHOR_NAME="B1" GIT_AUTHOR_EMAIL="[email protected]" \
@@ -107,7 +107,7 @@ test_expect_success 'blame 2 authors + 1 branch1 author' '
 '
 
 test_expect_success 'setup B2 lines (branch2)' '
-	git checkout -b branch2 master &&
+	git checkout -b branch2 main &&
 	sed -e "s/2A quick brown/4A quick brown lazy dog/" <file >file.new &&
 	mv file.new file &&
 	GIT_AUTHOR_NAME="B2" GIT_AUTHOR_EMAIL="[email protected]" \
@@ -131,11 +131,11 @@ test_expect_success 'blame --first-parent blames merge for branch1' '
 '
 
 test_expect_success 'blame ancestor' '
-	check_count -h master A 2 B 2
+	check_count -h main A 2 B 2
 '
 
 test_expect_success 'blame great-ancestor' '
-	check_count -h master^ A 2
+	check_count -h main^ A 2
 '
 
 test_expect_success 'setup evil merge' '
t/t8001-annotate.sh +1 -1
index 72176e42c1..3687fc58d8 100755
@@ -7,7 +7,7 @@ PROG='git annotate'
 . "$TEST_DIRECTORY"/annotate-tests.sh
 
 test_expect_success 'annotate old revision' '
-	git annotate file master >actual &&
+	git annotate file main >actual &&
 	awk "{ print \$3; }" <actual >authors &&
 	test 2 = $(grep A <authors | wc -l) &&
 	test 2 = $(grep B <authors | wc -l)
t/t8003-blame-corner-cases.sh +2 -2
index ba8013b002..2e499b4511 100755
@@ -161,13 +161,13 @@ test_expect_success 'blame wholesale copy and more in the index' '
 
 test_expect_success 'blame during cherry-pick with file rename conflict' '
 
-	test_when_finished "git reset --hard && git checkout master" &&
+	test_when_finished "git reset --hard && git checkout main" &&
 	git checkout HEAD~3 &&
 	echo MOUSE >> mouse &&
 	git mv mouse rodent &&
 	git add rodent &&
 	GIT_AUTHOR_NAME=Rodent git commit -m "rodent" &&
-	git checkout --detach master &&
+	git checkout --detach main &&
 	(git cherry-pick HEAD@{1} || test $? -eq 1) &&
 	git show HEAD@{1}:rodent > rodent &&
 	git add rodent &&
t/t8004-blame-with-conflicts.sh +7 -7
index 9c353ab222..b6c992ec45 100755
@@ -21,16 +21,16 @@ test_expect_success 'setup first case' '
 	git add file2 &&
 	git commit --author "U Gly <ug@localhost>" -m ugly &&
 
-	# Back to master and change something
-	git checkout master &&
+	# Back to main and change something
+	git checkout main &&
 	echo "
 
 bla" >> file1 &&
 	git commit --author "Old Line <ol@localhost>" -a -m file1.b &&
 
-	# Back to foo and merge master
+	# Back to foo and merge main
 	git checkout foo &&
-	if git merge master; then
+	if git merge main; then
 		echo needed conflict here
 		exit 1
 	else
@@ -44,8 +44,8 @@ Even more" > file2 &&
 	git rm file1 &&
 	git commit --author "M Result <mr@localhost>" -a -m merged &&
 
-	# Back to master and change file1 again
-	git checkout master &&
+	# Back to main and change file1 again
+	git checkout main &&
 	sed s/bla/foo/ <file1 >X &&
 	rm file1 &&
 	mv X file1 &&
@@ -53,7 +53,7 @@ Even more" > file2 &&
 
 	# Try to merge into foo again
 	git checkout foo &&
-	if git merge master; then
+	if git merge main; then
 		echo needed conflict here
 		exit 1
 	else
t/test-lib.sh +1 -1
index 2ef51a4f3f..4ddfb9e3ee 100644
@@ -263,7 +263,7 @@ case "$TEST_NUMBER" in
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
-[0-7]*)
+[0-8]*)
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
Signature · 1 line
gitgitgadget
#27 lore raw

PATCH 24/28 t9[5-7]*: adjust the references to the default branch name "main"

In reply to Johannes Schindelin via GitGitGadget

From: Johannes Schindelin <[email protected]>

This trick was performed via

	$ (cd t &&
	   sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
		-e 's/Master/Main/g' -- t9[5-7]*.sh lib-cvs.sh)

This allows us to define GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main for those tests.

---
 t/lib-cvs.sh                              |  2 +-
 t/t9500-gitweb-standalone-no-errors.sh    | 20 ++++++++++----------
 t/t9501-gitweb-standalone-http-status.sh  | 14 +++++++-------
 t/t9502-gitweb-standalone-parse-output.sh | 16 ++++++++--------
 t/t9600-cvsimport.sh                      |  2 +-
 t/t9601-cvsimport-vendor-branch.sh        | 16 ++++++++--------
 t/t9602-cvsimport-branches-tags.sh        |  4 ++--
 t/t9603-cvsimport-patchsets.sh            |  8 ++++----
 t/test-lib.sh                             |  2 +-
 9 files changed, 42 insertions(+), 42 deletions(-)
t/lib-cvs.sh +1 -1
index 9b2bcfb1b0..32b3473379 100644
@@ -36,7 +36,7 @@ setup_cvs_test_repository () {
 test_cvs_co () {
 	# Usage: test_cvs_co BRANCH_NAME
 	rm -rf module-cvs-"$1"
-	if [ "$1" = "master" ]
+	if [ "$1" = "main" ]
 	then
 		$CVS co -P -d module-cvs-"$1" -A module
 	else
t/t9500-gitweb-standalone-no-errors.sh +10 -10
index b484e3e250..452470ff3b 100755
@@ -327,7 +327,7 @@ test_expect_success \
 	 echo "Branch" >>b &&
 	 git add b &&
 	 git commit -a -m "On branch" &&
-	 git checkout master &&
+	 git checkout main &&
 	 git merge b &&
 	 git tag merge_commit'
 
@@ -364,7 +364,7 @@ test_expect_success \
 	 echo "Changed and have mode changed" >07-change-mode-change &&
 	 test_chmod +x 07-change-mode-change &&
 	 git commit -a -m "Large commit" &&
-	 git checkout master'
+	 git checkout main'
 
 test_expect_success \
 	'commit(1): large commit' \
@@ -402,7 +402,7 @@ test_expect_success 'side-by-side: merge commit' '
 
 test_expect_success \
 	'tags: list of different types of tags' \
-	'git checkout master &&
+	'git checkout main &&
 	 git tag -a -m "Tag commit object" tag-commit HEAD &&
 	 git tag -a -m "" tag-commit-nomessage HEAD &&
 	 git tag -a -m "Tag tag object" tag-tag tag-commit &&
@@ -443,7 +443,7 @@ test_expect_success \
 
 test_expect_success \
 	'logs: history (implicit HEAD, deleted file)' \
-	'git checkout master &&
+	'git checkout main &&
 	 echo "to be deleted" >deleted_file &&
 	 git add deleted_file &&
 	 git commit -m "Add file to be deleted" &&
@@ -463,11 +463,11 @@ test_expect_success \
 
 test_expect_success \
 	'path_info: project/branch:file' \
-	'gitweb_run "" "/.git/master:file"'
+	'gitweb_run "" "/.git/main:file"'
 
 test_expect_success \
 	'path_info: project/branch:dir/' \
-	'gitweb_run "" "/.git/master:foo/"'
+	'gitweb_run "" "/.git/main:foo/"'
 
 test_expect_success \
 	'path_info: project/branch (non-existent)' \
@@ -479,16 +479,16 @@ test_expect_success \
 
 test_expect_success \
 	'path_info: project/branch:file (non-existent)' \
-	'gitweb_run "" "/.git/master:non-existent"'
+	'gitweb_run "" "/.git/main:non-existent"'
 
 test_expect_success \
 	'path_info: project/branch:dir/ (non-existent)' \
-	'gitweb_run "" "/.git/master:non-existent/"'
+	'gitweb_run "" "/.git/main:non-existent/"'
 
 
 test_expect_success \
 	'path_info: project/branch:/file' \
-	'gitweb_run "" "/.git/master:/file"'
+	'gitweb_run "" "/.git/main:/file"'
 
 test_expect_success \
 	'path_info: project/:/file (implicit HEAD)' \
@@ -801,7 +801,7 @@ test_expect_success \
 		git checkout orphan_branch ||
 		git checkout --orphan orphan_branch
 	 } &&
-	 test_when_finished "git checkout master" &&
+	 test_when_finished "git checkout main" &&
 	 gitweb_run "p=.git;a=summary"'
 
 test_done
t/t9501-gitweb-standalone-http-status.sh +7 -7
index 2a0ffed870..16f98ab54e 100755
@@ -85,7 +85,7 @@ test_debug 'cat gitweb.headers'
 # snapshot hash ids
 
 test_expect_success 'snapshots: good tree-ish id' '
-	gitweb_run "p=.git;a=snapshot;h=master;sf=tgz" &&
+	gitweb_run "p=.git;a=snapshot;h=main;sf=tgz" &&
 	grep "Status: 200 OK" gitweb.output
 '
 test_debug 'cat gitweb.headers'
@@ -123,7 +123,7 @@ test_debug 'cat gitweb.output'
 # modification times (Last-Modified and If-Modified-Since)
 
 test_expect_success DATE_PARSER 'modification: feed last-modified' '
-	gitweb_run "p=.git;a=atom;h=master" &&
+	gitweb_run "p=.git;a=atom;h=main" &&
 	grep "Status: 200 OK" gitweb.headers &&
 	grep "Last-modified: Thu, 7 Apr 2005 22:14:13 +0000" gitweb.headers
 '
@@ -133,7 +133,7 @@ test_expect_success DATE_PARSER 'modification: feed if-modified-since (modified)
 	HTTP_IF_MODIFIED_SINCE="Wed, 6 Apr 2005 22:14:13 +0000" &&
 	export HTTP_IF_MODIFIED_SINCE &&
 	test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&
-	gitweb_run "p=.git;a=atom;h=master" &&
+	gitweb_run "p=.git;a=atom;h=main" &&
 	grep "Status: 200 OK" gitweb.headers
 '
 test_debug 'cat gitweb.headers'
@@ -142,13 +142,13 @@ test_expect_success DATE_PARSER 'modification: feed if-modified-since (unmodifie
 	HTTP_IF_MODIFIED_SINCE="Thu, 7 Apr 2005 22:14:13 +0000" &&
 	export HTTP_IF_MODIFIED_SINCE &&
 	test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&
-	gitweb_run "p=.git;a=atom;h=master" &&
+	gitweb_run "p=.git;a=atom;h=main" &&
 	grep "Status: 304 Not Modified" gitweb.headers
 '
 test_debug 'cat gitweb.headers'
 
 test_expect_success DATE_PARSER 'modification: snapshot last-modified' '
-	gitweb_run "p=.git;a=snapshot;h=master;sf=tgz" &&
+	gitweb_run "p=.git;a=snapshot;h=main;sf=tgz" &&
 	grep "Status: 200 OK" gitweb.headers &&
 	grep "Last-modified: Thu, 7 Apr 2005 22:14:13 +0000" gitweb.headers
 '
@@ -158,7 +158,7 @@ test_expect_success DATE_PARSER 'modification: snapshot if-modified-since (modif
 	HTTP_IF_MODIFIED_SINCE="Wed, 6 Apr 2005 22:14:13 +0000" &&
 	export HTTP_IF_MODIFIED_SINCE &&
 	test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&
-	gitweb_run "p=.git;a=snapshot;h=master;sf=tgz" &&
+	gitweb_run "p=.git;a=snapshot;h=main;sf=tgz" &&
 	grep "Status: 200 OK" gitweb.headers
 '
 test_debug 'cat gitweb.headers'
@@ -167,7 +167,7 @@ test_expect_success DATE_PARSER 'modification: snapshot if-modified-since (unmod
 	HTTP_IF_MODIFIED_SINCE="Thu, 7 Apr 2005 22:14:13 +0000" &&
 	export HTTP_IF_MODIFIED_SINCE &&
 	test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&
-	gitweb_run "p=.git;a=snapshot;h=master;sf=tgz" &&
+	gitweb_run "p=.git;a=snapshot;h=main;sf=tgz" &&
 	grep "Status: 304 Not Modified" gitweb.headers
 '
 test_debug 'cat gitweb.headers'
t/t9502-gitweb-standalone-parse-output.sh +8 -8
index e38cbc97d3..d0cfff9fdd 100755
@@ -79,10 +79,10 @@ test_expect_success 'snapshot: HEAD' '
 '
 test_debug 'cat gitweb.headers && cat file_list'
 
-test_expect_success 'snapshot: short branch name (master)' '
-	gitweb_run "p=.git;a=snapshot;h=master;sf=tar" &&
-	ID=$(git rev-parse --verify --short=7 master) &&
-	check_snapshot ".git-master-$ID"
+test_expect_success 'snapshot: short branch name (main)' '
+	gitweb_run "p=.git;a=snapshot;h=main;sf=tar" &&
+	ID=$(git rev-parse --verify --short=7 main) &&
+	check_snapshot ".git-main-$ID"
 '
 test_debug 'cat gitweb.headers && cat file_list'
 
@@ -93,10 +93,10 @@ test_expect_success 'snapshot: short tag name (first)' '
 '
 test_debug 'cat gitweb.headers && cat file_list'
 
-test_expect_success 'snapshot: full branch name (refs/heads/master)' '
-	gitweb_run "p=.git;a=snapshot;h=refs/heads/master;sf=tar" &&
-	ID=$(git rev-parse --verify --short=7 master) &&
-	check_snapshot ".git-master-$ID"
+test_expect_success 'snapshot: full branch name (refs/heads/main)' '
+	gitweb_run "p=.git;a=snapshot;h=refs/heads/main;sf=tar" &&
+	ID=$(git rev-parse --verify --short=7 main) &&
+	check_snapshot ".git-main-$ID"
 '
 test_debug 'cat gitweb.headers && cat file_list'
 
t/t9600-cvsimport.sh +1 -1
index 251fdd66c4..0c8e02c2b3 100755
@@ -159,6 +159,6 @@ test_expect_success PERL 'no .git/cvs-revisions created by default' '
 
 '
 
-test_expect_success PERL 'test entire HEAD' 'test_cmp_branch_tree master'
+test_expect_success PERL 'test entire HEAD' 'test_cmp_branch_tree main'
 
 test_done
t/t9601-cvsimport-vendor-branch.sh +8 -8
index 827d39f5bf..1e89f936e8 100755
@@ -42,43 +42,43 @@ test_expect_success PERL 'import a module with a vendor branch' '
 
 '
 
-test_expect_success PERL 'check HEAD out of cvs repository' 'test_cvs_co master'
+test_expect_success PERL 'check HEAD out of cvs repository' 'test_cvs_co main'
 
-test_expect_success PERL 'check master out of git repository' 'test_git_co master'
+test_expect_success PERL 'check main out of git repository' 'test_git_co main'
 
 test_expect_success PERL 'check a file that was imported once' '
 
-	test_cmp_branch_file master imported-once.txt
+	test_cmp_branch_file main imported-once.txt
 
 '
 
 test_expect_failure PERL 'check a file that was imported twice' '
 
-	test_cmp_branch_file master imported-twice.txt
+	test_cmp_branch_file main imported-twice.txt
 
 '
 
 test_expect_success PERL 'check a file that was imported then modified on HEAD' '
 
-	test_cmp_branch_file master imported-modified.txt
+	test_cmp_branch_file main imported-modified.txt
 
 '
 
 test_expect_success PERL 'check a file that was imported, modified, then imported again' '
 
-	test_cmp_branch_file master imported-modified-imported.txt
+	test_cmp_branch_file main imported-modified-imported.txt
 
 '
 
 test_expect_success PERL 'check a file that was added to HEAD then imported' '
 
-	test_cmp_branch_file master added-imported.txt
+	test_cmp_branch_file main added-imported.txt
 
 '
 
 test_expect_success PERL 'a vendor branch whose tag has been removed' '
 
-	test_cmp_branch_file master imported-anonymously.txt
+	test_cmp_branch_file main imported-anonymously.txt
 
 '
 
t/t9602-cvsimport-branches-tags.sh +2 -2
index e1db323f54..fa3c1ae133 100755
@@ -14,9 +14,9 @@ test_expect_success PERL 'import module' '
 
 '
 
-test_expect_success PERL 'test branch master' '
+test_expect_success PERL 'test branch main' '
 
-	test_cmp_branch_tree master
+	test_cmp_branch_tree main
 
 '
 
t/t9603-cvsimport-patchsets.sh +4 -4
index e7a91611dc..19f38f78f2 100755
@@ -20,16 +20,16 @@ test_expect_failure PERL 'import with criss cross times on revisions' '
 	git cvsimport -p"-x" -C module-git module &&
 	(
 		cd module-git &&
-		git log --pretty=format:%s > ../actual-master &&
+		git log --pretty=format:%s > ../actual-main &&
 		git log A~2..A --pretty="format:%s %ad" -- > ../actual-A &&
-		echo "" >> ../actual-master &&
+		echo "" >> ../actual-main &&
 		echo "" >> ../actual-A
 	) &&
 	echo "Rev 4
 Rev 3
 Rev 2
-Rev 1" > expect-master &&
-	test_cmp expect-master actual-master &&
+Rev 1" > expect-main &&
+	test_cmp expect-main actual-main &&
 
 	echo "Rev 5 Branch A Wed Mar 11 19:09:10 2009 +0000
 Rev 4 Branch A Wed Mar 11 19:03:52 2009 +0000" > expect-A &&
t/test-lib.sh +1 -1
index a2b539aa30..803b9c2a58 100644
@@ -263,7 +263,7 @@ case "$TEST_NUMBER" in
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
-[0-8]*|9[0-4]*)
+[0-8]*|9[0-7]*)
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
Signature · 1 line
gitgitgadget
#28 lore raw

PATCH 25/28 tests(git-p4): transition to the default branch name `main`

In reply to Johannes Schindelin via GitGitGadget

From: Johannes Schindelin <[email protected]>

In the previous commits, we adjusted the test suite to use the branch name main for initial branches.

The git p4-related tests are a bit harder to adjust because git p4 uses the ref refs/heads/p4/master to track the remote branches, and for now, we do not want to change that (this might be the subject of a future patch series). We only need to adjust for the actual initial branch name to be changed to main.

This allows us to define GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main for those tests.

---
 t/t9800-git-p4-basic.sh        |  2 +-
 t/t9801-git-p4-branch.sh       | 16 ++++++++--------
 t/t9806-git-p4-options.sh      | 18 +++++++++---------
 t/t9807-git-p4-submit.sh       |  2 +-
 t/t9811-git-p4-label-import.sh |  2 +-
 t/test-lib.sh                  |  2 +-
 6 files changed, 21 insertions(+), 21 deletions(-)
t/t9800-git-p4-basic.sh +1 -1
index c98c1dfc23..0c543a8708 100755
@@ -226,7 +226,7 @@ test_expect_success 'clone --bare should make a bare repository' '
 		git config --get --bool core.bare true &&
 		git rev-parse --verify refs/remotes/p4/master &&
 		git rev-parse --verify refs/remotes/p4/HEAD &&
-		git rev-parse --verify refs/heads/master &&
+		git rev-parse --verify refs/heads/main &&
 		git rev-parse --verify HEAD
 	)
 '
t/t9801-git-p4-branch.sh +8 -8
index a3abd778f9..94161d4b57 100755
@@ -67,7 +67,7 @@ test_expect_success 'import main, no branch detection' '
 	(
 		cd "$git" &&
 		git log --oneline --graph --decorate --all &&
-		git rev-list master -- >wc &&
+		git rev-list main -- >wc &&
 		test_line_count = 4 wc
 	)
 '
@@ -78,7 +78,7 @@ test_expect_success 'import branch1, no branch detection' '
 	(
 		cd "$git" &&
 		git log --oneline --graph --decorate --all &&
-		git rev-list master -- >wc &&
+		git rev-list main -- >wc &&
 		test_line_count = 2 wc
 	)
 '
@@ -89,7 +89,7 @@ test_expect_success 'import branch2, no branch detection' '
 	(
 		cd "$git" &&
 		git log --oneline --graph --decorate --all &&
-		git rev-list master -- >wc &&
+		git rev-list main -- >wc &&
 		test_line_count = 2 wc
 	)
 '
@@ -100,7 +100,7 @@ test_expect_success 'import depot, no branch detection' '
 	(
 		cd "$git" &&
 		git log --oneline --graph --decorate --all &&
-		git rev-list master -- >wc &&
+		git rev-list main -- >wc &&
 		test_line_count = 8 wc
 	)
 '
@@ -114,7 +114,7 @@ test_expect_success 'import depot, branch detection' '
 		git log --oneline --graph --decorate --all &&
 
 		# 4 main commits
-		git rev-list master -- >wc &&
+		git rev-list main -- >wc &&
 		test_line_count = 4 wc &&
 
 		# 3 main, 1 integrate, 1 on branch2
@@ -137,7 +137,7 @@ test_expect_success 'import depot, branch detection, branchList branch definitio
 		git log --oneline --graph --decorate --all &&
 
 		# 4 main commits
-		git rev-list master -- >wc &&
+		git rev-list main -- >wc &&
 		test_line_count = 4 wc &&
 
 		# 3 main, 1 integrate, 1 on branch2
@@ -484,7 +484,7 @@ test_expect_success 'use-client-spec detect-branches files in top-level' '
 	(
 		cd "$git" &&
 		git p4 sync --detect-branches --use-client-spec //depot/usecs@all &&
-		git checkout -b master p4/usecs/b1 &&
+		git checkout -b main p4/usecs/b1 &&
 		test_path_is_file b1-file1 &&
 		test_path_is_missing b2-file2 &&
 		test_path_is_missing b1 &&
@@ -537,7 +537,7 @@ test_expect_success 'use-client-spec detect-branches skips files in branches' '
 	(
 		cd "$git" &&
 		git p4 sync --detect-branches --use-client-spec //depot/usecs@all &&
-		git checkout -b master p4/usecs/b3 &&
+		git checkout -b main p4/usecs/b3 &&
 		test_path_is_file b1-file1 &&
 		test_path_is_file b3-file3_2 &&
 		test_path_is_missing b3-file3_1
t/t9806-git-p4-options.sh +9 -9
index 4e794a01bf..0beae2e3f3 100755
@@ -27,14 +27,14 @@ test_expect_success 'clone no --git-dir' '
 	test_must_fail git p4 clone --git-dir=xx //depot
 '
 
-test_expect_success 'clone --branch should checkout master' '
+test_expect_success 'clone --branch should checkout main' '
 	git p4 clone --branch=refs/remotes/p4/sb --dest="$git" //depot &&
 	test_when_finished cleanup_git &&
 	(
 		cd "$git" &&
 		git rev-parse refs/remotes/p4/sb >sb &&
-		git rev-parse refs/heads/master >master &&
-		test_cmp sb master &&
+		git rev-parse refs/heads/main >main &&
+		test_cmp sb main &&
 		git rev-parse HEAD >head &&
 		test_cmp sb head
 	)
@@ -147,22 +147,22 @@ test_expect_success 'clone --changesfile, @all' '
 	test_must_fail git p4 clone --changesfile="$TRASH_DIRECTORY/cf" --dest="$git" //depot@all
 '
 
-# imports both master and p4/master in refs/heads
+# imports both main and p4/master in refs/heads
 # requires --import-local on sync to find p4 refs/heads
-# does not update master on sync, just p4/master
+# does not update main on sync, just p4/master
 test_expect_success 'clone/sync --import-local' '
 	git p4 clone --import-local --dest="$git" //depot@1,2 &&
 	test_when_finished cleanup_git &&
 	(
 		cd "$git" &&
-		git log --oneline refs/heads/master >lines &&
+		git log --oneline refs/heads/main >lines &&
 		test_line_count = 2 lines &&
 		git log --oneline refs/heads/p4/master >lines &&
 		test_line_count = 2 lines &&
 		test_must_fail git p4 sync &&
 
 		git p4 sync --import-local &&
-		git log --oneline refs/heads/master >lines &&
+		git log --oneline refs/heads/main >lines &&
 		test_line_count = 2 lines &&
 		git log --oneline refs/heads/p4/master >lines &&
 		test_line_count = 3 lines
@@ -174,7 +174,7 @@ test_expect_success 'clone --max-changes' '
 	test_when_finished cleanup_git &&
 	(
 		cd "$git" &&
-		git log --oneline refs/heads/master >lines &&
+		git log --oneline refs/heads/main >lines &&
 		test_line_count = 2 lines
 	)
 '
@@ -237,7 +237,7 @@ test_expect_success 'clone --use-client-spec' '
 			git init &&
 			git config git-p4.useClientSpec true &&
 			git p4 sync //depot/... &&
-			git checkout -b master p4/master &&
+			git checkout -b main p4/master &&
 			test_path_is_file bus/dir/f4 &&
 			test_path_is_missing file1
 		)
t/t9807-git-p4-submit.sh +1 -1
index eaaae414a1..e45104d1ef 100755
@@ -114,7 +114,7 @@ test_expect_success 'submit with allowSubmit' '
 		git config git-p4.skipSubmitEdit true &&
 		git config git-p4.allowSubmit "nobranch" &&
 		test_must_fail git p4 submit &&
-		git config git-p4.allowSubmit "nobranch,master" &&
+		git config git-p4.allowSubmit "nobranch,main" &&
 		git p4 submit
 	)
 '
t/t9811-git-p4-label-import.sh +1 -1
index c1446f26ab..c722b5a176 100755
@@ -185,7 +185,7 @@ test_expect_success 'tag that cannot be exported' '
 		git add main/f12 &&
 		git commit -m "adding f12" &&
 		git tag -m "tag on a_branch" GIT_TAG_ON_A_BRANCH &&
-		git checkout master &&
+		git checkout main &&
 		git p4 submit --export-labels
 	) &&
 	(
t/test-lib.sh +1 -1
index 803b9c2a58..173880196e 100644
@@ -263,7 +263,7 @@ case "$TEST_NUMBER" in
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
-[0-8]*|9[0-7]*)
+[0-8]*|9[0-8]*)
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
Signature · 1 line
gitgitgadget
#31 lore raw

PATCH 28/28 Change the default branch name to `main`

In reply to Johannes Schindelin via GitGitGadget

From: Don Goodman-Wilson <[email protected]>

The current default name for the initial branch is a loaded term, and many Open Source projects renamed their principal branches already. A common choice appears to be main.

Let's follow their lead and change the default of init.defaultBranch.

---
 refs.c                    | 2 +-
 t/lib-submodule-update.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
refs.c +1 -1
index 392f0bbf68..5576a90573 100644
@@ -575,7 +575,7 @@ char *repo_default_branch_name(struct repository *r)
 		die(_("could not retrieve `%s`"), config_display_key);
 
 	if (!ret)
-		ret = xstrdup("master");
+		ret = xstrdup("main");
 
 	full_ref = xstrfmt("refs/heads/%s", ret);
 	if (check_refname_format(full_ref, 0))
t/lib-submodule-update.sh +1 -1
index bd3fa3c6da..1b0abcb0f8 100644
@@ -144,7 +144,7 @@ create_lib_submodule_repo () {
 		git checkout -b valid_sub1 &&
 		git revert HEAD &&
 
-		git checkout "${GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME-master}"
+		git checkout "${GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME-main}"
 	)
 }
 
Signature · 1 line
gitgitgadget
#30 lore raw

PATCH 27/28 tests: drop prereq `PREPARE_FOR_MAIN_BRANCH` where no longer needed

In reply to Johannes Schindelin via GitGitGadget

From: Johannes Schindelin <[email protected]>

We introduced the PREPARE_FOR_MAIN_BRANCH prereq for the sole purpose of allowing us to perform the non-trivial adjustments regarding the master -> main rename before the automatable ones.

Now that the transition is almost complete, we can stop using it in most instances. The only exception is t9902: at the time of writing, there are other patches in flight that touch this test script, therefore the transition to main is postponed to a later date.

This patch is the result of this command:

	sed -i 's/PREPARE_FOR_MAIN_BRANCH[ ,]//' t/t[0-9]*.sh &&
	git checkout HEAD -- t/t9902\*
---
 t/t1400-update-ref.sh              |  4 +--
 t/t3200-branch.sh                  |  6 ++---
 t/t3201-branch-contains.sh         |  2 +-
 t/t3203-branch-output.sh           |  2 +-
 t/t3205-branch-color.sh            |  2 +-
 t/t5505-remote.sh                  |  8 +++---
 t/t5510-fetch.sh                   |  4 +--
 t/t5526-fetch-submodules.sh        | 42 +++++++++++++++---------------
 t/t5703-upload-pack-ref-in-want.sh |  2 +-
 t/t6302-for-each-ref-filter.sh     | 12 ++++-----
 10 files changed, 42 insertions(+), 42 deletions(-)
t/t1400-update-ref.sh +2 -2
index 3265a8c58e..127efff136 100755
@@ -585,7 +585,7 @@ test_expect_success 'stdin fails on unbalanced quotes' '
 	grep "fatal: badly quoted argument: \\\"main" err
 '
 
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'stdin fails on invalid escape' '
+test_expect_success 'stdin fails on invalid escape' '
 	echo "create $a \"ma\zn\"" >stdin &&
 	test_must_fail git update-ref --stdin <stdin 2>err &&
 	grep "fatal: badly quoted argument: \\\"ma\\\\zn\\\"" err
@@ -704,7 +704,7 @@ test_expect_success 'stdin succeeds with quoted argument' '
 	test_cmp expect actual
 '
 
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'stdin succeeds with escaped character' '
+test_expect_success 'stdin succeeds with escaped character' '
 	git update-ref -d $a &&
 	echo "create $a \"ma\\151n\"" >stdin &&
 	git update-ref --stdin <stdin &&
t/t3200-branch.sh +3 -3
index 63036e0369..430f5af21b 100755
@@ -321,7 +321,7 @@ test_expect_success 'git branch --list -v with --abbrev' '
 
 '
 
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'git branch --column' '
+test_expect_success 'git branch --column' '
 	COLUMNS=81 git branch --column=column >actual &&
 	cat >expect <<\EOF &&
   a/b/c   bam     foo     l     * main    n       o/p     r
@@ -358,7 +358,7 @@ EOF
 	test_cmp expect actual
 '
 
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'git branch with column.*' '
+test_expect_success 'git branch with column.*' '
 	git config column.ui column &&
 	git config column.branch "dense" &&
 	COLUMNS=80 git branch >actual &&
@@ -375,7 +375,7 @@ test_expect_success 'git branch --column -v should fail' '
 	test_must_fail git branch --column -v
 '
 
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'git branch -v with column.ui ignored' '
+test_expect_success 'git branch -v with column.ui ignored' '
 	git config column.ui column &&
 	COLUMNS=80 git branch -v | cut -c -8 | sed "s/ *$//" >actual &&
 	git config --unset column.ui &&
t/t3201-branch-contains.sh +1 -1
index 110cfef820..f39ae97264 100755
@@ -242,7 +242,7 @@ test_expect_success 'branch --merged combined with --no-merged' '
 # Here "topic" tracks "main" with one extra commit, and "zzz" points to the
 # same tip as main The name "zzz" must come alphabetically after "topic"
 # as we process them in that order.
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'branch --merged with --verbose' '
+test_expect_success 'branch --merged with --verbose' '
 	git branch --track topic main &&
 	git branch zzz topic &&
 	git checkout topic &&
t/t3203-branch-output.sh +1 -1
index 727c9d9caa..211eb8357f 100755
@@ -329,7 +329,7 @@ test_expect_success '--color overrides auto-color' '
 	test_cmp expect.color actual
 '
 
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'verbose output lists worktree path' '
+test_expect_success 'verbose output lists worktree path' '
 	one=$(git rev-parse --short HEAD) &&
 	two=$(git rev-parse --short main) &&
 	cat >expect <<-EOF &&
t/t3205-branch-color.sh +1 -1
index 9f2fb785d2..2eb619231d 100755
@@ -28,7 +28,7 @@ test_expect_success 'regular output shows colors' '
 	test_cmp expect actual
 '
 
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'verbose output shows colors' '
+test_expect_success 'verbose output shows colors' '
 	oid=$(git rev-parse --short HEAD) &&
 	cat >expect <<-EOF &&
 	* <CYAN>main               <RESET> $oid foo
t/t5505-remote.sh +4 -4
index 540d65aa22..869109a2c6 100755
@@ -234,7 +234,7 @@ cat >test/expect <<EOF
     main  pushes to another (up to date)
 EOF
 
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'show' '
+test_expect_success 'show' '
 	(
 		cd test &&
 		git config --add remote.origin.fetch refs/heads/main:refs/heads/upstream &&
@@ -285,7 +285,7 @@ cat >test/expect <<EOF
     refs/tags/lastbackup forces to refs/tags/lastbackup
 EOF
 
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'show -n' '
+test_expect_success 'show -n' '
 	mv one one.unreachable &&
 	(
 		cd test &&
@@ -328,7 +328,7 @@ test_expect_success 'set-head --auto' '
 	)
 '
 
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'set-head --auto has no problem w/multiple HEADs' '
+test_expect_success 'set-head --auto has no problem w/multiple HEADs' '
 	(
 		cd test &&
 		git fetch two "refs/heads/*:refs/remotes/two/*" &&
@@ -1348,7 +1348,7 @@ test_expect_success 'unqualified <dst> refspec DWIM and advice' '
 	)
 '
 
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'refs/remotes/* <src> refspec and unqualified <dst> DWIM and advice' '
+test_expect_success 'refs/remotes/* <src> refspec and unqualified <dst> DWIM and advice' '
 	(
 		cd two &&
 		git tag -a -m "Some tag" my-tag main &&
t/t5510-fetch.sh +2 -2
index 206e3be695..f8bcaeca08 100755
@@ -942,7 +942,7 @@ test_expect_success 'fetching with auto-gc does not lock up' '
 	)
 '
 
-test_expect_success PREPARE_FOR_MAIN_BRANCH,C_LOCALE_OUTPUT 'fetch aligned output' '
+test_expect_success C_LOCALE_OUTPUT 'fetch aligned output' '
 	git clone . full-output &&
 	test_commit looooooooooooong-tag &&
 	(
@@ -957,7 +957,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH,C_LOCALE_OUTPUT 'fetch aligned outpu
 	test_cmp expect actual
 '
 
-test_expect_success PREPARE_FOR_MAIN_BRANCH,C_LOCALE_OUTPUT 'fetch compact output' '
+test_expect_success C_LOCALE_OUTPUT 'fetch compact output' '
 	git clone . compact &&
 	test_commit extraaa &&
 	(
t/t5526-fetch-submodules.sh +21 -21

168 lines not on this page · raw message

t/t5703-upload-pack-ref-in-want.sh +1 -1
index bbf03a8f66..fe89ea55b1 100755
@@ -383,7 +383,7 @@ test_expect_success 'server is initially behind - ref in want' '
 	test_cmp expected actual
 '
 
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'server loses a ref - ref in want' '
+test_expect_success 'server loses a ref - ref in want' '
 	git -C "$REPO" config uploadpack.allowRefInWant true &&
 	rm -rf local &&
 	cp -r "$LOCAL_PRISTINE" local &&
t/t6302-for-each-ref-filter.sh +6 -6
index f5a55c1991..7a45bbf048 100755
@@ -113,7 +113,7 @@ test_expect_success '%(color) must fail' '
 	test_must_fail git for-each-ref --format="%(color)%(refname)"
 '
 
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'left alignment is default' '
+test_expect_success 'left alignment is default' '
 	cat >expect <<-\EOF &&
 	refname is refs/heads/main    |refs/heads/main
 	refname is refs/heads/side    |refs/heads/side
@@ -131,7 +131,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH 'left alignment is default' '
 	test_cmp expect actual
 '
 
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'middle alignment' '
+test_expect_success 'middle alignment' '
 	cat >expect <<-\EOF &&
 	|  refname is refs/heads/main  |refs/heads/main
 	|  refname is refs/heads/side  |refs/heads/side
@@ -149,7 +149,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH 'middle alignment' '
 	test_cmp expect actual
 '
 
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'right alignment' '
+test_expect_success 'right alignment' '
 	cat >expect <<-\EOF &&
 	|    refname is refs/heads/main|refs/heads/main
 	|    refname is refs/heads/side|refs/heads/side
@@ -184,7 +184,7 @@ EOF
 test_align_permutations() {
 	while read -r option
 	do
-		test_expect_success PREPARE_FOR_MAIN_BRANCH "align:$option" '
+		test_expect_success "align:$option" '
 			git for-each-ref --format="|%(align:$option)refname is %(refname)%(end)|%(refname)" >actual &&
 			test_cmp expect actual
 		'
@@ -213,7 +213,7 @@ EOF
 
 # Individual atoms inside %(align:...) and %(end) must not be quoted.
 
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'alignment with format quote' "
+test_expect_success 'alignment with format quote' "
 	cat >expect <<-\EOF &&
 	|'       '\''main| A U Thor'\''       '|
 	|'       '\''side| A U Thor'\''       '|
@@ -231,7 +231,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH 'alignment with format quote' "
 	test_cmp expect actual
 "
 
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'nested alignment with quote formatting' "
+test_expect_success 'nested alignment with quote formatting' "
 	cat >expect <<-\EOF &&
 	|'           main               '|
 	|'           side               '|
Signature · 1 line
gitgitgadget
#29 lore raw

PATCH 26/28 t99*: adjust the references to the default branch name "main"

In reply to Johannes Schindelin via GitGitGadget

From: Johannes Schindelin <[email protected]>

Carefully excluding t9902, which sees independent development elsewhere at the time of writing, we use main as the default branch name in t9903. This trick was performed via

	$ (cd t &&
	   sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
		-e 's/Master/Main/g' -- t99*.sh lib-cvs.sh &&
	   git checkout HEAD -- t9902\*)

This allows us to define GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main for all tests (except the ones we specifically excluded for now).

---
 t/t9903-bash-prompt.sh | 114 ++++++++++++++++++++---------------------
 t/test-lib.sh          |   4 +-
 2 files changed, 59 insertions(+), 59 deletions(-)
t/t9903-bash-prompt.sh +57 -57
index ab5da2cabc..a77daa7419 100755
@@ -28,7 +28,7 @@ test_expect_success 'setup for prompt tests' '
 	echo 3 >file &&
 	git commit -m "third b1" file &&
 	git tag -a -m msg2 t2 &&
-	git checkout -b b2 master &&
+	git checkout -b b2 main &&
 	echo 0 >file &&
 	git commit -m "second b2" file &&
 	echo 00 >file &&
@@ -37,20 +37,20 @@ test_expect_success 'setup for prompt tests' '
 	git commit -m "yet another b2" file &&
 	mkdir ignored_dir &&
 	echo "ignored_dir/" >>.gitignore &&
-	git checkout master
+	git checkout main
 '
 
 test_expect_success 'prompt - branch name' '
-	printf " (master)" >expected &&
+	printf " (main)" >expected &&
 	__git_ps1 >"$actual" &&
 	test_cmp expected "$actual"
 '
 
 test_expect_success SYMLINKS 'prompt - branch name - symlink symref' '
-	printf " (master)" >expected &&
-	test_when_finished "git checkout master" &&
+	printf " (main)" >expected &&
+	test_when_finished "git checkout main" &&
 	test_config core.preferSymlinkRefs true &&
-	git checkout master &&
+	git checkout main &&
 	__git_ps1 >"$actual" &&
 	test_cmp expected "$actual"
 '
@@ -58,7 +58,7 @@ test_expect_success SYMLINKS 'prompt - branch name - symlink symref' '
 test_expect_success 'prompt - unborn branch' '
 	printf " (unborn)" >expected &&
 	git checkout --orphan unborn &&
-	test_when_finished "git checkout master" &&
+	test_when_finished "git checkout main" &&
 	__git_ps1 >"$actual" &&
 	test_cmp expected "$actual"
 '
@@ -72,7 +72,7 @@ test_expect_success FUNNYNAMES 'prompt - with newline in path' '
 with
 newline" &&
 	mkdir "$repo_with_newline" &&
-	printf " (master)" >expected &&
+	printf " (main)" >expected &&
 	git init "$repo_with_newline" &&
 	test_when_finished "rm -rf \"$repo_with_newline\"" &&
 	mkdir "$repo_with_newline"/subdir &&
@@ -87,7 +87,7 @@ test_expect_success 'prompt - detached head' '
 	printf " ((%s...))" $(git log -1 --format="%h" --abbrev=13 b1^) >expected &&
 	test_config core.abbrev 13 &&
 	git checkout b1^ &&
-	test_when_finished "git checkout master" &&
+	test_when_finished "git checkout main" &&
 	__git_ps1 >"$actual" &&
 	test_cmp expected "$actual"
 '
@@ -95,7 +95,7 @@ test_expect_success 'prompt - detached head' '
 test_expect_success 'prompt - describe detached head - contains' '
 	printf " ((t2~1))" >expected &&
 	git checkout b1^ &&
-	test_when_finished "git checkout master" &&
+	test_when_finished "git checkout main" &&
 	(
 		GIT_PS1_DESCRIBE_STYLE=contains &&
 		__git_ps1 >"$actual"
@@ -106,7 +106,7 @@ test_expect_success 'prompt - describe detached head - contains' '
 test_expect_success 'prompt - describe detached head - branch' '
 	printf " ((tags/t2~1))" >expected &&
 	git checkout b1^ &&
-	test_when_finished "git checkout master" &&
+	test_when_finished "git checkout main" &&
 	(
 		GIT_PS1_DESCRIBE_STYLE=branch &&
 		__git_ps1 >"$actual"
@@ -117,7 +117,7 @@ test_expect_success 'prompt - describe detached head - branch' '
 test_expect_success 'prompt - describe detached head - describe' '
 	printf " ((t1-1-g%s))" $(git log -1 --format="%h" b1^) >expected &&
 	git checkout b1^ &&
-	test_when_finished "git checkout master" &&
+	test_when_finished "git checkout main" &&
 	(
 		GIT_PS1_DESCRIBE_STYLE=describe &&
 		__git_ps1 >"$actual"
@@ -128,7 +128,7 @@ test_expect_success 'prompt - describe detached head - describe' '
 test_expect_success 'prompt - describe detached head - default' '
 	printf " ((t2))" >expected &&
 	git checkout --detach b1 &&
-	test_when_finished "git checkout master" &&
+	test_when_finished "git checkout main" &&
 	__git_ps1 >"$actual" &&
 	test_cmp expected "$actual"
 '
@@ -152,7 +152,7 @@ test_expect_success 'prompt - deep inside .git directory' '
 '
 
 test_expect_success 'prompt - inside bare repository' '
-	printf " (BARE:master)" >expected &&
+	printf " (BARE:main)" >expected &&
 	git init --bare bare.git &&
 	test_when_finished "rm -rf bare.git" &&
 	(
@@ -172,7 +172,7 @@ test_expect_success 'prompt - interactive rebase' '
 	test_when_finished "rm -f fake_editor.sh" &&
 	test_set_editor "$TRASH_DIRECTORY/fake_editor.sh" &&
 	git checkout b1 &&
-	test_when_finished "git checkout master" &&
+	test_when_finished "git checkout main" &&
 	git rebase -i HEAD^ &&
 	test_when_finished "git rebase --abort" &&
 	__git_ps1 >"$actual" &&
@@ -182,7 +182,7 @@ test_expect_success 'prompt - interactive rebase' '
 test_expect_success 'prompt - rebase merge' '
 	printf " (b2|REBASE 1/3)" >expected &&
 	git checkout b2 &&
-	test_when_finished "git checkout master" &&
+	test_when_finished "git checkout main" &&
 	test_must_fail git rebase --merge b1 b2 &&
 	test_when_finished "git rebase --abort" &&
 	__git_ps1 >"$actual" &&
@@ -192,7 +192,7 @@ test_expect_success 'prompt - rebase merge' '
 test_expect_success 'prompt - rebase am' '
 	printf " (b2|REBASE 1/3)" >expected &&
 	git checkout b2 &&
-	test_when_finished "git checkout master" &&
+	test_when_finished "git checkout main" &&
 	test_must_fail git rebase --apply b1 b2 &&
 	test_when_finished "git rebase --abort" &&
 	__git_ps1 >"$actual" &&
@@ -202,7 +202,7 @@ test_expect_success 'prompt - rebase am' '
 test_expect_success 'prompt - merge' '
 	printf " (b1|MERGING)" >expected &&
 	git checkout b1 &&
-	test_when_finished "git checkout master" &&
+	test_when_finished "git checkout main" &&
 	test_must_fail git merge b2 &&
 	test_when_finished "git reset --hard" &&
 	__git_ps1 >"$actual" &&
@@ -210,7 +210,7 @@ test_expect_success 'prompt - merge' '
 '
 
 test_expect_success 'prompt - cherry-pick' '
-	printf " (master|CHERRY-PICKING)" >expected &&
+	printf " (main|CHERRY-PICKING)" >expected &&
 	test_must_fail git cherry-pick b1 b1^ &&
 	test_when_finished "git cherry-pick --abort" &&
 	__git_ps1 >"$actual" &&
@@ -222,7 +222,7 @@ test_expect_success 'prompt - cherry-pick' '
 '
 
 test_expect_success 'prompt - revert' '
-	printf " (master|REVERTING)" >expected &&
+	printf " (main|REVERTING)" >expected &&
 	test_must_fail git revert b1^ b1 &&
 	test_when_finished "git revert --abort" &&
 	__git_ps1 >"$actual" &&
@@ -234,7 +234,7 @@ test_expect_success 'prompt - revert' '
 '
 
 test_expect_success 'prompt - bisect' '
-	printf " (master|BISECTING)" >expected &&
+	printf " (main|BISECTING)" >expected &&
 	git bisect start &&
 	test_when_finished "git bisect reset" &&
 	__git_ps1 >"$actual" &&
@@ -242,7 +242,7 @@ test_expect_success 'prompt - bisect' '
 '
 
 test_expect_success 'prompt - dirty status indicator - clean' '
-	printf " (master)" >expected &&
+	printf " (main)" >expected &&
 	(
 		GIT_PS1_SHOWDIRTYSTATE=y &&
 		__git_ps1 >"$actual"
@@ -251,7 +251,7 @@ test_expect_success 'prompt - dirty status indicator - clean' '
 '
 
 test_expect_success 'prompt - dirty status indicator - dirty worktree' '
-	printf " (master *)" >expected &&
+	printf " (main *)" >expected &&
 	echo "dirty" >file &&
 	test_when_finished "git reset --hard" &&
 	(
@@ -262,7 +262,7 @@ test_expect_success 'prompt - dirty status indicator - dirty worktree' '
 '
 
 test_expect_success 'prompt - dirty status indicator - dirty index' '
-	printf " (master +)" >expected &&
+	printf " (main +)" >expected &&
 	echo "dirty" >file &&
 	test_when_finished "git reset --hard" &&
 	git add -u &&
@@ -274,7 +274,7 @@ test_expect_success 'prompt - dirty status indicator - dirty index' '
 '
 
 test_expect_success 'prompt - dirty status indicator - dirty index and worktree' '
-	printf " (master *+)" >expected &&
+	printf " (main *+)" >expected &&
 	echo "dirty index" >file &&
 	test_when_finished "git reset --hard" &&
 	git add -u &&
@@ -288,7 +288,7 @@ test_expect_success 'prompt - dirty status indicator - dirty index and worktree'
 
 test_expect_success 'prompt - dirty status indicator - orphan branch - clean' '
 	printf " (orphan #)" >expected &&
-	test_when_finished "git checkout master" &&
+	test_when_finished "git checkout main" &&
 	git checkout --orphan orphan &&
 	git reset --hard &&
 	(
@@ -300,7 +300,7 @@ test_expect_success 'prompt - dirty status indicator - orphan branch - clean' '
 
 test_expect_success 'prompt - dirty status indicator - orphan branch - dirty index' '
 	printf " (orphan +)" >expected &&
-	test_when_finished "git checkout master" &&
+	test_when_finished "git checkout main" &&
 	git checkout --orphan orphan &&
 	(
 		GIT_PS1_SHOWDIRTYSTATE=y &&
@@ -311,7 +311,7 @@ test_expect_success 'prompt - dirty status indicator - orphan branch - dirty ind
 
 test_expect_success 'prompt - dirty status indicator - orphan branch - dirty index and worktree' '
 	printf " (orphan *+)" >expected &&
-	test_when_finished "git checkout master" &&
+	test_when_finished "git checkout main" &&
 	git checkout --orphan orphan &&
 	>file &&
 	(
@@ -322,7 +322,7 @@ test_expect_success 'prompt - dirty status indicator - orphan branch - dirty ind
 '
 
 test_expect_success 'prompt - dirty status indicator - shell variable unset with config disabled' '
-	printf " (master)" >expected &&
+	printf " (main)" >expected &&
 	echo "dirty" >file &&
 	test_when_finished "git reset --hard" &&
 	test_config bash.showDirtyState false &&
@@ -334,7 +334,7 @@ test_expect_success 'prompt - dirty status indicator - shell variable unset with
 '
 
 test_expect_success 'prompt - dirty status indicator - shell variable unset with config enabled' '
-	printf " (master)" >expected &&
+	printf " (main)" >expected &&
 	echo "dirty" >file &&
 	test_when_finished "git reset --hard" &&
 	test_config bash.showDirtyState true &&
@@ -346,7 +346,7 @@ test_expect_success 'prompt - dirty status indicator - shell variable unset with
 '
 
 test_expect_success 'prompt - dirty status indicator - shell variable set with config disabled' '
-	printf " (master)" >expected &&
+	printf " (main)" >expected &&
 	echo "dirty" >file &&
 	test_when_finished "git reset --hard" &&
 	test_config bash.showDirtyState false &&
@@ -358,7 +358,7 @@ test_expect_success 'prompt - dirty status indicator - shell variable set with c
 '
 
 test_expect_success 'prompt - dirty status indicator - shell variable set with config enabled' '
-	printf " (master *)" >expected &&
+	printf " (main *)" >expected &&
 	echo "dirty" >file &&
 	test_when_finished "git reset --hard" &&
 	test_config bash.showDirtyState true &&
@@ -382,7 +382,7 @@ test_expect_success 'prompt - dirty status indicator - not shown inside .git dir
 '
 
 test_expect_success 'prompt - stash status indicator - no stash' '
-	printf " (master)" >expected &&
+	printf " (main)" >expected &&
 	(
 		GIT_PS1_SHOWSTASHSTATE=y &&
 		__git_ps1 >"$actual"
@@ -391,7 +391,7 @@ test_expect_success 'prompt - stash status indicator - no stash' '
 '
 
 test_expect_success 'prompt - stash status indicator - stash' '
-	printf " (master $)" >expected &&
+	printf " (main $)" >expected &&
 	echo 2 >file &&
 	git stash &&
 	test_when_finished "git stash drop" &&
@@ -417,7 +417,7 @@ test_expect_success 'prompt - stash status indicator - not shown inside .git dir
 '
 
 test_expect_success 'prompt - untracked files status indicator - no untracked files' '
-	printf " (master)" >expected &&
+	printf " (main)" >expected &&
 	(
 		GIT_PS1_SHOWUNTRACKEDFILES=y &&
 		cd otherrepo &&
@@ -427,7 +427,7 @@ test_expect_success 'prompt - untracked files status indicator - no untracked fi
 '
 
 test_expect_success 'prompt - untracked files status indicator - untracked files' '
-	printf " (master %%)" >expected &&
+	printf " (main %%)" >expected &&
 	(
 		GIT_PS1_SHOWUNTRACKEDFILES=y &&
 		__git_ps1 >"$actual"
@@ -436,7 +436,7 @@ test_expect_success 'prompt - untracked files status indicator - untracked files
 '
 
 test_expect_success 'prompt - untracked files status indicator - empty untracked dir' '
-	printf " (master)" >expected &&
+	printf " (main)" >expected &&
 	mkdir otherrepo/untracked-dir &&
 	test_when_finished "rm -rf otherrepo/untracked-dir" &&
 	(
@@ -448,7 +448,7 @@ test_expect_success 'prompt - untracked files status indicator - empty untracked
 '
 
 test_expect_success 'prompt - untracked files status indicator - non-empty untracked dir' '
-	printf " (master %%)" >expected &&
+	printf " (main %%)" >expected &&
 	mkdir otherrepo/untracked-dir &&
 	test_when_finished "rm -rf otherrepo/untracked-dir" &&
 	>otherrepo/untracked-dir/untracked-file &&
@@ -461,7 +461,7 @@ test_expect_success 'prompt - untracked files status indicator - non-empty untra
 '
 
 test_expect_success 'prompt - untracked files status indicator - untracked files outside cwd' '
-	printf " (master %%)" >expected &&
+	printf " (main %%)" >expected &&
 	(
 		mkdir -p ignored_dir &&
 		cd ignored_dir &&
@@ -472,7 +472,7 @@ test_expect_success 'prompt - untracked files status indicator - untracked files
 '
 
 test_expect_success 'prompt - untracked files status indicator - shell variable unset with config disabled' '
-	printf " (master)" >expected &&
+	printf " (main)" >expected &&
 	test_config bash.showUntrackedFiles false &&
 	(
 		sane_unset GIT_PS1_SHOWUNTRACKEDFILES &&
@@ -482,7 +482,7 @@ test_expect_success 'prompt - untracked files status indicator - shell variable
 '
 
 test_expect_success 'prompt - untracked files status indicator - shell variable unset with config enabled' '
-	printf " (master)" >expected &&
+	printf " (main)" >expected &&
 	test_config bash.showUntrackedFiles true &&
 	(
 		sane_unset GIT_PS1_SHOWUNTRACKEDFILES &&
@@ -492,7 +492,7 @@ test_expect_success 'prompt - untracked files status indicator - shell variable
 '
 
 test_expect_success 'prompt - untracked files status indicator - shell variable set with config disabled' '
-	printf " (master)" >expected &&
+	printf " (main)" >expected &&
 	test_config bash.showUntrackedFiles false &&
 	(
 		GIT_PS1_SHOWUNTRACKEDFILES=y &&
@@ -502,7 +502,7 @@ test_expect_success 'prompt - untracked files status indicator - shell variable
 '
 
 test_expect_success 'prompt - untracked files status indicator - shell variable set with config enabled' '
-	printf " (master %%)" >expected &&
+	printf " (main %%)" >expected &&
 	test_config bash.showUntrackedFiles true &&
 	(
 		GIT_PS1_SHOWUNTRACKEDFILES=y &&
@@ -522,13 +522,13 @@ test_expect_success 'prompt - untracked files status indicator - not shown insid
 '
 
 test_expect_success 'prompt - format string starting with dash' '
-	printf -- "-master" >expected &&
+	printf -- "-main" >expected &&
 	__git_ps1 "-%s" >"$actual" &&
 	test_cmp expected "$actual"
 '
 
 test_expect_success 'prompt - pc mode' '
-	printf "BEFORE: (\${__git_ps1_branch_name}):AFTER\\nmaster" >expected &&
+	printf "BEFORE: (\${__git_ps1_branch_name}):AFTER\\nmain" >expected &&
 	(
 		__git_ps1 "BEFORE:" ":AFTER" >"$actual" &&
 		test_must_be_empty "$actual" &&
@@ -538,7 +538,7 @@ test_expect_success 'prompt - pc mode' '
 '
 
 test_expect_success 'prompt - bash color pc mode - branch name' '
-	printf "BEFORE: (${c_green}\${__git_ps1_branch_name}${c_clear}):AFTER\\nmaster" >expected &&
+	printf "BEFORE: (${c_green}\${__git_ps1_branch_name}${c_clear}):AFTER\\nmain" >expected &&
 	(
 		GIT_PS1_SHOWCOLORHINTS=y &&
 		__git_ps1 "BEFORE:" ":AFTER" >"$actual" &&
@@ -550,7 +550,7 @@ test_expect_success 'prompt - bash color pc mode - branch name' '
 test_expect_success 'prompt - bash color pc mode - detached head' '
 	printf "BEFORE: (${c_red}\${__git_ps1_branch_name}${c_clear}):AFTER\\n(%s...)" $(git log -1 --format="%h" b1^) >expected &&
 	git checkout b1^ &&
-	test_when_finished "git checkout master" &&
+	test_when_finished "git checkout main" &&
 	(
 		GIT_PS1_SHOWCOLORHINTS=y &&
 		__git_ps1 "BEFORE:" ":AFTER" &&
@@ -560,7 +560,7 @@ test_expect_success 'prompt - bash color pc mode - detached head' '
 '
 
 test_expect_success 'prompt - bash color pc mode - dirty status indicator - dirty worktree' '
-	printf "BEFORE: (${c_green}\${__git_ps1_branch_name}${c_clear} ${c_red}*${c_clear}):AFTER\\nmaster" >expected &&
+	printf "BEFORE: (${c_green}\${__git_ps1_branch_name}${c_clear} ${c_red}*${c_clear}):AFTER\\nmain" >expected &&
 	echo "dirty" >file &&
 	test_when_finished "git reset --hard" &&
 	(
@@ -573,7 +573,7 @@ test_expect_success 'prompt - bash color pc mode - dirty status indicator - dirt
 '
 
 test_expect_success 'prompt - bash color pc mode - dirty status indicator - dirty index' '
-	printf "BEFORE: (${c_green}\${__git_ps1_branch_name}${c_clear} ${c_green}+${c_clear}):AFTER\\nmaster" >expected &&
+	printf "BEFORE: (${c_green}\${__git_ps1_branch_name}${c_clear} ${c_green}+${c_clear}):AFTER\\nmain" >expected &&
 	echo "dirty" >file &&
 	test_when_finished "git reset --hard" &&
 	git add -u &&
@@ -587,7 +587,7 @@ test_expect_success 'prompt - bash color pc mode - dirty status indicator - dirt
 '
 
 test_expect_success 'prompt - bash color pc mode - dirty status indicator - dirty index and worktree' '
-	printf "BEFORE: (${c_green}\${__git_ps1_branch_name}${c_clear} ${c_red}*${c_green}+${c_clear}):AFTER\\nmaster" >expected &&
+	printf "BEFORE: (${c_green}\${__git_ps1_branch_name}${c_clear} ${c_red}*${c_green}+${c_clear}):AFTER\\nmain" >expected &&
 	echo "dirty index" >file &&
 	test_when_finished "git reset --hard" &&
 	git add -u &&
@@ -602,7 +602,7 @@ test_expect_success 'prompt - bash color pc mode - dirty status indicator - dirt
 '
 
 test_expect_success 'prompt - bash color pc mode - dirty status indicator - before root commit' '
-	printf "BEFORE: (${c_green}\${__git_ps1_branch_name}${c_clear} ${c_green}#${c_clear}):AFTER\\nmaster" >expected &&
+	printf "BEFORE: (${c_green}\${__git_ps1_branch_name}${c_clear} ${c_green}#${c_clear}):AFTER\\nmain" >expected &&
 	(
 		GIT_PS1_SHOWDIRTYSTATE=y &&
 		GIT_PS1_SHOWCOLORHINTS=y &&
@@ -628,7 +628,7 @@ test_expect_success 'prompt - bash color pc mode - inside .git directory' '
 '
 
 test_expect_success 'prompt - bash color pc mode - stash status indicator' '
-	printf "BEFORE: (${c_green}\${__git_ps1_branch_name}${c_clear} ${c_lblue}\$${c_clear}):AFTER\\nmaster" >expected &&
+	printf "BEFORE: (${c_green}\${__git_ps1_branch_name}${c_clear} ${c_lblue}\$${c_clear}):AFTER\\nmain" >expected &&
 	echo 2 >file &&
 	git stash &&
 	test_when_finished "git stash drop" &&
@@ -642,7 +642,7 @@ test_expect_success 'prompt - bash color pc mode - stash status indicator' '
 '
 
 test_expect_success 'prompt - bash color pc mode - untracked files status indicator' '
-	printf "BEFORE: (${c_green}\${__git_ps1_branch_name}${c_clear} ${c_red}%%${c_clear}):AFTER\\nmaster" >expected &&
+	printf "BEFORE: (${c_green}\${__git_ps1_branch_name}${c_clear} ${c_red}%%${c_clear}):AFTER\\nmain" >expected &&
 	(
 		GIT_PS1_SHOWUNTRACKEDFILES=y &&
 		GIT_PS1_SHOWCOLORHINTS=y &&
@@ -653,7 +653,7 @@ test_expect_success 'prompt - bash color pc mode - untracked files status indica
 '
 
 test_expect_success 'prompt - zsh color pc mode' '
-	printf "BEFORE: (%%F{green}master%%f):AFTER" >expected &&
+	printf "BEFORE: (%%F{green}main%%f):AFTER" >expected &&
 	(
 		ZSH_VERSION=5.0.0 &&
 		GIT_PS1_SHOWCOLORHINTS=y &&
@@ -664,7 +664,7 @@ test_expect_success 'prompt - zsh color pc mode' '
 '
 
 test_expect_success 'prompt - hide if pwd ignored - env var unset, config disabled' '
-	printf " (master)" >expected &&
+	printf " (main)" >expected &&
 	test_config bash.hideIfPwdIgnored false &&
 	(
 		cd ignored_dir &&
@@ -685,7 +685,7 @@ test_expect_success 'prompt - hide if pwd ignored - env var unset, config disabl
 '
 
 test_expect_success 'prompt - hide if pwd ignored - env var unset, config unset' '
-	printf " (master)" >expected &&
+	printf " (main)" >expected &&
 	(
 		cd ignored_dir &&
 		__git_ps1 >"$actual"
@@ -704,7 +704,7 @@ test_expect_success 'prompt - hide if pwd ignored - env var unset, config unset,
 '
 
 test_expect_success 'prompt - hide if pwd ignored - env var set, config disabled' '
-	printf " (master)" >expected &&
+	printf " (main)" >expected &&
 	test_config bash.hideIfPwdIgnored false &&
 	(
 		cd ignored_dir &&
t/test-lib.sh +2 -2
index 173880196e..cbd5ca7944 100644
@@ -257,13 +257,13 @@ case "$TRASH_DIRECTORY" in
 esac
 
 case "$TEST_NUMBER" in
-3404|4013|5310|6300|7064|7817)
+3404|4013|5310|6300|7064|7817|9902)
 	# Avoid conflicts with patch series that are cooking at the same time
 	# as the patch series changing the default of `init.defaultBranch`.
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
-[0-8]*|9[0-8]*)
+*)
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
Signature · 1 line
gitgitgadget
#26 lore raw

PATCH 23/28 t9[0-4]*: adjust the references to the default branch name "main"

In reply to Johannes Schindelin via GitGitGadget

From: Johannes Schindelin <[email protected]>

This trick was performed via

	$ (cd t &&
	   sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
		-e 's/Master/Main/g' -- t9[0-4]*.sh)

This allows us to define GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main for those tests.

---
 t/t9001-send-email.sh                  | 28 ++++-----
 t/t9100-git-svn-basic.sh               |  2 +-
 t/t9145-git-svn-master-branch.sh       |  6 +-
 t/t9151-svn-mergeinfo.sh               |  2 +-
 t/t9155-git-svn-fetch-deleted-tag.sh   |  2 +-
 t/t9156-git-svn-fetch-deleted-tag-2.sh |  6 +-
 t/t9163-git-svn-reset-clears-caches.sh |  2 +-
 t/t9169-git-svn-dcommit-crlf.sh        |  2 +-
 t/t9300-fast-import.sh                 | 82 ++++++++++++------------
 t/t9301-fast-import-notes.sh           | 14 ++---
 t/t9302-fast-import-unpack-limit.sh    | 16 ++---
 t/t9350-fast-export.sh                 | 86 +++++++++++++-------------
 t/t9351-fast-export-anonymize.sh       |  4 +-
 t/t9400-git-cvsserver-server.sh        | 32 +++++-----
 t/t9401-git-cvsserver-crlf.sh          | 16 ++---
 t/t9402-git-cvsserver-refs.sh          |  8 +--
 t/test-lib.sh                          |  2 +-
 17 files changed, 155 insertions(+), 155 deletions(-)
t/t9001-send-email.sh +14 -14
index a08f72596a..579360d2f1 100755
@@ -1168,10 +1168,10 @@ test_expect_success $PREREQ '--compose-encoding adds correct MIME for subject' '
 '
 
 test_expect_success $PREREQ 'detects ambiguous reference/file conflict' '
-	echo master >master &&
-	git add master &&
-	git commit -m"add master" &&
-	test_must_fail git send-email --dry-run master 2>errors &&
+	echo main >main &&
+	git add main &&
+	git commit -m"add main" &&
+	test_must_fail git send-email --dry-run main 2>errors &&
 	grep disambiguate errors
 '
 
@@ -1185,7 +1185,7 @@ test_expect_success $PREREQ 'feed two files' '
 		outdir/000?-*.patch 2>errors >out &&
 	grep "^Subject: " out >subjects &&
 	test "z$(sed -n -e 1p subjects)" = "zSubject: [PATCH 1/2] Second." &&
-	test "z$(sed -n -e 2p subjects)" = "zSubject: [PATCH 2/2] add master"
+	test "z$(sed -n -e 2p subjects)" = "zSubject: [PATCH 2/2] add main"
 '
 
 test_expect_success $PREREQ 'in-reply-to but no threading' '
@@ -2037,7 +2037,7 @@ test_expect_success $PREREQ 'setup expected-list' '
 	--cc="Cc2 <[email protected]>" \
 	--bcc="[email protected]" \
 	--bcc="[email protected]" \
-	0001-add-master.patch | replace_variable_fields \
+	0001-add-main.patch | replace_variable_fields \
 	>expected-list
 '
 
@@ -2049,7 +2049,7 @@ test_expect_success $PREREQ 'use email list in --cc --to and --bcc' '
 	--to="[email protected]" \
 	--cc="Cc 1 <[email protected]>, Cc2 <[email protected]>" \
 	--bcc="[email protected], [email protected]" \
-	0001-add-master.patch | replace_variable_fields \
+	0001-add-main.patch | replace_variable_fields \
 	>actual-list &&
 	test_cmp expected-list actual-list
 '
@@ -2065,7 +2065,7 @@ test_expect_success $PREREQ 'aliases work with email list' '
 	--to="To 1 <[email protected]>, to2, [email protected]" \
 	--cc="cc1, Cc2 <[email protected]>" \
 	--bcc="[email protected], [email protected]" \
-	0001-add-master.patch | replace_variable_fields \
+	0001-add-main.patch | replace_variable_fields \
 	>actual-list &&
 	test_cmp expected-list actual-list
 '
@@ -2089,7 +2089,7 @@ test_expect_success $PREREQ 'leading and trailing whitespaces are removed' '
 	--cc="Cc2 <[email protected]>" \
 	--bcc="$BCC1" \
 	--bcc="[email protected]" \
-	0001-add-master.patch | replace_variable_fields \
+	0001-add-main.patch | replace_variable_fields \
 	>actual-list &&
 	test_cmp expected-list actual-list
 '
@@ -2108,8 +2108,8 @@ test_expect_success $PREREQ 'invoke hook' '
 		false
 		;;
 	esac &&
-	test -f 0001-add-master.patch &&
-	grep "add master" "$1"
+	test -f 0001-add-main.patch &&
+	grep "add main" "$1"
 	EOF
 
 	mkdir subdir &&
@@ -2121,10 +2121,10 @@ test_expect_success $PREREQ 'invoke hook' '
 			--from="Example <[email protected]>" \
 			[email protected] \
 			--smtp-server="$(pwd)/../fake.sendmail" \
-			../0001-add-master.patch &&
+			../0001-add-main.patch &&
 
 		# Verify error message when a patch is rejected by the hook
-		sed -e "s/add master/x/" ../0001-add-master.patch >../another.patch &&
+		sed -e "s/add main/x/" ../0001-add-main.patch >../another.patch &&
 		test_must_fail git send-email \
 			--from="Example <[email protected]>" \
 			[email protected] \
@@ -2139,7 +2139,7 @@ test_expect_success $PREREQ 'test that send-email works outside a repo' '
 		--from="Example <[email protected]>" \
 		[email protected] \
 		--smtp-server="$(pwd)/fake.sendmail" \
-		"$(pwd)/0001-add-master.patch"
+		"$(pwd)/0001-add-main.patch"
 '
 
 test_expect_success $PREREQ 'test that sendmail config is rejected' '
t/t9100-git-svn-basic.sh +1 -1
index e4bb22034e..7dbf4b8fa0 100755
@@ -275,7 +275,7 @@ test_expect_success 'dcommit $rev does not clobber current branch' '
 	test refs/heads/my-bar = $(git symbolic-ref HEAD) &&
 	git log refs/remotes/bar | grep "change 1" &&
 	! git log refs/remotes/bar | grep "change 2" &&
-	git checkout master &&
+	git checkout main &&
 	git branch -D my-bar
 	'
 
t/t9145-git-svn-master-branch.sh +3 -3
index 3bbf341f6a..c5acce010d 100755
@@ -2,7 +2,7 @@
 #
 # Copyright (c) 2009 Eric Wong
 #
-test_description='git svn initial master branch is "trunk" if possible'
+test_description='git svn initial main branch is "trunk" if possible'
 . ./lib-git-svn.sh
 
 test_expect_success 'setup test repository' '
@@ -13,12 +13,12 @@ test_expect_success 'setup test repository' '
 	svn_cmd import -m b/b i "$svnrepo/branches/b"
 '
 
-test_expect_success 'git svn clone --stdlayout sets up trunk as master' '
+test_expect_success 'git svn clone --stdlayout sets up trunk as main' '
 	git svn clone -s "$svnrepo" g &&
 	(
 		cd g &&
 		test x$(git rev-parse --verify refs/remotes/origin/trunk^0) = \
-		     x$(git rev-parse --verify refs/heads/master^0)
+		     x$(git rev-parse --verify refs/heads/main^0)
 	)
 '
 
t/t9151-svn-mergeinfo.sh +1 -1
index 4f6c06ecb2..e2f63823f1 100755
@@ -50,7 +50,7 @@ test_expect_success 'merging two branches in one commit is detected correctly' '
 	'
 
 test_expect_failure 'everything got merged in the end' '
-	unmerged=$(git rev-list --all --not master) &&
+	unmerged=$(git rev-list --all --not main) &&
 	[ -z "$unmerged" ]
 	'
 
t/t9155-git-svn-fetch-deleted-tag.sh +1 -1
index 184336f346..891c209238 100755
@@ -36,7 +36,7 @@ test_expect_success 'fetch deleted tags from same revision with checksum error'
 	git svn fetch &&
 
 	git diff --exit-code origin/mybranch:trunk/subdir/file origin/tags/mytag:file &&
-	git diff --exit-code master:subdir/file origin/tags/mytag^:file
+	git diff --exit-code main:subdir/file origin/tags/mytag^:file
 '
 
 test_done
t/t9156-git-svn-fetch-deleted-tag-2.sh +3 -3
index 7a6e33ba3c..0b91063edb 100755
@@ -36,9 +36,9 @@ test_expect_success 'fetch deleted tags from same revision with no checksum erro
 	cd git_project &&
 	git svn fetch &&
 
-	git diff --exit-code master:subdir3/file origin/tags/mytag:file &&
-	git diff --exit-code master:subdir2/file origin/tags/mytag^:file &&
-	git diff --exit-code master:subdir1/file origin/tags/mytag^^:file
+	git diff --exit-code main:subdir3/file origin/tags/mytag:file &&
+	git diff --exit-code main:subdir2/file origin/tags/mytag^:file &&
+	git diff --exit-code main:subdir1/file origin/tags/mytag^^:file
 '
 
 test_done
t/t9163-git-svn-reset-clears-caches.sh +1 -1
index d6245cee08..0da856338f 100755
@@ -59,7 +59,7 @@ test_expect_success 'fetch to merge-base (a)' '
 test_expect_success 'rebase looses SVN merge (m)' '
 	git svn rebase &&
 	git svn fetch &&
-	test 1 = $(git cat-file -p master|grep parent|wc -l)
+	test 1 = $(git cat-file -p main|grep parent|wc -l)
 '
 
 # git svn fetch creates correct history with merge commit
t/t9169-git-svn-dcommit-crlf.sh +1 -1
index 54b1f61a2a..5016896ae6 100755
@@ -14,7 +14,7 @@ test_expect_success 'setup commit repository' '
 		p=$(git rev-parse HEAD) &&
 		t=$(git write-tree) &&
 		cmt=$(git commit-tree -p $p $t <cmt) &&
-		git update-ref refs/heads/master $cmt &&
+		git update-ref refs/heads/main $cmt &&
 		git cat-file commit HEAD | tail -n4 >out &&
 		test_cmp cmt out &&
 		git svn dcommit &&
t/t9300-fast-import.sh +41 -41

264 lines not on this page · raw message

t/t9301-fast-import-notes.sh +7 -7
index 14c1baa739..ea6efbd387 100755
@@ -9,7 +9,7 @@ test_description='test git fast-import of notes objects'
 
 test_tick
 cat >input <<INPUT_END
-commit refs/heads/master
+commit refs/heads/main
 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
 data <<COMMIT
 first commit
@@ -30,7 +30,7 @@ data <<EOF
 file baz/xyzzy in first commit
 EOF
 
-commit refs/heads/master
+commit refs/heads/main
 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
 data <<COMMIT
 second commit
@@ -46,7 +46,7 @@ data <<EOF
 file baz/xyzzy in second commit
 EOF
 
-commit refs/heads/master
+commit refs/heads/main
 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
 data <<COMMIT
 third commit
@@ -57,7 +57,7 @@ data <<EOF
 file foo in third commit
 EOF
 
-commit refs/heads/master
+commit refs/heads/main
 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
 data <<COMMIT
 fourth commit
@@ -70,13 +70,13 @@ EOF
 
 INPUT_END
 
-test_expect_success 'set up master branch' '
+test_expect_success 'set up main branch' '
 
 	git fast-import <input &&
-	git whatchanged master
+	git whatchanged main
 '
 
-commit4=$(git rev-parse refs/heads/master)
+commit4=$(git rev-parse refs/heads/main)
 commit3=$(git rev-parse "$commit4^")
 commit2=$(git rev-parse "$commit4~2")
 commit1=$(git rev-parse "$commit4~3")
t/t9302-fast-import-unpack-limit.sh +8 -8
index bb1c39cfcc..f519e4f1bf 100755
@@ -5,7 +5,7 @@ test_description='test git fast-import unpack limit'
 test_expect_success 'create loose objects on import' '
 	test_tick &&
 	cat >input <<-INPUT_END &&
-	commit refs/heads/master
+	commit refs/heads/main
 	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
 	data <<COMMIT
 	initial
@@ -23,12 +23,12 @@ test_expect_success 'create loose objects on import' '
 test_expect_success 'bigger packs are preserved' '
 	test_tick &&
 	cat >input <<-INPUT_END &&
-	commit refs/heads/master
+	commit refs/heads/main
 	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
 	data <<COMMIT
 	incremental should create a pack
 	COMMIT
-	from refs/heads/master^0
+	from refs/heads/main^0
 
 	commit refs/heads/branch
 	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
@@ -48,7 +48,7 @@ test_expect_success 'bigger packs are preserved' '
 test_expect_success 'lookups after checkpoint works' '
 	hello_id=$(echo hello | git hash-object --stdin -t blob) &&
 	id="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE" &&
-	before=$(git rev-parse refs/heads/master^0) &&
+	before=$(git rev-parse refs/heads/main^0) &&
 	(
 		cat <<-INPUT_END &&
 		blob
@@ -56,13 +56,13 @@ test_expect_success 'lookups after checkpoint works' '
 		data 6
 		hello
 
-		commit refs/heads/master
+		commit refs/heads/main
 		mark :2
 		committer $id
 		data <<COMMIT
 		checkpoint after this
 		COMMIT
-		from refs/heads/master^0
+		from refs/heads/main^0
 		M 100644 :1 hello
 
 		# pre-checkpoint
@@ -86,10 +86,10 @@ test_expect_success 'lookups after checkpoint works' '
 				n=$(($n + 1))
 			fi &&
 			sleep 1 &&
-			from=$(git rev-parse refs/heads/master^0)
+			from=$(git rev-parse refs/heads/main^0)
 		done &&
 		cat <<-INPUT_END &&
-		commit refs/heads/master
+		commit refs/heads/main
 		committer $id
 		data <<COMMIT
 		make sure from "unpacked sha1 reference" works, too
t/t9350-fast-export.sh +43 -43

235 lines not on this page · raw message

t/t9351-fast-export-anonymize.sh +2 -2
index 5ac2c3b5ee..c07175db47 100755
@@ -51,7 +51,7 @@ test_expect_success 'stream retains other as refname' '
 '
 
 test_expect_success 'stream omits other refnames' '
-	! grep master stream &&
+	! grep main stream &&
 	! grep mytag stream
 '
 
@@ -85,7 +85,7 @@ test_expect_success 'repo has original shape and timestamps' '
 	shape () {
 		git log --format="%m %ct" --left-right --boundary "$@"
 	} &&
-	(cd .. && shape master...other) >expect &&
+	(cd .. && shape main...other) >expect &&
 	shape $main_branch...$other_branch >actual &&
 	test_cmp expect actual
 '
t/t9400-git-cvsserver-server.sh +16 -16
index 4a46f31c41..9aa49c6906 100755
@@ -45,7 +45,7 @@ test_expect_success 'setup' '
   touch secondrootfile &&
   git add secondrootfile &&
   git commit -m "second root") &&
-  git fetch secondroot master &&
+  git fetch secondroot main &&
   git merge --allow-unrelated-histories FETCH_HEAD &&
   git clone -q --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 &&
   GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true &&
@@ -57,7 +57,7 @@ test_expect_success 'setup' '
 # note that cvs doesn't accept absolute pathnames
 # as argument to co -d
 test_expect_success 'basic checkout' \
-  'GIT_CONFIG="$git_config" cvs -Q co -d cvswork master &&
+  'GIT_CONFIG="$git_config" cvs -Q co -d cvswork main &&
    test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | head -n 1))" = "empty/1.1/" &&
    test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | sed -ne \$p))" = "secondrootfile/1.1/"'
 
@@ -226,7 +226,7 @@ GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true || exit 1
 
 test_expect_success 'gitcvs.enabled = false' \
   'GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false &&
-   if GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1
+   if GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1
    then
      echo unexpected cvs success
      false
@@ -240,14 +240,14 @@ rm -fr cvswork2
 test_expect_success 'gitcvs.ext.enabled = true' \
   'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
    GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false &&
-   GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&
+   GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1 &&
    test_cmp cvswork cvswork2'
 
 rm -fr cvswork2
 test_expect_success 'gitcvs.ext.enabled = false' \
   'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled false &&
    GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true &&
-   if GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1
+   if GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1
    then
      echo unexpected cvs success
      false
@@ -261,21 +261,21 @@ rm -fr cvswork2
 test_expect_success 'gitcvs.dbname' \
   'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
    GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs.%a.%m.sqlite &&
-   GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&
+   GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1 &&
    test_cmp cvswork cvswork2 &&
-   test -f "$SERVERDIR/gitcvs.ext.master.sqlite" &&
-   cmp "$SERVERDIR/gitcvs.master.sqlite" "$SERVERDIR/gitcvs.ext.master.sqlite"'
+   test -f "$SERVERDIR/gitcvs.ext.main.sqlite" &&
+   cmp "$SERVERDIR/gitcvs.main.sqlite" "$SERVERDIR/gitcvs.ext.main.sqlite"'
 
 rm -fr cvswork2
 test_expect_success 'gitcvs.ext.dbname' \
   'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
    GIT_DIR="$SERVERDIR" git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite &&
    GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite &&
-   GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&
+   GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1 &&
    test_cmp cvswork cvswork2 &&
-   test -f "$SERVERDIR/gitcvs1.ext.master.sqlite" &&
-   test ! -f "$SERVERDIR/gitcvs2.ext.master.sqlite" &&
-   cmp "$SERVERDIR/gitcvs.master.sqlite" "$SERVERDIR/gitcvs1.ext.master.sqlite"'
+   test -f "$SERVERDIR/gitcvs1.ext.main.sqlite" &&
+   test ! -f "$SERVERDIR/gitcvs2.ext.main.sqlite" &&
+   cmp "$SERVERDIR/gitcvs.main.sqlite" "$SERVERDIR/gitcvs1.ext.main.sqlite"'
 
 
 #------------
@@ -457,7 +457,7 @@ cd "$WORKDIR"
 test_expect_success 'cvs update (module list supports packed refs)' '
     GIT_DIR="$SERVERDIR" git pack-refs --all &&
     GIT_CONFIG="$git_config" cvs -n up -d 2> out &&
-    grep "cvs update: New directory \`master'\''" < out
+    grep "cvs update: New directory \`main'\''" < out
 '
 
 #------------
@@ -499,8 +499,8 @@ test_expect_success 'cvs status (no subdirs in header)' '
 cd "$WORKDIR"
 test_expect_success 'cvs co -c (shows module database)' '
     GIT_CONFIG="$git_config" cvs co -c > out &&
-    grep "^master[	 ][ 	]*master$" <out &&
-    ! grep -v "^master[	 ][ 	]*master$" <out
+    grep "^main[	 ][ 	]*main$" <out &&
+    ! grep -v "^main[	 ][ 	]*main$" <out
 '
 
 #------------
@@ -526,7 +526,7 @@ test_expect_success 'cvs co -c (shows module database)' '
 
 sed -e 's/^x//' -e 's/SP$/ /' > "$WORKDIR/expect" <<EOF
 x
-xRCS file: $WORKDIR/gitcvs.git/master/merge,v
+xRCS file: $WORKDIR/gitcvs.git/main/merge,v
 xWorking file: merge
 xhead: 1.4
 xbranch:
t/t9401-git-cvsserver-crlf.sh +8 -8
index c7a0dd84a4..8046a25b1f 100755
@@ -105,14 +105,14 @@ test_expect_success 'setup' '
 '
 
 test_expect_success 'cvs co (default crlf)' '
-    GIT_CONFIG="$git_config" cvs -Q co -d cvswork master >cvs.log 2>&1 &&
+    GIT_CONFIG="$git_config" cvs -Q co -d cvswork main >cvs.log 2>&1 &&
     test x"$(grep '/-k' cvswork/CVS/Entries cvswork/subdir/CVS/Entries)" = x""
 '
 
 rm -rf cvswork
 test_expect_success 'cvs co (allbinary)' '
     GIT_DIR="$SERVERDIR" git config --bool gitcvs.allbinary true &&
-    GIT_CONFIG="$git_config" cvs -Q co -d cvswork master >cvs.log 2>&1 &&
+    GIT_CONFIG="$git_config" cvs -Q co -d cvswork main >cvs.log 2>&1 &&
     marked_as cvswork textfile.c -kb &&
     marked_as cvswork binfile.bin -kb &&
     marked_as cvswork .gitattributes -kb &&
@@ -125,7 +125,7 @@ test_expect_success 'cvs co (allbinary)' '
 rm -rf cvswork cvs.log
 test_expect_success 'cvs co (use attributes/allbinary)' '
     GIT_DIR="$SERVERDIR" git config --bool gitcvs.usecrlfattr true &&
-    GIT_CONFIG="$git_config" cvs -Q co -d cvswork master >cvs.log 2>&1 &&
+    GIT_CONFIG="$git_config" cvs -Q co -d cvswork main >cvs.log 2>&1 &&
     marked_as cvswork textfile.c "" &&
     marked_as cvswork binfile.bin -kb &&
     marked_as cvswork .gitattributes -kb &&
@@ -138,7 +138,7 @@ test_expect_success 'cvs co (use attributes/allbinary)' '
 rm -rf cvswork
 test_expect_success 'cvs co (use attributes)' '
     GIT_DIR="$SERVERDIR" git config --bool gitcvs.allbinary false &&
-    GIT_CONFIG="$git_config" cvs -Q co -d cvswork master >cvs.log 2>&1 &&
+    GIT_CONFIG="$git_config" cvs -Q co -d cvswork main >cvs.log 2>&1 &&
     marked_as cvswork textfile.c "" &&
     marked_as cvswork binfile.bin -kb &&
     marked_as cvswork .gitattributes "" &&
@@ -194,7 +194,7 @@ test_expect_success 'updating' '
 rm -rf cvswork
 test_expect_success 'cvs co (use attributes/guess)' '
     GIT_DIR="$SERVERDIR" git config gitcvs.allbinary guess &&
-    GIT_CONFIG="$git_config" cvs -Q co -d cvswork master >cvs.log 2>&1 &&
+    GIT_CONFIG="$git_config" cvs -Q co -d cvswork main >cvs.log 2>&1 &&
     marked_as cvswork textfile.c "" &&
     marked_as cvswork binfile.bin -kb &&
     marked_as cvswork .gitattributes "" &&
@@ -224,7 +224,7 @@ test_expect_success 'setup multi-line files' '
 rm -rf cvswork
 test_expect_success 'cvs co (guess)' '
     GIT_DIR="$SERVERDIR" git config --bool gitcvs.usecrlfattr false &&
-    GIT_CONFIG="$git_config" cvs -Q co -d cvswork master >cvs.log 2>&1 &&
+    GIT_CONFIG="$git_config" cvs -Q co -d cvswork main >cvs.log 2>&1 &&
     marked_as cvswork textfile.c "" &&
     marked_as cvswork binfile.bin -kb &&
     marked_as cvswork .gitattributes "" &&
@@ -239,7 +239,7 @@ test_expect_success 'cvs co (guess)' '
 '
 
 test_expect_success 'cvs co another copy (guess)' '
-    GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&
+    GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1 &&
     marked_as cvswork2 textfile.c "" &&
     marked_as cvswork2 binfile.bin -kb &&
     marked_as cvswork2 .gitattributes "" &&
@@ -335,7 +335,7 @@ test_expect_success 'update subdir of other copy (guess)' '
 
 echo "starting update/merge" >> "${WORKDIR}/marked.log"
 test_expect_success 'update/merge full other copy (guess)' '
-    git pull gitcvs.git master &&
+    git pull gitcvs.git main &&
     sed "s/3/replaced_3/" < multilineTxt.c > ml.temp &&
     mv ml.temp multilineTxt.c &&
     git add multilineTxt.c &&
t/t9402-git-cvsserver-refs.sh +4 -4
index 6436c91a3c..3b30b02bd1 100755
@@ -115,7 +115,7 @@ test_expect_success 'setup v1, b1' '
 
 rm -rf cvswork
 test_expect_success 'cvs co v1' '
-	cvs -f -Q co -r v1 -d cvswork master >cvs.log 2>&1 &&
+	cvs -f -Q co -r v1 -d cvswork main >cvs.log 2>&1 &&
 	check_start_tree cvswork &&
 	check_file cvswork textfile.c v1 &&
 	check_file cvswork t2 v1 &&
@@ -128,7 +128,7 @@ test_expect_success 'cvs co v1' '
 
 rm -rf cvswork
 test_expect_success 'cvs co b1' '
-	cvs -f co -r b1 -d cvswork master >cvs.log 2>&1 &&
+	cvs -f co -r b1 -d cvswork main >cvs.log 2>&1 &&
 	check_start_tree cvswork &&
 	check_file cvswork textfile.c v1 &&
 	check_file cvswork t2 v1 &&
@@ -140,7 +140,7 @@ test_expect_success 'cvs co b1' '
 '
 
 test_expect_success 'cvs co b1 [cvswork3]' '
-	cvs -f co -r b1 -d cvswork3 master >cvs.log 2>&1 &&
+	cvs -f co -r b1 -d cvswork3 main >cvs.log 2>&1 &&
 	check_start_tree cvswork3 &&
 	check_file cvswork3 textfile.c v1 &&
 	check_file cvswork3 t2 v1 &&
@@ -265,7 +265,7 @@ test_expect_success 'setup simple b2' '
 '
 
 test_expect_success 'cvs co b2 [into cvswork2]' '
-	cvs -f co -r b2 -d cvswork2 master >cvs.log 2>&1 &&
+	cvs -f co -r b2 -d cvswork2 main >cvs.log 2>&1 &&
 	check_start_tree cvswork &&
 	check_file cvswork textfile.c v1 &&
 	check_file cvswork t2 v1 &&
t/test-lib.sh +1 -1
index 4ddfb9e3ee..a2b539aa30 100644
@@ -263,7 +263,7 @@ case "$TEST_NUMBER" in
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
-[0-8]*)
+[0-8]*|9[0-4]*)
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
Signature · 1 line
gitgitgadget
#11 lore raw

PATCH 11/28 t5503: prepare aligned comment for replacing `master` with `main`

In reply to Johannes Schindelin via GitGitGadget

From: Johannes Schindelin <[email protected]>

In an upcoming commit, we will use main as the default branch name in t5503 instead of master. This will require extra padding in ASCII-art commit graphs, which we hereby add preemptively.

By doing this preemptively rather than after the commit applying the search-and-replace, it is more obvious that we caught all aligned comments that are affected by the latter commit.

---
 t/t5503-tagfollow.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
t/t5503-tagfollow.sh +1 -1
index 6041a4dd32..6dafbe4543 100755
@@ -11,7 +11,7 @@ test_description='test automatic tag following'
 #   L - A ------ O ------ B
 #    \   \                 \
 #     \   C - origin/cat    \
-#      origin/master         master
+#      origin/master           master
 
 test_expect_success setup '
 	test_tick &&
Signature · 1 line
gitgitgadget
#14 lore raw

PATCH 14/28 t55[23]*: adjust the references to the default branch name "main"

In reply to Johannes Schindelin via GitGitGadget

From: Johannes Schindelin <[email protected]>

This trick was performed via

	$ (cd t &&
	   sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
		-e 's/Master/Main/g' -e 's/naster/nain/g' -- t55[23]*.sh)

Note that t5533 contains a variation of the name master (naster) that we rename here, too.

This commit allows us to define GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main for that range of tests.

---
 t/t5520-pull.sh                |  30 +++---
 t/t5521-pull-options.sh        |  16 +--
 t/t5523-push-upstream.sh       |  30 +++---
 t/t5526-fetch-submodules.sh    |   6 +-
 t/t5527-fetch-odd-refs.sh      |  14 +--
 t/t5528-push-default.sh        |  98 ++++++++---------
 t/t5529-push-errors.sh         |   2 +-
 t/t5530-upload-pack-error.sh   |   2 +-
 t/t5531-deep-submodule-push.sh | 188 ++++++++++++++++-----------------
 t/t5533-push-cas.sh            | 142 ++++++++++++-------------
 t/t5534-push-signed.sh         |   4 +-
 t/t5537-fetch-shallow.sh       |  30 +++---
 t/t5538-push-shallow.sh        |  22 ++--
 t/t5539-fetch-http-shallow.sh  |  14 +--
 t/test-lib.sh                  |   2 +-
 15 files changed, 300 insertions(+), 300 deletions(-)
t/t5520-pull.sh +15 -15
index 9fae07cdfa..3be99df66d 100755
@@ -48,11 +48,11 @@ test_expect_success 'pulling into void' '
 	test_cmp file cloned/file
 '
 
-test_expect_success 'pulling into void using master:master' '
+test_expect_success 'pulling into void using main:main' '
 	git init cloned-uho &&
 	(
 		cd cloned-uho &&
-		git pull .. master:master
+		git pull .. main:main
 	) &&
 	test_path_is_file file &&
 	test_path_is_file cloned-uho/file &&
@@ -64,7 +64,7 @@ test_expect_success 'pulling into void does not overwrite untracked files' '
 	(
 		cd cloned-untracked &&
 		echo untracked >file &&
-		test_must_fail git pull .. master &&
+		test_must_fail git pull .. main &&
 		echo untracked >expect &&
 		test_cmp expect file
 	)
@@ -76,7 +76,7 @@ test_expect_success 'pulling into void does not overwrite staged files' '
 		cd cloned-staged-colliding &&
 		echo "alternate content" >file &&
 		git add file &&
-		test_must_fail git pull .. master &&
+		test_must_fail git pull .. main &&
 		echo "alternate content" >expect &&
 		test_cmp expect file &&
 		git cat-file blob :file >file.index &&
@@ -90,7 +90,7 @@ test_expect_success 'pulling into void does not remove new staged files' '
 		cd cloned-staged-new &&
 		echo "new tracked file" >newfile &&
 		git add newfile &&
-		git pull .. master &&
+		git pull .. main &&
 		echo "new tracked file" >expect &&
 		test_cmp expect newfile &&
 		git cat-file blob :newfile >newfile.index &&
@@ -102,15 +102,15 @@ test_expect_success 'pulling into void must not create an octopus' '
 	git init cloned-octopus &&
 	(
 		cd cloned-octopus &&
-		test_must_fail git pull .. master master &&
+		test_must_fail git pull .. main main &&
 		test_path_is_missing file
 	)
 '
 
 test_expect_success 'test . as a remote' '
-	git branch copy master &&
+	git branch copy main &&
 	git config branch.copy.remote . &&
-	git config branch.copy.merge refs/heads/master &&
+	git config branch.copy.merge refs/heads/main &&
 	echo updated >file &&
 	git commit -a -m updated &&
 	git checkout copy &&
@@ -126,7 +126,7 @@ test_expect_success 'test . as a remote' '
 '
 
 test_expect_success 'the default remote . should not break explicit pull' '
-	git checkout -b second master^ &&
+	git checkout -b second main^ &&
 	echo modified >file &&
 	git commit -a -m modified &&
 	git checkout copy &&
@@ -361,7 +361,7 @@ test_expect_success 'failed --rebase shows advice' '
 
 test_expect_success '--rebase fails with multiple branches' '
 	git reset --hard before-rebase &&
-	test_must_fail git pull --rebase . copy master 2>err &&
+	test_must_fail git pull --rebase . copy main 2>err &&
 	test_cmp_rev HEAD before-rebase &&
 	test_i18ngrep "Cannot rebase onto multiple branches" err &&
 	echo modified >expect &&
@@ -500,7 +500,7 @@ test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '
 	test_i18ngrep ! "verify-signatures" err
 '
 
-# add a feature branch, keep-merge, that is merged into master, so the
+# add a feature branch, keep-merge, that is merged into main, so the
 # test can try preserving the merge commit (or not) with various
 # --rebase flags/pull.rebase settings.
 test_expect_success 'preserve merge setup' '
@@ -699,12 +699,12 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '
 '
 
 test_expect_success 'pull --rebase works on branch yet to be born' '
-	git rev-parse master >expect &&
+	git rev-parse main >expect &&
 	mkdir empty_repo &&
 	(
 		cd empty_repo &&
 		git init &&
-		git pull --rebase .. master &&
+		git pull --rebase .. main &&
 		git rev-parse HEAD >../actual
 	) &&
 	test_cmp expect actual
@@ -720,7 +720,7 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' '
 		echo staged-file >expect &&
 		git ls-files >actual &&
 		test_cmp expect actual &&
-		test_must_fail git pull --rebase .. master 2>err &&
+		test_must_fail git pull --rebase .. main 2>err &&
 		git ls-files >actual &&
 		test_cmp expect actual &&
 		git show :staged-file >actual &&
@@ -779,7 +779,7 @@ test_expect_success 'setup for avoiding reapplying old patches' '
 	(
 		cd dst &&
 		test_might_fail git rebase --abort &&
-		git reset --hard origin/master
+		git reset --hard origin/main
 	) &&
 	git clone --bare src src-replace.git &&
 	rm -rf src &&
t/t5521-pull-options.sh +8 -8
index db1a381cd9..ae80aaa480 100755
@@ -99,13 +99,13 @@ test_expect_success 'git pull --force' '
 	cat >>.git/config <<-\EOF &&
 	[remote "one"]
 		url = ../parent
-		fetch = refs/heads/master:refs/heads/mirror
+		fetch = refs/heads/main:refs/heads/mirror
 	[remote "two"]
 		url = ../parent
-		fetch = refs/heads/master:refs/heads/origin
-	[branch "master"]
+		fetch = refs/heads/main:refs/heads/origin
+	[branch "main"]
 		remote = two
-		merge = refs/heads/master
+		merge = refs/heads/main
 	EOF
 	git pull two &&
 	test_commit A &&
@@ -124,9 +124,9 @@ test_expect_success 'git pull --all' '
 	[remote "two"]
 		url = ../parent
 		fetch = refs/heads/*:refs/remotes/two/*
-	[branch "master"]
+	[branch "main"]
 		remote = one
-		merge = refs/heads/master
+		merge = refs/heads/main
 	EOF
 	git pull --all
 	)
@@ -139,7 +139,7 @@ test_expect_success 'git pull --dry-run' '
 		cd clonedry &&
 		git pull --dry-run ../parent &&
 		test_path_is_missing .git/FETCH_HEAD &&
-		test_path_is_missing .git/refs/heads/master &&
+		test_path_is_missing .git/refs/heads/main &&
 		test_path_is_missing .git/index &&
 		test_path_is_missing file
 	)
@@ -153,7 +153,7 @@ test_expect_success 'git pull --all --dry-run' '
 		git remote add origin ../parent &&
 		git pull --all --dry-run &&
 		test_path_is_missing .git/FETCH_HEAD &&
-		test_path_is_missing .git/refs/remotes/origin/master &&
+		test_path_is_missing .git/refs/remotes/origin/main &&
 		test_path_is_missing .git/index &&
 		test_path_is_missing file
 	)
t/t5523-push-upstream.sh +15 -15
index e47b5db5d6..a2eaa877a2 100755
@@ -26,19 +26,19 @@ check_config() {
 	test_cmp expect.$1 actual.$1
 }
 
-test_expect_success 'push -u master:master' '
-	git push -u upstream master:master &&
-	check_config master upstream refs/heads/master
+test_expect_success 'push -u main:main' '
+	git push -u upstream main:main &&
+	check_config main upstream refs/heads/main
 '
 
-test_expect_success 'push -u master:other' '
-	git push -u upstream master:other &&
-	check_config master upstream refs/heads/other
+test_expect_success 'push -u main:other' '
+	git push -u upstream main:other &&
+	check_config main upstream refs/heads/other
 '
 
-test_expect_success 'push -u --dry-run master:otherX' '
-	git push -u --dry-run upstream master:otherX &&
-	check_config master upstream refs/heads/other
+test_expect_success 'push -u --dry-run main:otherX' '
+	git push -u --dry-run upstream main:otherX &&
+	check_config main upstream refs/heads/other
 '
 
 test_expect_success 'push -u topic_2:topic_2' '
@@ -74,7 +74,7 @@ test_expect_success 'push -u HEAD' '
 test_expect_success TTY 'progress messages go to tty' '
 	ensure_fresh_upstream &&
 
-	test_terminal git push -u upstream master >out 2>err &&
+	test_terminal git push -u upstream main >out 2>err &&
 	test_i18ngrep "Writing objects" err
 '
 
@@ -82,7 +82,7 @@ test_expect_success 'progress messages do not go to non-tty' '
 	ensure_fresh_upstream &&
 
 	# skip progress messages, since stderr is non-tty
-	git push -u upstream master >out 2>err &&
+	git push -u upstream main >out 2>err &&
 	test_i18ngrep ! "Writing objects" err
 '
 
@@ -90,21 +90,21 @@ test_expect_success 'progress messages go to non-tty (forced)' '
 	ensure_fresh_upstream &&
 
 	# force progress messages to stderr, even though it is non-tty
-	git push -u --progress upstream master >out 2>err &&
+	git push -u --progress upstream main >out 2>err &&
 	test_i18ngrep "Writing objects" err
 '
 
 test_expect_success TTY 'push -q suppresses progress' '
 	ensure_fresh_upstream &&
 
-	test_terminal git push -u -q upstream master >out 2>err &&
+	test_terminal git push -u -q upstream main >out 2>err &&
 	test_i18ngrep ! "Writing objects" err
 '
 
 test_expect_success TTY 'push --no-progress suppresses progress' '
 	ensure_fresh_upstream &&
 
-	test_terminal git push -u --no-progress upstream master >out 2>err &&
+	test_terminal git push -u --no-progress upstream main >out 2>err &&
 	test_i18ngrep ! "Unpacking objects" err &&
 	test_i18ngrep ! "Writing objects" err
 '
@@ -112,7 +112,7 @@ test_expect_success TTY 'push --no-progress suppresses progress' '
 test_expect_success TTY 'quiet push' '
 	ensure_fresh_upstream &&
 
-	test_terminal git push --quiet --no-progress upstream master 2>&1 | tee output &&
+	test_terminal git push --quiet --no-progress upstream main 2>&1 | tee output &&
 	test_must_be_empty output
 '
 
t/t5526-fetch-submodules.sh +3 -3
index dd8e423d25..f45ba02b8a 100755
@@ -481,7 +481,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH "don't fetch submodule when newly re
 	test_i18ncmp expect.err actual.err &&
 	(
 		cd submodule &&
-		git checkout -q master
+		git checkout -q main
 	)
 '
 
@@ -663,9 +663,9 @@ test_expect_success 'fetch new submodule commits on-demand without .gitmodules e
 	git config -f .gitmodules --remove-section submodule.sub1 &&
 	git add .gitmodules &&
 	git commit -m "delete gitmodules file" &&
-	git checkout -B master &&
+	git checkout -B main &&
 	git -C downstream fetch &&
-	git -C downstream checkout origin/master &&
+	git -C downstream checkout origin/main &&
 
 	C=$(git -C submodule commit-tree -m "yet another change outside refs/heads" HEAD^{tree}) &&
 	git -C submodule update-ref refs/changes/7 $C &&
t/t5527-fetch-odd-refs.sh +7 -7
index 3b0cb98422..c6a4db4c59 100755
@@ -5,13 +5,13 @@ test_description='test fetching of oddly-named refs'
 
 # afterwards we will have:
 #  HEAD - two
-#  refs/for/refs/heads/master - one
-#  refs/heads/master - three
+#  refs/for/refs/heads/main - one
+#  refs/heads/main - three
 test_expect_success 'setup repo with odd suffix ref' '
 	echo content >file &&
 	git add . &&
 	git commit -m one &&
-	git update-ref refs/for/refs/heads/master HEAD &&
+	git update-ref refs/for/refs/heads/main HEAD &&
 	echo content >>file &&
 	git commit -a -m two &&
 	echo content >>file &&
@@ -22,7 +22,7 @@ test_expect_success 'setup repo with odd suffix ref' '
 test_expect_success 'suffix ref is ignored during fetch' '
 	git clone --bare file://"$PWD" suffix &&
 	echo three >expect &&
-	git --git-dir=suffix log -1 --format=%s refs/heads/master >actual &&
+	git --git-dir=suffix log -1 --format=%s refs/heads/main >actual &&
 	test_cmp expect actual
 '
 
@@ -33,7 +33,7 @@ test_expect_success 'try to create repo with absurdly long refname' '
 	(
 		cd long &&
 		test_commit long &&
-		test_commit master
+		test_commit main
 	) &&
 	if git -C long update-ref refs/heads/$ref1440 long; then
 		test_set_prereq LONG_REF
@@ -46,7 +46,7 @@ test_expect_success LONG_REF 'fetch handles extremely long refname' '
 	git fetch long refs/heads/*:refs/remotes/long/* &&
 	cat >expect <<-\EOF &&
 	long
-	master
+	main
 	EOF
 	git for-each-ref --format="%(subject)" refs/remotes/long >actual &&
 	test_cmp expect actual
@@ -55,7 +55,7 @@ test_expect_success LONG_REF 'fetch handles extremely long refname' '
 test_expect_success LONG_REF 'push handles extremely long refname' '
 	git push long :refs/heads/$ref1440 &&
 	git -C long for-each-ref --format="%(subject)" refs/heads >actual &&
-	echo master >expect &&
+	echo main >expect &&
 	test_cmp expect actual
 '
 
t/t5528-push-default.sh +49 -49

195 lines not on this page · raw message

t/t5529-push-errors.sh +1 -1
index 9871307fd4..ce85fd30ad 100755
@@ -32,7 +32,7 @@ test_expect_success 'detect missing branches early' '
 test_expect_success 'detect missing sha1 expressions early' '
 	echo no >rp-ran &&
 	echo no >expect &&
-	test_must_fail git push origin master~2:master &&
+	test_must_fail git push origin main~2:main &&
 	test_cmp expect rp-ran
 '
 
t/t5530-upload-pack-error.sh +1 -1
index 9dd2d2457a..7c1460eaa9 100755
@@ -115,7 +115,7 @@ test_expect_success 'create empty repository' '
 
 test_expect_success 'fetch fails' '
 
-	test_must_fail git fetch .. master
+	test_must_fail git fetch .. main
 
 '
 
t/t5531-deep-submodule-push.sh +94 -94

441 lines not on this page · raw message

t/t5533-push-cas.sh +71 -71

355 lines not on this page · raw message

t/t5534-push-signed.sh +2 -2
index af0385fb89..0e850a76de 100755
@@ -9,11 +9,11 @@ prepare_dst () {
 	rm -fr dst &&
 	test_create_repo dst &&
 
-	git push dst master:noop master:ff master:noff
+	git push dst main:noop main:ff main:noff
 }
 
 test_expect_success setup '
-	# master, ff and noff branches pointing at the same commit
+	# main, ff and noff branches pointing at the same commit
 	test_tick &&
 	git commit --allow-empty -m initial &&
 
t/t5537-fetch-shallow.sh +15 -15
index a55202d2d3..01071f2306 100755
@@ -49,7 +49,7 @@ test_expect_success 'fetch from shallow clone' '
 	cd shallow2 &&
 	git fetch &&
 	git fsck &&
-	git log --format=%s origin/master >actual &&
+	git log --format=%s origin/main >actual &&
 	test_write_lines 5 4 3 >expect &&
 	test_cmp expect actual
 	)
@@ -64,7 +64,7 @@ test_expect_success 'fetch --depth from shallow clone' '
 	cd shallow2 &&
 	git fetch --depth=2 &&
 	git fsck &&
-	git log --format=%s origin/master >actual &&
+	git log --format=%s origin/main >actual &&
 	test_write_lines 6 5 >expect &&
 	test_cmp expect actual
 	)
@@ -75,7 +75,7 @@ test_expect_success 'fetch --unshallow from shallow clone' '
 	cd shallow2 &&
 	git fetch --unshallow &&
 	git fsck &&
-	git log --format=%s origin/master >actual &&
+	git log --format=%s origin/main >actual &&
 	test_write_lines 6 5 4 3 >expect &&
 	test_cmp expect actual
 	)
@@ -89,7 +89,7 @@ test_expect_success 'fetch --unshallow from a full clone' '
 	test_write_lines 4 3 >expect &&
 	test_cmp expect actual &&
 	git -c fetch.writeCommitGraph fetch --unshallow &&
-	git log origin/master --format=%s >actual &&
+	git log origin/main --format=%s >actual &&
 	test_write_lines 4 3 2 1 >expect &&
 	test_cmp expect actual
 	)
@@ -104,9 +104,9 @@ test_expect_success 'fetch something upstream has but hidden by clients shallow
 	git commit -m add-1-back &&
 	(
 	cd shallow2 &&
-	git fetch ../.git +refs/heads/master:refs/remotes/top/master &&
+	git fetch ../.git +refs/heads/main:refs/remotes/top/main &&
 	git fsck &&
-	git log --format=%s top/master >actual &&
+	git log --format=%s top/main >actual &&
 	test_write_lines add-1-back 4 3 >expect &&
 	test_cmp expect actual
 	) &&
@@ -135,7 +135,7 @@ test_expect_success 'fetch that requires changes in .git/shallow is filtered' '
 test_expect_success 'fetch --update-shallow' '
 	(
 	cd shallow &&
-	git checkout master &&
+	git checkout main &&
 	commit 7 &&
 	git tag -m foo heavy-tag HEAD^ &&
 	git tag light-tag HEAD^:tracked
@@ -146,13 +146,13 @@ test_expect_success 'fetch --update-shallow' '
 	git fsck &&
 	git for-each-ref --sort=refname --format="%(refname)" >actual.refs &&
 	cat <<-\EOF >expect.refs &&
-	refs/remotes/shallow/master
+	refs/remotes/shallow/main
 	refs/remotes/shallow/no-shallow
 	refs/tags/heavy-tag
 	refs/tags/light-tag
 	EOF
 	test_cmp expect.refs actual.refs &&
-	git log --format=%s shallow/master >actual &&
+	git log --format=%s shallow/main >actual &&
 	test_write_lines 7 6 5 4 3 >expect &&
 	test_cmp expect actual
 	)
@@ -161,7 +161,7 @@ test_expect_success 'fetch --update-shallow' '
 test_expect_success 'fetch --update-shallow (with fetch.writeCommitGraph)' '
 	(
 	cd shallow &&
-	git checkout master &&
+	git checkout main &&
 	commit 8 &&
 	git tag -m foo heavy-tag-for-graph HEAD^ &&
 	git tag light-tag-for-graph HEAD^:tracked
@@ -173,7 +173,7 @@ test_expect_success 'fetch --update-shallow (with fetch.writeCommitGraph)' '
 	git fsck &&
 	git for-each-ref --sort=refname --format="%(refname)" >actual.refs &&
 	cat <<-EOF >expect.refs &&
-	refs/remotes/shallow/master
+	refs/remotes/shallow/main
 	refs/remotes/shallow/no-shallow
 	refs/tags/heavy-tag
 	refs/tags/heavy-tag-for-graph
@@ -181,7 +181,7 @@ test_expect_success 'fetch --update-shallow (with fetch.writeCommitGraph)' '
 	refs/tags/light-tag-for-graph
 	EOF
 	test_cmp expect.refs actual.refs &&
-	git log --format=%s shallow/master >actual &&
+	git log --format=%s shallow/main >actual &&
 	test_write_lines 8 7 6 5 4 3 >expect &&
 	test_cmp expect actual
 	)
@@ -206,7 +206,7 @@ test_expect_success '.git/shallow is edited by repack' '
 	test_commit -C shallow-server E &&
 	test_commit -C shallow-server D &&
 	d="$(git -C shallow-server rev-parse --verify D^0)" &&
-	git -C shallow-server checkout master &&
+	git -C shallow-server checkout main &&
 
 	git clone --depth=1 --no-tags --no-single-branch \
 		"file://$PWD/shallow-server" shallow-client &&
@@ -244,7 +244,7 @@ test_expect_success 'shallow fetches check connectivity before writing shallow f
 	git -C "$REPO" config protocol.version 2 &&
 	git -C client config protocol.version 2 &&
 
-	git -C client fetch --depth=2 "$HTTPD_URL/one_time_perl/repo" master:a_branch &&
+	git -C client fetch --depth=2 "$HTTPD_URL/one_time_perl/repo" main:a_branch &&
 
 	# Craft a situation in which the server sends back an unshallow request
 	# with an empty packfile. This is done by refetching with a shorter
@@ -256,7 +256,7 @@ test_expect_success 'shallow fetches check connectivity before writing shallow f
 	       >"$HTTPD_ROOT_PATH/one-time-perl" &&
 	test_must_fail env GIT_TEST_SIDEBAND_ALL=0 git -C client \
 		fetch --depth=1 "$HTTPD_URL/one_time_perl/repo" \
-		master:a_branch &&
+		main:a_branch &&
 
 	# Ensure that the one-time-perl script was used.
 	! test -e "$HTTPD_ROOT_PATH/one-time-perl" &&
t/t5538-push-shallow.sh +11 -11
index ecbf84d21c..9d3e946bf1 100755
@@ -44,9 +44,9 @@ test_expect_success 'push from shallow clone' '
 	(
 	cd shallow &&
 	commit 5 &&
-	git push ../.git +master:refs/remotes/shallow/master
+	git push ../.git +main:refs/remotes/shallow/main
 	) &&
-	git log --format=%s shallow/master >actual &&
+	git log --format=%s shallow/main >actual &&
 	git fsck &&
 	cat <<EOF >expect &&
 5
@@ -61,10 +61,10 @@ EOF
 test_expect_success 'push from shallow clone, with grafted roots' '
 	(
 	cd shallow2 &&
-	test_must_fail git push ../.git +master:refs/remotes/shallow2/master 2>err &&
-	grep "shallow2/master.*shallow update not allowed" err
+	test_must_fail git push ../.git +main:refs/remotes/shallow2/main 2>err &&
+	grep "shallow2/main.*shallow update not allowed" err
 	) &&
-	test_must_fail git rev-parse shallow2/master &&
+	test_must_fail git rev-parse shallow2/main &&
 	git fsck
 '
 
@@ -72,9 +72,9 @@ test_expect_success 'add new shallow root with receive.updateshallow on' '
 	test_config receive.shallowupdate true &&
 	(
 	cd shallow2 &&
-	git push ../.git +master:refs/remotes/shallow2/master
+	git push ../.git +main:refs/remotes/shallow2/main
 	) &&
-	git log --format=%s shallow2/master >actual &&
+	git log --format=%s shallow2/main >actual &&
 	git fsck &&
 	cat <<EOF >expect &&
 c
@@ -87,12 +87,12 @@ test_expect_success 'push from shallow to shallow' '
 	(
 	cd shallow &&
 	git --git-dir=../shallow2/.git config receive.shallowupdate true &&
-	git push ../shallow2/.git +master:refs/remotes/shallow/master &&
+	git push ../shallow2/.git +main:refs/remotes/shallow/main &&
 	git --git-dir=../shallow2/.git config receive.shallowupdate false
 	) &&
 	(
 	cd shallow2 &&
-	git log --format=%s shallow/master >actual &&
+	git log --format=%s shallow/main >actual &&
 	git fsck &&
 	cat <<EOF >expect &&
 5
@@ -106,10 +106,10 @@ EOF
 test_expect_success 'push from full to shallow' '
 	! git --git-dir=shallow2/.git cat-file blob $(echo 1|git hash-object --stdin) &&
 	commit 1 &&
-	git push shallow2/.git +master:refs/remotes/top/master &&
+	git push shallow2/.git +main:refs/remotes/top/main &&
 	(
 	cd shallow2 &&
-	git log --format=%s top/master >actual &&
+	git log --format=%s top/main >actual &&
 	git fsck &&
 	cat <<EOF >expect &&
 1
t/t5539-fetch-http-shallow.sh +7 -7
index 82aa99ae87..4397197829 100755
@@ -32,7 +32,7 @@ test_expect_success 'clone http repository' '
 	(
 	cd clone &&
 	git fsck &&
-	git log --format=%s origin/master >actual &&
+	git log --format=%s origin/main >actual &&
 	cat <<EOF >expect &&
 7
 6
@@ -60,9 +60,9 @@ test_expect_success 'no shallow lines after receiving ACK ready' '
 				refs/heads/unrelated$i:refs/heads/unrelated$i ||
 			exit 1
 		done &&
-		git checkout master &&
+		git checkout main &&
 		test_commit new &&
-		git push  "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" master
+		git push  "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" main
 	) &&
 	(
 		cd clone &&
@@ -95,7 +95,7 @@ test_expect_success 'clone shallow since ...' '
 
 test_expect_success 'fetch shallow since ...' '
 	git -C shallow11 fetch --shallow-since "200000000 +0700" origin &&
-	git -C shallow11 log --pretty=tformat:%s origin/master >actual &&
+	git -C shallow11 log --pretty=tformat:%s origin/main >actual &&
 	cat >expected <<-\EOF &&
 	three
 	two
@@ -120,7 +120,7 @@ test_expect_success 'shallow clone exclude tag two' '
 
 test_expect_success 'fetch exclude tag one' '
 	git -C shallow12 fetch --shallow-exclude one origin &&
-	git -C shallow12 log --pretty=tformat:%s origin/master >actual &&
+	git -C shallow12 log --pretty=tformat:%s origin/main >actual &&
 	test_write_lines three two >expected &&
 	test_cmp expected actual
 '
@@ -136,12 +136,12 @@ test_expect_success 'fetching deepen' '
 	git clone --depth 1 $HTTPD_URL/smart/shallow-deepen.git deepen &&
 	mv "$HTTPD_DOCUMENT_ROOT_PATH/shallow-deepen.git" .git &&
 	test_commit four &&
-	git -C deepen log --pretty=tformat:%s master >actual &&
+	git -C deepen log --pretty=tformat:%s main >actual &&
 	echo three >expected &&
 	test_cmp expected actual &&
 	mv .git "$HTTPD_DOCUMENT_ROOT_PATH/shallow-deepen.git" &&
 	git -C deepen fetch --deepen=1 &&
-	git -C deepen log --pretty=tformat:%s origin/master >actual &&
+	git -C deepen log --pretty=tformat:%s origin/main >actual &&
 	cat >expected <<-\EOF &&
 	four
 	three
t/test-lib.sh +1 -1
index a12a1993d0..ecaa0f36f3 100644
@@ -263,7 +263,7 @@ case "$TEST_NUMBER" in
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
-[0-4]*|5[0-4]*|55[01]*)
+[0-4]*|5[0-4]*|55[0-3]*)
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
Signature · 1 line
gitgitgadget
#10 lore raw

PATCH 10/28 t5[0-4]*: adjust the references to the default branch name "main"

In reply to Johannes Schindelin via GitGitGadget

From: Johannes Schindelin <[email protected]>

Carefully excluding t5310, which is developed independently of the current patch series at the time of writing, we now use main as default branch in t5[0-4]*. This trick was performed via

	$ (cd t &&
	   sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
		-e 's/Master/Main/g' -- t5[0-4]*.sh &&
	   git checkout HEAD -- t5310\*)

This allows us to define GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main for those tests.

---
 t/t5150-request-pull.sh                | 34 ++++++-------
 t/t5304-prune.sh                       |  2 +-
 t/t5305-include-tag.sh                 |  2 +-
 t/t5312-prune-corruption.sh            | 16 +++----
 t/t5317-pack-objects-filter-objects.sh |  2 +-
 t/t5322-pack-objects-sparse.sh         |  2 +-
 t/t5323-pack-redundant.sh              | 66 +++++++++++++-------------
 t/t5400-send-pack.sh                   | 60 +++++++++++------------
 t/t5401-update-hooks.sh                | 24 +++++-----
 t/t5402-post-merge-hook.sh             |  2 +-
 t/t5403-post-checkout-hook.sh          |  6 +--
 t/t5404-tracking-branches.sh           |  8 ++--
 t/t5405-send-pack-rewind.sh            |  6 +--
 t/t5407-post-rewrite-hook.sh           |  2 +-
 t/t5410-receive-pack-alternates.sh     |  4 +-
 t/test-lib.sh                          |  4 +-
 16 files changed, 120 insertions(+), 120 deletions(-)
t/t5150-request-pull.sh +17 -17
index c1811ea0f4..4fa71961a6 100755
@@ -31,13 +31,13 @@ test_expect_success 'setup' '
 		test_tick &&
 		git commit -m "\"Thirty days\", a reminder of month lengths" &&
 		git tag -m "version 1" -a initial &&
-		git push --tags origin master
+		git push --tags origin main
 	) &&
 	(
 		cd local &&
 		git remote add upstream "$trash_url/upstream.git" &&
 		git fetch upstream &&
-		git pull upstream master &&
+		git pull upstream main &&
 		cat <<-\EOT >>mnemonic.txt &&
 		Of twyecescore-eightt is but eine,
 		And all the remnante be thrycescore-eine.
@@ -59,7 +59,7 @@ test_expect_success 'setup' '
 		git commit -a -m "Adapt to use modern, simpler English
 
 But keep the old version, too, in case some people prefer it." &&
-		git checkout master
+		git checkout main
 	)
 
 '
@@ -129,7 +129,7 @@ test_expect_success 'pull request when forgot to push' '
 	(
 		cd local &&
 		git checkout initial &&
-		git merge --ff-only master &&
+		git merge --ff-only main &&
 		test_must_fail git request-pull initial "$downstream_url" \
 			2>../err
 	) &&
@@ -145,9 +145,9 @@ test_expect_success 'pull request after push' '
 	(
 		cd local &&
 		git checkout initial &&
-		git merge --ff-only master &&
-		git push origin master:for-upstream &&
-		git request-pull initial origin master:for-upstream >../request
+		git merge --ff-only main &&
+		git push origin main:for-upstream &&
+		git request-pull initial origin main:for-upstream >../request
 	) &&
 	sed -nf read-request.sed <request >digest &&
 	{
@@ -172,9 +172,9 @@ test_expect_success 'request asks HEAD to be pulled' '
 	(
 		cd local &&
 		git checkout initial &&
-		git merge --ff-only master &&
-		git push --tags origin master simplify &&
-		git push origin master:for-upstream &&
+		git merge --ff-only main &&
+		git push --tags origin main simplify &&
+		git push origin main:for-upstream &&
 		git request-pull initial "$downstream_url" >../request
 	) &&
 	sed -nf read-request.sed <request >digest &&
@@ -215,7 +215,7 @@ test_expect_success 'pull request format' '
 	(
 		cd local &&
 		git checkout initial &&
-		git merge --ff-only master &&
+		git merge --ff-only main &&
 		git push origin tags/full &&
 		git request-pull initial "$downstream_url" tags/full >../request
 	) &&
@@ -243,9 +243,9 @@ test_expect_success 'request-pull ignores OPTIONS_KEEPDASHDASH poison' '
 		OPTIONS_KEEPDASHDASH=Yes &&
 		export OPTIONS_KEEPDASHDASH &&
 		git checkout initial &&
-		git merge --ff-only master &&
-		git push origin master:for-upstream &&
-		git request-pull -- initial "$downstream_url" master:for-upstream >../request
+		git merge --ff-only main &&
+		git push origin main:for-upstream &&
+		git request-pull -- initial "$downstream_url" main:for-upstream >../request
 	)
 
 '
@@ -257,7 +257,7 @@ test_expect_success 'request-pull quotes regex metacharacters properly' '
 	(
 		cd local &&
 		git checkout initial &&
-		git merge --ff-only master &&
+		git merge --ff-only main &&
 		git tag -mrelease v2.0 &&
 		git push origin refs/tags/v2.0:refs/tags/v2-0 &&
 		test_must_fail git request-pull initial "$downstream_url" tags/v2.0 \
@@ -275,7 +275,7 @@ test_expect_success 'pull request with mismatched object' '
 	(
 		cd local &&
 		git checkout initial &&
-		git merge --ff-only master &&
+		git merge --ff-only main &&
 		git push origin HEAD:refs/tags/full &&
 		test_must_fail git request-pull initial "$downstream_url" tags/full \
 			2>../err
@@ -292,7 +292,7 @@ test_expect_success 'pull request with stale object' '
 	(
 		cd local &&
 		git checkout initial &&
-		git merge --ff-only master &&
+		git merge --ff-only main &&
 		git push origin refs/tags/full &&
 		git tag -f -m"Thirty-one days" full &&
 		test_must_fail git request-pull initial "$downstream_url" tags/full \
t/t5304-prune.sh +1 -1
index df60f18fb8..7391f95c7e 100755
@@ -119,7 +119,7 @@ test_expect_success 'prune: do not prune detached HEAD with no reflog' '
 test_expect_success 'prune: prune former HEAD after checking out branch' '
 
 	head_oid=$(git rev-parse HEAD) &&
-	git checkout --quiet master &&
+	git checkout --quiet main &&
 	git prune -v >prune_actual &&
 	grep "$head_oid" prune_actual
 
t/t5305-include-tag.sh +1 -1
index a5eca210b8..69233574b8 100755
@@ -111,7 +111,7 @@ test_expect_success 'check unpacked result (have all objects)' '
 
 test_expect_success 'single-branch clone can transfer tag' '
 	rm -rf clone.git &&
-	git clone --no-local --single-branch -b master . clone.git &&
+	git clone --no-local --single-branch -b main . clone.git &&
 	git -C clone.git fsck
 '
 
t/t5312-prune-corruption.sh +8 -8
index da9d59940d..8ca3823f23 100755
@@ -16,7 +16,7 @@ test_expect_success 'disable reflogs' '
 '
 
 test_expect_success 'create history reachable only from a bogus-named ref' '
-	test_tick && git commit --allow-empty -m master &&
+	test_tick && git commit --allow-empty -m main &&
 	base=$(git rev-parse HEAD) &&
 	test_tick && git commit --allow-empty -m bogus &&
 	bogus=$(git rev-parse HEAD) &&
@@ -51,7 +51,7 @@ test_expect_success 'clean up bogus ref' '
 '
 
 # We create two new objects here, "one" and "two". Our
-# master branch points to "two", which is deleted,
+# main branch points to "two", which is deleted,
 # corrupting the repository. But we'd like to make sure
 # that the otherwise unreachable "one" is not pruned
 # (since it is the user's best bet for recovering
@@ -81,7 +81,7 @@ test_expect_success 'pruning with a corrupted tip does not drop history' '
 test_expect_success 'pack-refs does not silently delete broken loose ref' '
 	git pack-refs --all --prune &&
 	echo $missing >expect &&
-	git rev-parse refs/heads/master >actual &&
+	git rev-parse refs/heads/main >actual &&
 	test_cmp expect actual
 '
 
@@ -89,25 +89,25 @@ test_expect_success 'pack-refs does not silently delete broken loose ref' '
 # actually pack it, as it is perfectly reasonable to
 # skip processing a broken ref
 test_expect_success 'create packed-refs file with broken ref' '
-	rm -f .git/refs/heads/master &&
+	rm -f .git/refs/heads/main &&
 	cat >.git/packed-refs <<-EOF &&
-	$missing refs/heads/master
+	$missing refs/heads/main
 	$recoverable refs/heads/other
 	EOF
 	echo $missing >expect &&
-	git rev-parse refs/heads/master >actual &&
+	git rev-parse refs/heads/main >actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'pack-refs does not silently delete broken packed ref' '
 	git pack-refs --all --prune &&
-	git rev-parse refs/heads/master >actual &&
+	git rev-parse refs/heads/main >actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'pack-refs does not drop broken refs during deletion' '
 	git update-ref -d refs/heads/other &&
-	git rev-parse refs/heads/master >actual &&
+	git rev-parse refs/heads/main >actual &&
 	test_cmp expect actual
 '
 
t/t5317-pack-objects-filter-objects.sh +1 -1
index dc0446574b..6ee66d58ce 100755
@@ -382,7 +382,7 @@ test_expect_success 'verify sparse:oid=oid-ish' '
 	awk -f print_2.awk ls_files_result |
 	sort >expected &&
 
-	git -C r4 pack-objects --revs --stdout --filter=sparse:oid=master:pattern >filter.pack <<-EOF &&
+	git -C r4 pack-objects --revs --stdout --filter=sparse:oid=main:pattern >filter.pack <<-EOF &&
 	HEAD
 	EOF
 	git -C r4 index-pack ../filter.pack &&
t/t5322-pack-objects-sparse.sh +1 -1
index a581eaf529..99bdab0610 100755
@@ -18,7 +18,7 @@ test_expect_success 'setup repo' '
 	git commit -m "Initialized trees" &&
 	for i in $(test_seq 1 3)
 	do
-		git checkout -b topic$i master &&
+		git checkout -b topic$i main &&
 		echo change-$i >f$i/f$i/data.txt &&
 		git commit -a -m "Changed f$i/f$i/data.txt"
 	done &&
t/t5323-pack-redundant.sh +33 -33

202 lines not on this page · raw message

t/t5400-send-pack.sh +30 -30

146 lines not on this page · raw message

t/t5401-update-hooks.sh +12 -12
index 956d69f5b1..6012cc8172 100755
@@ -15,11 +15,11 @@ test_expect_success setup '
 	git update-index a &&
 	tree1=$(git write-tree) &&
 	commit1=$(echo modify | git commit-tree $tree1 -p $commit0) &&
-	git update-ref refs/heads/master $commit0 &&
+	git update-ref refs/heads/main $commit0 &&
 	git update-ref refs/heads/tofail $commit1 &&
 	git clone --bare ./. victim.git &&
 	GIT_DIR=victim.git git update-ref refs/heads/tofail $commit1 &&
-	git update-ref refs/heads/master $commit1 &&
+	git update-ref refs/heads/main $commit1 &&
 	git update-ref refs/heads/tofail $commit0
 '
 
@@ -38,7 +38,7 @@ echo "$@" >>$GIT_DIR/update.args
 read x; printf %s "$x" >$GIT_DIR/update.stdin
 echo STDOUT update $1
 echo STDERR update $1 >&2
-test "$1" = refs/heads/master || exit
+test "$1" = refs/heads/main || exit
 EOF
 chmod u+x victim.git/hooks/update
 
@@ -62,11 +62,11 @@ chmod u+x victim.git/hooks/post-update
 
 test_expect_success push '
 	test_must_fail git send-pack --force ./victim.git \
-		master tofail >send.out 2>send.err
+		main tofail >send.out 2>send.err
 '
 
 test_expect_success 'updated as expected' '
-	test $(GIT_DIR=victim.git git rev-parse master) = $commit1 &&
+	test $(GIT_DIR=victim.git git rev-parse main) = $commit1 &&
 	test $(GIT_DIR=victim.git git rev-parse tofail) = $commit1
 '
 
@@ -82,24 +82,24 @@ test_expect_success 'hooks ran' '
 '
 
 test_expect_success 'pre-receive hook input' '
-	(echo $commit0 $commit1 refs/heads/master &&
+	(echo $commit0 $commit1 refs/heads/main &&
 	 echo $commit1 $commit0 refs/heads/tofail
 	) | test_cmp - victim.git/pre-receive.stdin
 '
 
 test_expect_success 'update hook arguments' '
-	(echo refs/heads/master $commit0 $commit1 &&
+	(echo refs/heads/main $commit0 $commit1 &&
 	 echo refs/heads/tofail $commit1 $commit0
 	) | test_cmp - victim.git/update.args
 '
 
 test_expect_success 'post-receive hook input' '
-	echo $commit0 $commit1 refs/heads/master |
+	echo $commit0 $commit1 refs/heads/main |
 	test_cmp - victim.git/post-receive.stdin
 '
 
 test_expect_success 'post-update hook arguments' '
-	echo refs/heads/master |
+	echo refs/heads/main |
 	test_cmp - victim.git/post-update.args
 '
 
@@ -120,8 +120,8 @@ test_expect_success 'send-pack produced no output' '
 cat <<EOF >expect
 remote: STDOUT pre-receive
 remote: STDERR pre-receive
-remote: STDOUT update refs/heads/master
-remote: STDERR update refs/heads/master
+remote: STDOUT update refs/heads/main
+remote: STDERR update refs/heads/main
 remote: STDOUT update refs/heads/tofail
 remote: STDERR update refs/heads/tofail
 remote: error: hook declined to update refs/heads/tofail
@@ -143,7 +143,7 @@ test_expect_success 'pre-receive hook that forgets to read its input' '
 
 	for v in $(test_seq 100 999)
 	do
-		git branch branch_$v master || return
+		git branch branch_$v main || return
 	done &&
 	git push ./victim.git "+refs/heads/*:refs/heads/*"
 '
t/t5402-post-merge-hook.sh +1 -1
index 4aeea8f5b7..26c800e60b 100755
@@ -15,7 +15,7 @@ test_expect_success setup '
 	git update-index a &&
 	tree1=$(git write-tree) &&
 	commit1=$(echo modify | git commit-tree $tree1 -p $commit0) &&
-	git update-ref refs/heads/master $commit0 &&
+	git update-ref refs/heads/main $commit0 &&
 	git clone ./. clone1 &&
 	GIT_DIR=clone1/.git git update-index --add a &&
 	git clone ./. clone2 &&
t/t5403-post-checkout-hook.sh +3 -3
index a39b3b5c78..867dec8862 100755
@@ -20,7 +20,7 @@ test_expect_success setup '
 
 test_expect_success 'post-checkout receives the right arguments with HEAD unchanged ' '
 	test_when_finished "rm -f .git/post-checkout.args" &&
-	git checkout master &&
+	git checkout main &&
 	read old new flag <.git/post-checkout.args &&
 	test $old = $new && test $flag = 1
 '
@@ -41,14 +41,14 @@ test_expect_success 'post-checkout receives the right args with HEAD changed ' '
 
 test_expect_success 'post-checkout receives the right args when not switching branches ' '
 	test_when_finished "rm -f .git/post-checkout.args" &&
-	git checkout master -- three.t &&
+	git checkout main -- three.t &&
 	read old new flag <.git/post-checkout.args &&
 	test $old = $new && test $flag = 0
 '
 
 test_expect_success 'post-checkout is triggered on rebase' '
 	test_when_finished "rm -f .git/post-checkout.args" &&
-	git checkout -b rebase-test master &&
+	git checkout -b rebase-test main &&
 	rm -f .git/post-checkout.args &&
 	git rebase rebase-on-me &&
 	read old new flag <.git/post-checkout.args &&
t/t5404-tracking-branches.sh +4 -4
index 2762f420bc..83751e68d0 100755
@@ -30,9 +30,9 @@ test_expect_success 'prepare pushable branches' '
 	git checkout -b b2 origin/b2 &&
 	echo aa-b2 >>file &&
 	git commit -a -m aa-b2 &&
-	git checkout master &&
-	echo aa-master >>file &&
-	git commit -a -m aa-master
+	git checkout main &&
+	echo aa-main >>file &&
+	git commit -a -m aa-main
 '
 
 test_expect_success 'mixed-success push returns error' '
@@ -40,7 +40,7 @@ test_expect_success 'mixed-success push returns error' '
 '
 
 test_expect_success 'check tracking branches updated correctly after push' '
-	test "$(git rev-parse origin/master)" = "$(git rev-parse master)"
+	test "$(git rev-parse origin/main)" = "$(git rev-parse main)"
 '
 
 test_expect_success 'check tracking branches not updated for failed refs' '
t/t5405-send-pack-rewind.sh +3 -3
index 235fb7686a..8792e74682 100755
@@ -13,7 +13,7 @@ test_expect_success setup '
 	mkdir another && (
 		cd another &&
 		git init &&
-		git fetch --update-head-ok .. master:master
+		git fetch --update-head-ok .. main:main
 	) &&
 
 	>file2 && git add file2 && test_tick &&
@@ -25,7 +25,7 @@ test_expect_success 'non forced push should die not segfault' '
 
 	(
 		cd another &&
-		test_must_fail git push .. master:master
+		test_must_fail git push .. main:main
 	)
 
 '
@@ -34,7 +34,7 @@ test_expect_success 'forced push should succeed' '
 
 	(
 		cd another &&
-		git push .. +master:master
+		git push .. +main:main
 	)
 
 '
t/t5407-post-rewrite-hook.sh +1 -1
index 80750a817e..27bc159acf 100755
@@ -14,7 +14,7 @@ test_expect_success 'setup' '
 	git checkout A^0 &&
 	test_commit E bar E &&
 	test_commit F foo F &&
-	git checkout master
+	git checkout main
 '
 
 mkdir .git/hooks
t/t5410-receive-pack-alternates.sh +2 -2
index f00d0da860..cb6fffe611 100755
@@ -7,9 +7,9 @@ test_description='git receive-pack with alternate ref filtering'
 test_expect_success 'setup' '
 	test_commit base &&
 	git clone -s --bare . fork &&
-	git checkout -b public/branch master &&
+	git checkout -b public/branch main &&
 	test_commit public &&
-	git checkout -b private/branch master &&
+	git checkout -b private/branch main &&
 	test_commit private
 '
 
t/test-lib.sh +2 -2
index b783629348..155bfad454 100644
@@ -257,13 +257,13 @@ case "$TRASH_DIRECTORY" in
 esac
 
 case "$TEST_NUMBER" in
-3404|4013)
+3404|4013|5310)
 	# Avoid conflicts with patch series that are cooking at the same time
 	# as the patch series changing the default of `init.defaultBranch`.
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
-[0-4]*)
+[0-4]*|5[0-4]*)
 	GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 	;;
Signature · 1 line
gitgitgadget