diff mbox series

[v4,4/3] t0018: two small fixes

Message ID xmqqbk5hyw30.fsf@gitster.g (mailing list archive)
State Accepted
Commit cbdc83f1514963f86e8f027f9e75cde7f757c2a8
Headers show
Series advice: add "all" option to disable all hints | expand

Commit Message

Junio C Hamano May 8, 2024, 12:40 a.m. UTC
Even though the three tests that were recently added started their
here-doc with "<<-\EOF", it did not take advantage of that and
instead wrote the here-doc payload abut to the left edge.  Use a tabs
to indent these lines.

More importantly, because these all hardcode the expected output,
which contains the current branch name, they break the CI job that
uses 'main' as the default branch name.

Use

    GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=trunk
    export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

between the test_description line and ". ./test-lib.sh" line to
force the initial branch name to 'trunk' and expect it to show in
the output.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * I should have noticed these before merging the series to 'next',
   so here is a fix-up patch on top of the three patches.

 t/t0018-advice.sh | 41 ++++++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 19 deletions(-)
diff mbox series

Patch

diff --git c/t/t0018-advice.sh w/t/t0018-advice.sh
index b02448ea16..29306b367c 100755
--- c/t/t0018-advice.sh
+++ w/t/t0018-advice.sh
@@ -2,6 +2,9 @@ 
 
 test_description='Test advise_if_enabled functionality'
 
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=trunk
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
 TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
@@ -31,15 +34,15 @@  test_expect_success 'advice should not be printed when config variable is set to
 
 test_expect_success 'advice should not be printed when --no-advice is used' '
 	q_to_tab >expect <<-\EOF &&
-On branch master
+	On branch trunk
 
-No commits yet
+	No commits yet
 
-Untracked files:
-QREADME
+	Untracked files:
+	QREADME
 
-nothing added to commit but untracked files present
-EOF
+	nothing added to commit but untracked files present
+	EOF
 
 	test_when_finished "rm -fr advice-test" &&
 	git init advice-test &&
@@ -53,15 +56,15 @@  EOF
 
 test_expect_success 'advice should not be printed when GIT_ADVICE is set to false' '
 	q_to_tab >expect <<-\EOF &&
-On branch master
+	On branch trunk
 
-No commits yet
+	No commits yet
 
-Untracked files:
-QREADME
+	Untracked files:
+	QREADME
 
-nothing added to commit but untracked files present
-EOF
+	nothing added to commit but untracked files present
+	EOF
 
 	test_when_finished "rm -fr advice-test" &&
 	git init advice-test &&
@@ -75,16 +78,16 @@  EOF
 
 test_expect_success 'advice should be printed when GIT_ADVICE is set to true' '
 	q_to_tab >expect <<-\EOF &&
-On branch master
+	On branch trunk
 
-No commits yet
+	No commits yet
 
-Untracked files:
-  (use "git add <file>..." to include in what will be committed)
-QREADME
+	Untracked files:
+	  (use "git add <file>..." to include in what will be committed)
+	QREADME
 
-nothing added to commit but untracked files present (use "git add" to track)
-EOF
+	nothing added to commit but untracked files present (use "git add" to track)
+	EOF
 
 	test_when_finished "rm -fr advice-test" &&
 	git init advice-test &&