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

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

From
Junio C Hamano <gitster@pobox.com>
Date
May 8, 2024, 00:40 UTC
Message-ID
<xmqqbk5hyw30.fsf@gitster.g>
In-Reply-To
<20240503071706.78109-4-james@jamesliu.io>

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 --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 &&
Previous: James LiuNext: Dragan Simic
Message 46 of 67 in “advice: add "all" option to disable all hints”
  1. 0/2 advice: add "all" option to disable all hintsJames Liu, Apr 24, 2024
  2. 1/2 advice: allow advice type to be provided in testsJames Liu, Apr 24, 2024
  3. Patrick SteinhardtApr 24, 2024
  4. 2/2 advice: add "all" option to disable all hintsJames Liu, Apr 24, 2024
  5. Patrick SteinhardtApr 24, 2024
  6. Junio C HamanoApr 24, 2024
  7. Patrick SteinhardtApr 24, 2024
  8. Phillip WoodApr 24, 2024
  9. Patrick SteinhardtApr 24, 2024
  10. Junio C HamanoApr 24, 2024
  11. Patrick SteinhardtApr 25, 2024
  12. Junio C HamanoApr 25, 2024
  13. Dragan SimicApr 24, 2024
  14. Dragan SimicApr 24, 2024
  15. Junio C HamanoApr 24, 2024
  16. Patrick SteinhardtApr 25, 2024
  17. Dragan SimicApr 24, 2024
  18. 0/1 advice: add --no-advice global optionJames Liu, Apr 29, 2024
  19. 1/1 advice: add --no-advice global optionJames Liu, Apr 29, 2024
  20. Dragan SimicApr 29, 2024
  21. James LiuApr 29, 2024
  22. Dragan SimicApr 29, 2024
  23. Dragan SimicApr 29, 2024
  24. Eric SunshineApr 29, 2024
  25. Dragan SimicApr 29, 2024
  26. Jeff KingApr 29, 2024
  27. Dragan SimicApr 29, 2024
  28. Junio C HamanoApr 29, 2024
  29. James LiuApr 30, 2024
  30. Junio C HamanoApr 29, 2024
  31. Rubén JustoApr 29, 2024
  32. Dragan SimicApr 29, 2024
  33. 0/1 advice: add --no-advice global optionJames Liu, Apr 30, 2024
  34. 1/1 advice: add --no-advice global optionJames Liu, Apr 30, 2024
  35. Patrick SteinhardtApr 30, 2024
  36. Dragan SimicApr 30, 2024
  37. Junio C HamanoApr 30, 2024
  38. 0/3 advice: add "all" option to disable all hintsJames Liu, May 3, 2024
  39. 1/3 doc: clean up usage documentation for --no-* optsJames Liu, May 3, 2024
  40. Junio C HamanoMay 3, 2024
  41. James LiuMay 6, 2024
  42. 2/3 doc: add spacing around paginate optionsJames Liu, May 3, 2024
  43. Karthik NayakMay 3, 2024
  44. Junio C HamanoMay 3, 2024
  45. 3/3 advice: add --no-advice global optionJames Liu, May 3, 2024
  46. 4/3 t0018: two small fixesJunio C Hamano, May 8, 2024
  47. Dragan SimicMay 3, 2024
  48. Re* [PATCH v4 0/3] advice: add "all" option to disable all hintsJunio C Hamano, May 3, 2024
  49. Eric SunshineMay 3, 2024
  50. Junio C HamanoMay 3, 2024
  51. Junio C HamanoMay 3, 2024
  52. Eric SunshineMay 3, 2024
  53. Johannes SchindelinMay 5, 2024
  54. Re* Re* [PATCH v4 0/3] advice: add "all" option to disable all hintsJunio C Hamano, May 6, 2024
  55. Dragan SimicMay 7, 2024
  56. Junio C HamanoMay 7, 2024
  57. Dragan SimicMay 7, 2024
  58. Dragan SimicMay 7, 2024
  59. Karthik NayakMay 3, 2024
  60. James LiuMay 5, 2024
  61. Junio C HamanoMay 3, 2024
  62. James LiuMay 5, 2024
  63. James LiuMay 6, 2024
  64. Junio C HamanoMay 6, 2024
  65. James LiuMay 6, 2024
  66. Karthik NayakMay 7, 2024
  67. Junio C HamanoMay 6, 2024

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.