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

[PATCH v3 4/4] bisect: consistent style for git bisect run tests

From
Aaron Lipman <alipman88@gmail.com>
Date
Aug 1, 2020, 17:58 UTC
Message-ID
<20200801175840.1877-5-alipman88@gmail.com>
In-Reply-To
<20200801175840.1877-1-alipman88@gmail.com>
Enforce consistent styling for tests on "git bisect run":
- Use "write_script" to abstract away platform-specific details.
- Favor current whitespace conventions.
---
 t/t6030-bisect-porcelain.sh | 46 ++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 24 deletions(-)
diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index 51f5eb6ea3..63661c5e3d 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -243,32 +243,30 @@ test_expect_success 'bisect skip: with commit both bad and skipped' '
 '
 
 # We want to automatically find the commit that
-# introduced "Another" into hello.
-test_expect_success \
-    '"git bisect run" simple case' \
-    'echo "#"\!"/bin/sh" > test_script.sh &&
-     echo "grep Another hello > /dev/null" >> test_script.sh &&
-     echo "test \$? -ne 0" >> test_script.sh &&
-     chmod +x test_script.sh &&
-     git bisect start &&
-     git bisect good $HASH1 &&
-     git bisect bad $HASH4 &&
-     git bisect run ./test_script.sh > my_bisect_log.txt &&
-     grep "$HASH3 is the first bad commit" my_bisect_log.txt &&
-     git bisect reset'
+# added "Another" into hello.
+test_expect_success '"git bisect run" simple case' '
+	write_script test_script.sh <<-\EOF &&
+	! grep Another hello >/dev/null
+	EOF
+	git bisect start &&
+	git bisect good $HASH1 &&
+	git bisect bad $HASH4 &&
+	git bisect run ./test_script.sh >my_bisect_log.txt &&
+	grep "$HASH3 is the first bad commit" my_bisect_log.txt &&
+	git bisect reset
+'
 
 # We want to automatically find the commit that
-# introduced "Ciao" into hello.
-test_expect_success \
-    '"git bisect run" with more complex "git bisect start"' \
-    'echo "#"\!"/bin/sh" > test_script.sh &&
-     echo "grep Ciao hello > /dev/null" >> test_script.sh &&
-     echo "test \$? -ne 0" >> test_script.sh &&
-     chmod +x test_script.sh &&
-     git bisect start $HASH4 $HASH1 &&
-     git bisect run ./test_script.sh > my_bisect_log.txt &&
-     grep "$HASH4 is the first bad commit" my_bisect_log.txt &&
-     git bisect reset'
+# added "Ciao" into hello.
+test_expect_success '"git bisect run" with more complex "git bisect start"' '
+	write_script test_script.sh <<-\EOF &&
+	! grep Ciao hello >/dev/null
+	EOF
+	git bisect start $HASH4 $HASH1 &&
+	git bisect run ./test_script.sh >my_bisect_log.txt &&
+	grep "$HASH4 is the first bad commit" my_bisect_log.txt &&
+	git bisect reset
+'
 
 # $HASH1 is good, $HASH5 is bad, we skip $HASH3
 # but $HASH4 is good,
-- 
2.24.3 (Apple Git-128)
Previous: Martin ÅgrenNext: Martin Ågren
Message 18 of 42 in “Introduce --first-parent flag for git bisect”
  1. 0/3 Introduce --first-parent flag for git bisectAaron Lipman via GitGitGadget, Jul 28, 2020
  2. 1/3 rev-list: allow bisect and first-parent flagsAaron Lipman via GitGitGadget, Jul 28, 2020
  3. Junio C HamanoJul 28, 2020
  4. Junio C HamanoJul 28, 2020
  5. 2/3 bisect: introduce first-parent flagAaron Lipman via GitGitGadget, Jul 28, 2020
  6. 3/3 bisect: combine args passed to find_bisection()Aaron Lipman via GitGitGadget, Jul 28, 2020
  7. 0/3 Introduce --first-parent flag for git bisectAaron Lipman, Jul 30, 2020
  8. 1/3 rev-list: allow bisect and first-parent flagsAaron Lipman, Jul 30, 2020
  9. 2/3 bisect: introduce first-parent flagAaron Lipman, Jul 30, 2020
  10. Junio C HamanoJul 30, 2020
  11. 3/3 bisect: combine args passed to find_bisection()Aaron Lipman, Jul 30, 2020
  12. Junio C HamanoJul 30, 2020
  13. Junio C HamanoJul 30, 2020
  14. 0/4 Introduce --first-parent flag for git bisectAaron Lipman, Aug 1, 2020
  15. 1/4 rev-list: allow bisect and first-parent flagsAaron Lipman, Aug 1, 2020
  16. 3/4 bisect: combine args passed to find_bisection()Aaron Lipman, Aug 1, 2020
  17. Martin ÅgrenAug 1, 2020
  18. 4/4 bisect: consistent style for git bisect run testsAaron Lipman, Aug 1, 2020
  19. Martin ÅgrenAug 1, 2020
  20. 2/4 bisect: introduce first-parent flagAaron Lipman, Aug 1, 2020
  21. Junio C HamanoAug 1, 2020
  22. 0/5 Introduce --first-parent flag for git bisectAaron Lipman, Aug 4, 2020
  23. 1/5 t6030: modernize "git bisect run" testsAaron Lipman, Aug 4, 2020
  24. Christian CouderAug 5, 2020
  25. 2/5 rev-list: allow bisect and first-parent flagsAaron Lipman, Aug 4, 2020
  26. Eric SunshineAug 5, 2020
  27. 3/5 cmd_bisect__helper: defer parsing no-checkout flagAaron Lipman, Aug 4, 2020
  28. 4/5 bisect: introduce first-parent flagAaron Lipman, Aug 4, 2020
  29. 5/5 bisect: combine args passed to find_bisection()Aaron Lipman, Aug 4, 2020
  30. Junio C HamanoAug 4, 2020
  31. Christian CouderAug 5, 2020
  32. Junio C HamanoAug 7, 2020
  33. Eric SunshineAug 7, 2020
  34. Junio C HamanoAug 7, 2020
  35. Eric SunshineAug 7, 2020
  36. Martin ÅgrenAug 5, 2020
  37. 0/5 Introduce --first-parent flag for git bisectAaron Lipman, Aug 7, 2020
  38. 1/5 t6030: modernize "git bisect run" testsAaron Lipman, Aug 7, 2020
  39. 2/5 rev-list: allow bisect and first-parent flagsAaron Lipman, Aug 7, 2020
  40. 3/5 cmd_bisect__helper: defer parsing no-checkout flagAaron Lipman, Aug 7, 2020
  41. 5/5 bisect: combine args passed to find_bisection()Aaron Lipman, Aug 7, 2020
  42. 4/5 bisect: introduce first-parent flagAaron Lipman, Aug 7, 2020

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.