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

[PATCH 2/2] test: create repo using test_create_repo

From
Jiang Xin <worldhello.net@gmail.com>
Date
Jun 17, 2021, 12:43 UTC
Message-ID
<20210617124331.17888-2-zhiyou.jx@alibaba-inc.com>
In-Reply-To
<20210617124331.17888-1-zhiyou.jx@alibaba-inc.com>

When creating new repository, function "test_create_repo" uses env GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME as default branch. Replace "git-init" with "test_create_repo" in t5411, t5548 and t6020 to create repository with specific default branch.

Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
---
 t/t5411-proc-receive-hook.sh | 4 ++--
 t/t5548-push-porcelain.sh    | 7 +++++--
 t/t6020-bundle-misc.sh       | 2 +-
 3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/t/t5411-proc-receive-hook.sh b/t/t5411-proc-receive-hook.sh
index 98b0e81208..7148e5ab7e 100755
--- a/t/t5411-proc-receive-hook.sh
+++ b/t/t5411-proc-receive-hook.sh
@@ -18,8 +18,8 @@ setup_upstream_and_workbench () {
 	test_expect_success "setup upstream and workbench" '
 		rm -rf upstream.git &&
 		rm -rf workbench &&
-		git init --bare upstream.git &&
-		git init workbench &&
+		test_create_repo --bare upstream.git &&
+		test_create_repo workbench &&
 		create_commits_in workbench A B &&
 		(
 			cd workbench &&
diff --git a/t/t5548-push-porcelain.sh b/t/t5548-push-porcelain.sh
index 5a761f3642..8725b00a68 100755
--- a/t/t5548-push-porcelain.sh
+++ b/t/t5548-push-porcelain.sh
@@ -4,6 +4,9 @@
 #
 test_description='Test git push porcelain output'
 
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
 . ./test-lib.sh
 
 # Create commits in <repo> and assign each commit's oid to shell variables
@@ -61,8 +64,8 @@ setup_upstream_and_workbench () {
 	# Workbench after setup : main(A)
 	test_expect_success "setup upstream repository and workbench" '
 		rm -rf upstream.git workbench &&
-		git init --bare upstream.git &&
-		git init workbench &&
+		test_create_repo --bare upstream.git &&
+		test_create_repo workbench &&
 		create_commits_in workbench A B &&
 		(
 			cd workbench &&
diff --git a/t/t6020-bundle-misc.sh b/t/t6020-bundle-misc.sh
index 881f72fd44..4ad98a3385 100755
--- a/t/t6020-bundle-misc.sh
+++ b/t/t6020-bundle-misc.sh
@@ -315,7 +315,7 @@ test_expect_success 'create bundle 2 - has prerequisites' '
 '
 
 test_expect_success 'fail to verify bundle without prerequisites' '
-	git init --bare test1.git &&
+	test_create_repo --bare test1.git &&
 
 	cat >expect <<-\EOF &&
 	error: Repository lacks these prerequisite commits:
-- 
2.32.0.rc0.27.g7b1e85181b
Previous: Jiang XinNext: Ævar Arnfjörð Bjarmason
Message 2 of 4 in “test-lib-functions: test_create_repo learns --bare”
  1. 1/2 test-lib-functions: test_create_repo learns --bareJiang Xin, Jun 17, 2021
  2. 2/2 test: create repo using test_create_repoJiang Xin, Jun 17, 2021
  3. Ævar Arnfjörð BjarmasonJun 22, 2021
  4. Jiang XinJun 23, 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.