git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 02/30] subtree: t7900: update for having the default branch name be 'main'

From
Luke Shumaker <lukeshu@lukeshu.com>
Date
Apr 27, 2021, 21:17 UTC
Message-ID
<20210427211748.2607474-3-lukeshu@lukeshu.com>
In-Reply-To
<20210427211748.2607474-1-lukeshu@lukeshu.com>
From: Luke Shumaker <lukeshu@datawire.io>

Most of the tests had been converted to support `GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main`, but `contrib/subtree/t/` hadn't.

Convert it. Most of the mentions of 'master' can just be replaced with 'HEAD'.

Signed-off-by: Luke Shumaker <lukeshu@datawire.io>
---
 contrib/subtree/t/t7900-subtree.sh | 117 +++++++++++++++--------------
 1 file changed, 59 insertions(+), 58 deletions(-)
diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh
index 57ff4b25c1..4b982e6c2e 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -103,7 +103,7 @@ test_expect_success 'no merge from non-existent subtree' '
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		test_must_fail git subtree merge --prefix="sub dir" FETCH_HEAD
 	)
 '
@@ -116,8 +116,8 @@ test_expect_success 'no pull from non-existent subtree' '
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
-		test_must_fail git subtree pull --prefix="sub dir" ./"sub proj" master
+		git fetch ./"sub proj" HEAD &&
+		test_must_fail git subtree pull --prefix="sub dir" ./"sub proj" HEAD
 	)'
 
 next_test
@@ -128,7 +128,7 @@ test_expect_success 'add subproj as subtree into sub dir/ with --prefix' '
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD &&
 		check_equal "$(last_commit_message)" "Add '\''sub dir/'\'' from commit '\''$(git rev-parse FETCH_HEAD)'\''"
 	)
@@ -142,7 +142,7 @@ test_expect_success 'add subproj as subtree into sub dir/ with --prefix and --me
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" --message="Added subproject" FETCH_HEAD &&
 		check_equal "$(last_commit_message)" "Added subproject"
 	)
@@ -156,7 +156,7 @@ test_expect_success 'add subproj as subtree into sub dir/ with --prefix as -P an
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add -P "sub dir" -m "Added subproject" FETCH_HEAD &&
 		check_equal "$(last_commit_message)" "Added subproject"
 	)
@@ -170,7 +170,7 @@ test_expect_success 'add subproj as subtree into sub dir/ with --squash and --pr
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" --message="Added subproject with squash" --squash FETCH_HEAD &&
 		check_equal "$(last_commit_message)" "Added subproject with squash"
 	)
@@ -188,13 +188,13 @@ test_expect_success 'merge new subproj history into sub dir/ with --prefix' '
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD
 	) &&
 	test_create_commit "$subtree_test_count/sub proj" sub2 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
 		check_equal "$(last_commit_message)" "Merge commit '\''$(git rev-parse FETCH_HEAD)'\''"
 	)
@@ -208,13 +208,13 @@ test_expect_success 'merge new subproj history into sub dir/ with --prefix and -
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD
 	) &&
 	test_create_commit "$subtree_test_count/sub proj" sub2 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree merge --prefix="sub dir" --message="Merged changes from subproject" FETCH_HEAD &&
 		check_equal "$(last_commit_message)" "Merged changes from subproject"
 	)
@@ -228,13 +228,13 @@ test_expect_success 'merge new subproj history into sub dir/ with --squash and -
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD
 	) &&
 	test_create_commit "$subtree_test_count/sub proj" sub2 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree merge --prefix="sub dir" --message="Merged changes from subproject using squash" --squash FETCH_HEAD &&
 		check_equal "$(last_commit_message)" "Merged changes from subproject using squash"
 	)
@@ -248,7 +248,7 @@ test_expect_success 'merge the added subproj again, should do nothing' '
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD &&
 		# this shouldn not actually do anything, since FETCH_HEAD
 		# is already a parent
@@ -265,13 +265,13 @@ test_expect_success 'merge new subproj history into subdir/ with a slash appende
 	test_create_commit "$test_count/subproj" sub1 &&
 	(
 		cd "$test_count" &&
-		git fetch ./subproj master &&
+		git fetch ./subproj HEAD &&
 		git subtree add --prefix=subdir/ FETCH_HEAD
 	) &&
 	test_create_commit "$test_count/subproj" sub2 &&
 	(
 		cd "$test_count" &&
-		git fetch ./subproj master &&
+		git fetch ./subproj HEAD &&
 		git subtree merge --prefix=subdir/ FETCH_HEAD &&
 		check_equal "$(last_commit_message)" "Merge commit '\''$(git rev-parse FETCH_HEAD)'\''"
 	)
@@ -289,7 +289,7 @@ test_expect_success 'split requires option --prefix' '
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD &&
 		echo "You must provide the --prefix option." > expected &&
 		test_must_fail git subtree split > actual 2>&1 &&
@@ -309,7 +309,7 @@ test_expect_success 'split requires path given by option --prefix must exist' '
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD &&
 		echo "'\''non-existent-directory'\'' does not exist; use '\''git subtree add'\''" > expected &&
 		test_must_fail git subtree split --prefix=non-existent-directory > actual 2>&1 &&
@@ -329,7 +329,7 @@ test_expect_success 'split sub dir/ with --rejoin' '
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD
 	) &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
@@ -338,7 +338,7 @@ test_expect_success 'split sub dir/ with --rejoin' '
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
 		split_hash=$(git subtree split --prefix="sub dir" --annotate="*") &&
 		git subtree split --prefix="sub dir" --annotate="*" --rejoin &&
@@ -370,7 +370,7 @@ test_expect_success 'split sub dir/ with --rejoin and --message' '
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD
 	) &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
@@ -379,7 +379,7 @@ test_expect_success 'split sub dir/ with --rejoin and --message' '
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
 		git subtree split --prefix="sub dir" --message="Split & rejoin" --annotate="*" --rejoin &&
 		check_equal "$(last_commit_message)" "Split & rejoin"
@@ -394,7 +394,7 @@ test_expect_success 'split "sub dir"/ with --branch' '
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD
 	) &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
@@ -403,7 +403,7 @@ test_expect_success 'split "sub dir"/ with --branch' '
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
 		split_hash=$(git subtree split --prefix="sub dir" --annotate="*") &&
 		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br &&
@@ -419,7 +419,7 @@ test_expect_success 'check hash of split' '
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD
 	) &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
@@ -428,7 +428,7 @@ test_expect_success 'check hash of split' '
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
 		split_hash=$(git subtree split --prefix="sub dir" --annotate="*") &&
 		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br &&
@@ -451,7 +451,7 @@ test_expect_success 'split "sub dir"/ with --branch for an existing branch' '
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git branch subproj-br FETCH_HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD
 	) &&
@@ -461,7 +461,7 @@ test_expect_success 'split "sub dir"/ with --branch for an existing branch' '
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
 		split_hash=$(git subtree split --prefix="sub dir" --annotate="*") &&
 		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br &&
@@ -478,7 +478,7 @@ test_expect_success 'split "sub dir"/ with --branch for an incompatible branch'
 	(
 		cd "$subtree_test_count" &&
 		git branch init HEAD &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD
 	) &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
@@ -487,7 +487,7 @@ test_expect_success 'split "sub dir"/ with --branch for an incompatible branch'
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
 		test_must_fail git subtree split --prefix="sub dir" --branch init
 	)
@@ -505,7 +505,7 @@ test_expect_success 'make sure exactly the right set of files ends up in the sub
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD
 	) &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
@@ -514,7 +514,7 @@ test_expect_success 'make sure exactly the right set of files ends up in the sub
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
 		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
 	) &&
@@ -555,7 +555,7 @@ test_expect_success 'make sure the subproj *only* contains commits that affect t
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD
 	) &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
@@ -564,7 +564,7 @@ test_expect_success 'make sure the subproj *only* contains commits that affect t
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
 		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
 	) &&
@@ -606,7 +606,7 @@ test_expect_success 'make sure exactly the right set of files ends up in the mai
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD
 	) &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
@@ -615,7 +615,7 @@ test_expect_success 'make sure exactly the right set of files ends up in the mai
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
 		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
 	) &&
@@ -643,7 +643,7 @@ test_expect_success 'make sure exactly the right set of files ends up in the mai
 	) &&
 	(
 		cd "$subtree_test_count" &&
-		git subtree pull --prefix="sub dir" ./"sub proj" master &&
+		git subtree pull --prefix="sub dir" ./"sub proj" HEAD &&
 
 		test_write_lines main1 main2 >chkm &&
 		test_write_lines main-sub1 main-sub2 main-sub3 main-sub4 >chkms &&
@@ -666,7 +666,7 @@ test_expect_success 'make sure each filename changed exactly once in the entire
 	(
 		cd "$subtree_test_count" &&
 		git config log.date relative &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD
 	) &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
@@ -675,7 +675,7 @@ test_expect_success 'make sure each filename changed exactly once in the entire
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
 		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
 	) &&
@@ -703,7 +703,7 @@ test_expect_success 'make sure each filename changed exactly once in the entire
 	) &&
 	(
 		cd "$subtree_test_count" &&
-		git subtree pull --prefix="sub dir" ./"sub proj" master &&
+		git subtree pull --prefix="sub dir" ./"sub proj" HEAD &&
 
 		test_write_lines main1 main2 >chkm &&
 		test_write_lines sub1 sub2 sub3 sub4 >chks &&
@@ -731,7 +731,7 @@ test_expect_success 'make sure the --rejoin commits never make it into subproj'
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD
 	) &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
@@ -740,7 +740,7 @@ test_expect_success 'make sure the --rejoin commits never make it into subproj'
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
 		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
 	) &&
@@ -768,7 +768,7 @@ test_expect_success 'make sure the --rejoin commits never make it into subproj'
 	) &&
 	(
 		cd "$subtree_test_count" &&
-		git subtree pull --prefix="sub dir" ./"sub proj" master &&
+		git subtree pull --prefix="sub dir" ./"sub proj" HEAD &&
 		check_equal "$(git log --pretty=format:"%s" HEAD^2 | grep -i split)" ""
 	)
 '
@@ -781,7 +781,7 @@ test_expect_success 'make sure no "git subtree" tagged commits make it into subp
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD
 	) &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
@@ -790,7 +790,7 @@ test_expect_success 'make sure no "git subtree" tagged commits make it into subp
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
 		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
 	) &&
@@ -818,7 +818,7 @@ test_expect_success 'make sure no "git subtree" tagged commits make it into subp
 	) &&
 	(
 		cd "$subtree_test_count" &&
-		git subtree pull --prefix="sub dir" ./"sub proj" master &&
+		git subtree pull --prefix="sub dir" ./"sub proj" HEAD &&
 
 		# They are meaningless to subproj since one side of the merge refers to the mainline
 		check_equal "$(git log --pretty=format:"%s%n%b" HEAD^2 | grep "git-subtree.*:")" ""
@@ -837,13 +837,13 @@ test_expect_success 'make sure "git subtree split" find the correct parent' '
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD
 	) &&
 	test_create_commit "$subtree_test_count/sub proj" sub2 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git branch subproj-ref FETCH_HEAD &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD
 	) &&
@@ -853,7 +853,7 @@ test_expect_success 'make sure "git subtree split" find the correct parent' '
 		git subtree split --prefix="sub dir" --branch subproj-br &&
 
 		# at this point, the new commit parent should be subproj-ref, if it is
-		# not, something went wrong (the "newparent" of "master~" commit should
+		# not, something went wrong (the "newparent" of "HEAD~" commit should
 		# have been sub2, but it was not, because its cache was not set to
 		# itself)
 		check_equal "$(git log --pretty=format:%P -1 subproj-br)" "$(git rev-parse subproj-ref)"
@@ -868,13 +868,13 @@ test_expect_success 'split a new subtree without --onto option' '
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD
 	) &&
 	test_create_commit "$subtree_test_count/sub proj" sub2 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD
 	) &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
@@ -903,14 +903,14 @@ test_expect_success 'verify one file change per commit' '
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git branch sub1 FETCH_HEAD &&
 		git subtree add --prefix="sub dir" sub1
 	) &&
 	test_create_commit "$subtree_test_count/sub proj" sub2 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD
 	) &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
@@ -947,7 +947,7 @@ test_expect_success 'push split to subproj' '
 	test_create_commit "$subtree_test_count/sub proj" sub1 &&
 	(
 		cd "$subtree_test_count" &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree add --prefix="sub dir" FETCH_HEAD
 	) &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
@@ -958,7 +958,7 @@ test_expect_success 'push split to subproj' '
 		cd $subtree_test_count/"sub proj" &&
                 git branch sub-branch-1 &&
                 cd .. &&
-		git fetch ./"sub proj" master &&
+		git fetch ./"sub proj" HEAD &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD
 	) &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub3 &&
@@ -994,6 +994,7 @@ test_expect_success 'push split to subproj' '
 next_test
 test_expect_success 'subtree descendant check' '
 	subtree_test_create_repo "$subtree_test_count" &&
+	defaultBranch=$(sed "s,ref: refs/heads/,," "$subtree_test_count/.git/HEAD") &&
 	test_create_commit "$subtree_test_count" folder_subtree/a &&
 	(
 		cd "$subtree_test_count" &&
@@ -1010,7 +1011,7 @@ test_expect_success 'subtree descendant check' '
 	(
 		cd "$subtree_test_count" &&
 		git cherry-pick $cherry &&
-		git checkout master &&
+		git checkout $defaultBranch &&
 		git merge -m "merge should be kept on subtree" branch &&
 		git branch no_subtree_work_branch
 	) &&
@@ -1022,10 +1023,10 @@ test_expect_success 'subtree descendant check' '
 	test_create_commit "$subtree_test_count" not_a_subtree_change &&
 	(
 		cd "$subtree_test_count" &&
-		git checkout master &&
+		git checkout $defaultBranch &&
 		git merge -m "merge should be skipped on subtree" no_subtree_work_branch &&
 
-		git subtree split --prefix folder_subtree/ --branch subtree_tip master &&
+		git subtree split --prefix folder_subtree/ --branch subtree_tip $defaultBranch &&
 		git subtree split --prefix folder_subtree/ --branch subtree_branch branch &&
 		check_equal $(git rev-list --count subtree_tip..subtree_branch) 0
 	)
-- 
2.31.1
Previous: Luke ShumakerNext: Ævar Arnfjörð Bjarmason
Message 102 of 144 in “subtree: clean up, improve UX”
  1. 00/30 subtree: clean up, improve UXLuke Shumaker, Apr 23, 2021
  2. 01/30 .gitignore: Ignore /git-subtreeLuke Shumaker, Apr 23, 2021
  3. 02/30 subtree: t7900: update for having the default branch name be 'main'Luke Shumaker, Apr 23, 2021
  4. 04/30 subtree: t7900: use consistent formattingLuke Shumaker, Apr 23, 2021
  5. Eric SunshineApr 23, 2021
  6. Luke ShumakerApr 23, 2021
  7. Junio C HamanoApr 27, 2021
  8. Luke ShumakerApr 27, 2021
  9. Junio C HamanoApr 28, 2021
  10. 05/30 subtree: t7900: comment subtree_test_create_repoLuke Shumaker, Apr 23, 2021
  11. 03/30 subtree: t7900: use test-lib.sh's test_countLuke Shumaker, Apr 23, 2021
  12. 06/30 subtree: t7900: use 'test' for string equalityLuke Shumaker, Apr 23, 2021
  13. 07/30 subtree: t7900: delete some dead codeLuke Shumaker, Apr 23, 2021
  14. 08/30 subtree: t7900: fix 'verify one file change per commit'Luke Shumaker, Apr 23, 2021
  15. 09/30 subtree: t7900: rename last_commit_message to last_commit_subjectLuke Shumaker, Apr 23, 2021
  16. 10/30 subtree: t7900: add a test for the -h flagLuke Shumaker, Apr 23, 2021
  17. 11/30 subtree: t7900: add porcelain tests for 'pull' and 'push'Luke Shumaker, Apr 23, 2021
  18. Eric SunshineApr 23, 2021
  19. Luke ShumakerApr 23, 2021
  20. 12/30 subtree: don't have loose code outside of a functionLuke Shumaker, Apr 23, 2021
  21. Luke ShumakerApr 23, 2021
  22. Eric SunshineApr 23, 2021
  23. Luke ShumakerApr 23, 2021
  24. Eric SunshineApr 23, 2021
  25. Luke ShumakerApr 23, 2021
  26. 14/30 subtree: drop support for git < 1.7Luke Shumaker, Apr 23, 2021
  27. Luke ShumakerApr 23, 2021
  28. Eric SunshineApr 23, 2021
  29. Luke ShumakerApr 23, 2021
  30. Eric SunshineApr 23, 2021
  31. Luke ShumakerApr 24, 2021
  32. 13/30 subtree: more consistent error propagationLuke Shumaker, Apr 23, 2021
  33. 15/30 subtree: use `git merge-base --is-ancestor`Luke Shumaker, Apr 23, 2021
  34. 16/30 subtree: use git-sh-setup's `say`Luke Shumaker, Apr 23, 2021
  35. 17/30 subtree: use more explicit variable names for cmdline argsLuke Shumaker, Apr 23, 2021
  36. 18/30 subtree: use $* instead of $@ as appropriateLuke Shumaker, Apr 23, 2021
  37. Eric SunshineApr 23, 2021
  38. Luke ShumakerApr 23, 2021
  39. Eric SunshineApr 24, 2021
  40. 19/30 subtree: give `$(git --exec-path)` precedence over `$PATH`Luke Shumaker, Apr 23, 2021
  41. =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= BjarmasonApr 26, 2021
  42. 20/30 subtree: use "^{commit}" instead of "^0"Luke Shumaker, Apr 23, 2021
  43. Ævar Arnfjörð BjarmasonApr 26, 2021
  44. 21/30 subtree: parse revs in individual cmd_ functionsLuke Shumaker, Apr 23, 2021
  45. 22/30 subtree: remove duplicate checkLuke Shumaker, Apr 23, 2021
  46. 23/30 subtree: add comments and sanity checksLuke Shumaker, Apr 23, 2021
  47. Eric SunshineApr 23, 2021
  48. Luke ShumakerApr 23, 2021
  49. 24/30 subtree: don't let debug and progress output clashLuke Shumaker, Apr 23, 2021
  50. Eric SunshineApr 23, 2021
  51. Luke ShumakerApr 24, 2021
  52. Eric SunshineApr 24, 2021
  53. 25/30 subtree: have $indent actually affect indentationLuke Shumaker, Apr 23, 2021
  54. 26/30 subtree: give the docs a once-overLuke Shumaker, Apr 23, 2021
  55. 27/30 subtree: allow --squash to be used with --rejoinLuke Shumaker, Apr 23, 2021
  56. Eric SunshineApr 24, 2021
  57. Luke ShumakerApr 25, 2021
  58. 28/30 subtree: allow 'split' flags to be passed to 'push'Luke Shumaker, Apr 23, 2021
  59. 29/30 subtree: push: allow specifying a local rev other than HEADLuke Shumaker, Apr 23, 2021
  60. 30/30 subtree: be stricter about validating flagsLuke Shumaker, Apr 23, 2021
  61. Danny LinApr 25, 2021
  62. Luke ShumakerApr 26, 2021
  63. Luke ShumakerApr 23, 2021
  64. =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= BjarmasonApr 26, 2021
  65. Junio C HamanoApr 27, 2021
  66. 00/30 subtree: clean up, improve UXLuke Shumaker, Apr 26, 2021
  67. 01/30 .gitignore: Ignore /git-subtreeLuke Shumaker, Apr 26, 2021
  68. 02/30 subtree: t7900: update for having the default branch name be 'main'Luke Shumaker, Apr 26, 2021
  69. 04/30 subtree: t7900: use consistent formattingLuke Shumaker, Apr 26, 2021
  70. Luke ShumakerApr 26, 2021
  71. 03/30 subtree: t7900: use test-lib.sh's test_countLuke Shumaker, Apr 26, 2021
  72. 05/30 subtree: t7900: comment subtree_test_create_repoLuke Shumaker, Apr 26, 2021
  73. 06/30 subtree: t7900: use 'test' for string equalityLuke Shumaker, Apr 26, 2021
  74. 07/30 subtree: t7900: delete some dead codeLuke Shumaker, Apr 26, 2021
  75. 08/30 subtree: t7900: fix 'verify one file change per commit'Luke Shumaker, Apr 26, 2021
  76. 09/30 subtree: t7900: rename last_commit_message to last_commit_subjectLuke Shumaker, Apr 26, 2021
  77. 10/30 subtree: t7900: add a test for the -h flagLuke Shumaker, Apr 26, 2021
  78. 11/30 subtree: t7900: add porcelain tests for 'pull' and 'push'Luke Shumaker, Apr 26, 2021
  79. 12/30 subtree: don't have loose code outside of a functionLuke Shumaker, Apr 26, 2021
  80. 13/30 subtree: more consistent error propagationLuke Shumaker, Apr 26, 2021
  81. 16/30 subtree: use git-sh-setup's `say`Luke Shumaker, Apr 26, 2021
  82. 14/30 subtree: drop support for git < 1.7Luke Shumaker, Apr 26, 2021
  83. 17/30 subtree: use more explicit variable names for cmdline argsLuke Shumaker, Apr 26, 2021
  84. 15/30 subtree: use `git merge-base --is-ancestor`Luke Shumaker, Apr 26, 2021
  85. 18/30 subtree: use "$*" instead of "$@" as appropriateLuke Shumaker, Apr 26, 2021
  86. 20/30 subtree: use "^{commit}" instead of "^0"Luke Shumaker, Apr 26, 2021
  87. 21/30 subtree: parse revs in individual cmd_ functionsLuke Shumaker, Apr 26, 2021
  88. 19/30 subtree: Don't fuss with PATHLuke Shumaker, Apr 26, 2021
  89. Luke ShumakerApr 26, 2021
  90. 22/30 subtree: remove duplicate checkLuke Shumaker, Apr 26, 2021
  91. 28/30 subtree: allow 'split' flags to be passed to 'push'Luke Shumaker, Apr 26, 2021
  92. 24/30 subtree: don't let debug and progress output clashLuke Shumaker, Apr 26, 2021
  93. 23/30 subtree: add comments and sanity checksLuke Shumaker, Apr 26, 2021
  94. 30/30 subtree: be stricter about validating flagsLuke Shumaker, Apr 26, 2021
  95. 29/30 subtree: push: allow specifying a local rev other than HEADLuke Shumaker, Apr 26, 2021
  96. 25/30 subtree: have $indent actually affect indentationLuke Shumaker, Apr 26, 2021
  97. 27/30 subtree: allow --squash to be used with --rejoinLuke Shumaker, Apr 26, 2021
  98. Luke ShumakerApr 26, 2021
  99. 26/30 subtree: give the docs a once-overLuke Shumaker, Apr 26, 2021
  100. 00/30 subtree: clean up, improve UXLuke Shumaker, Apr 27, 2021
  101. 01/30 .gitignore: Ignore /git-subtreeLuke Shumaker, Apr 27, 2021
  102. 02/30 subtree: t7900: update for having the default branch name be 'main'Luke Shumaker, Apr 27, 2021
  103. Ævar Arnfjörð BjarmasonApr 30, 2021
  104. Luke ShumakerApr 30, 2021
  105. 03/30 subtree: t7900: use test-lib.sh's test_countLuke Shumaker, Apr 27, 2021
  106. Ævar Arnfjörð BjarmasonApr 30, 2021
  107. Luke ShumakerApr 30, 2021
  108. 04/30 subtree: t7900: use consistent formattingLuke Shumaker, Apr 27, 2021
  109. 05/30 subtree: t7900: comment subtree_test_create_repoLuke Shumaker, Apr 27, 2021
  110. Ævar Arnfjörð BjarmasonApr 30, 2021
  111. Luke ShumakerApr 30, 2021
  112. 06/30 subtree: t7900: use 'test' for string equalityLuke Shumaker, Apr 27, 2021
  113. Ævar Arnfjörð BjarmasonApr 30, 2021
  114. Luke ShumakerApr 30, 2021
  115. 07/30 subtree: t7900: delete some dead codeLuke Shumaker, Apr 27, 2021
  116. 08/30 subtree: t7900: fix 'verify one file change per commit'Luke Shumaker, Apr 27, 2021
  117. 09/30 subtree: t7900: rename last_commit_message to last_commit_subjectLuke Shumaker, Apr 27, 2021
  118. Ævar Arnfjörð BjarmasonApr 30, 2021
  119. 10/30 subtree: t7900: add a test for the -h flagLuke Shumaker, Apr 27, 2021
  120. Ævar Arnfjörð BjarmasonApr 30, 2021
  121. Luke ShumakerApr 30, 2021
  122. Bagas SanjayaApr 30, 2021
  123. Luke ShumakerApr 30, 2021
  124. 11/30 subtree: t7900: add porcelain tests for 'pull' and 'push'Luke Shumaker, Apr 27, 2021
  125. 12/30 subtree: don't have loose code outside of a functionLuke Shumaker, Apr 27, 2021
  126. 14/30 subtree: drop support for git < 1.7Luke Shumaker, Apr 27, 2021
  127. 13/30 subtree: more consistent error propagationLuke Shumaker, Apr 27, 2021
  128. 15/30 subtree: use `git merge-base --is-ancestor`Luke Shumaker, Apr 27, 2021
  129. 16/30 subtree: use git-sh-setup's `say`Luke Shumaker, Apr 27, 2021
  130. 17/30 subtree: use more explicit variable names for cmdline argsLuke Shumaker, Apr 27, 2021
  131. 18/30 subtree: use "$*" instead of "$@" as appropriateLuke Shumaker, Apr 27, 2021
  132. 19/30 subtree: don't fuss with PATHLuke Shumaker, Apr 27, 2021
  133. 20/30 subtree: use "^{commit}" instead of "^0"Luke Shumaker, Apr 27, 2021
  134. 21/30 subtree: parse revs in individual cmd_ functionsLuke Shumaker, Apr 27, 2021
  135. 22/30 subtree: remove duplicate checkLuke Shumaker, Apr 27, 2021
  136. 24/30 subtree: don't let debug and progress output clashLuke Shumaker, Apr 27, 2021
  137. 25/30 subtree: have $indent actually affect indentationLuke Shumaker, Apr 27, 2021
  138. 23/30 subtree: add comments and sanity checksLuke Shumaker, Apr 27, 2021
  139. 26/30 subtree: give the docs a once-overLuke Shumaker, Apr 27, 2021
  140. 28/30 subtree: allow 'split' flags to be passed to 'push'Luke Shumaker, Apr 27, 2021
  141. 29/30 subtree: push: allow specifying a local rev other than HEADLuke Shumaker, Apr 27, 2021
  142. 27/30 subtree: allow --squash to be used with --rejoinLuke Shumaker, Apr 27, 2021
  143. 30/30 subtree: be stricter about validating flagsLuke Shumaker, Apr 27, 2021
  144. Luke ShumakerApr 28, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.