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

[PATCH v9 2/3] t7507-commit-verbose: make test suite use write_script

From
Pranit Bauva <pranit.bauva@gmail.com>
Date
Mar 24, 2016, 08:25 UTC
Message-ID
<01020153a7ba4eae-9b88e119-0505-418f-a137-595250edaa9d-000000@eu-west-1.amazonses.com>
In-Reply-To
<01020153a7ba4e07-f326395b-63df-4f8a-b378-8f387b02d0bd-000000@eu-west-1.amazonses.com>
Also remove test_set_editor from global scope and use it in whichever
test it is required.
---
 t/t7507-commit-verbose.sh | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh
index 2ddf28c..cf95efb 100755
--- a/t/t7507-commit-verbose.sh
+++ b/t/t7507-commit-verbose.sh
@@ -3,12 +3,11 @@
 test_description='verbose commit template'
 . ./test-lib.sh
 
-cat >check-for-diff <<EOF
-#!$SHELL_PATH
-exec grep '^diff --git' "\$1"
+write_script "check-for-diff" <<-\EOF &&
+grep '^diff --git' "$1" >out &&
+test $(wc -l <out) = 1
 EOF
 chmod +x check-for-diff
-test_set_editor "$PWD/check-for-diff"
 
 cat >message <<'EOF'
 subject
@@ -23,6 +22,7 @@ test_expect_success 'setup' '
 '
 
 test_expect_success 'initial commit shows verbose diff' '
+	test_set_editor "$PWD/check-for-diff" &&
 	git commit --amend -v
 '
 
@@ -38,11 +38,13 @@ check_message() {
 }
 
 test_expect_success 'verbose diff is stripped out' '
+	test_set_editor "$PWD/check-for-diff" &&
 	git commit --amend -v &&
 	check_message message
 '
 
 test_expect_success 'verbose diff is stripped out (mnemonicprefix)' '
+	test_set_editor "$PWD/check-for-diff" &&
 	git config diff.mnemonicprefix true &&
 	git commit --amend -v &&
 	check_message message
@@ -66,11 +68,13 @@ test_expect_success 'diff in message is retained without -v' '
 '
 
 test_expect_success 'diff in message is retained with -v' '
+	test_set_editor "$PWD/check-for-diff" &&
 	git commit --amend -F diff -v &&
 	check_message diff
 '
 
 test_expect_success 'submodule log is stripped out too with -v' '
+	test_set_editor "$PWD/check-for-diff" &&
 	git config diff.submodule log &&
 	git submodule add ./. sub &&
 	git commit -m "sub added" &&

--
https://github.com/git/git/pull/218
Previous: Pranit BauvaNext: SZEDER Gábor
Message 2 of 23 in “parse-options.c: make OPTION__COUNTUP consider negative values”
  1. 1/3 parse-options.c: make OPTION__COUNTUP consider negative valuesPranit Bauva, Mar 24, 2016
  2. 2/3 t7507-commit-verbose: make test suite use write_scriptPranit Bauva, Mar 24, 2016
  3. 2/3 t7507-commit-verbose: make test suite use write_scriptSZEDER Gábor, Mar 24, 2016
  4. Eric SunshineMar 24, 2016
  5. Pranit BauvaMar 25, 2016
  6. Eric SunshineMar 25, 2016
  7. Pranit BauvaMar 25, 2016
  8. SZEDER GáborMar 25, 2016
  9. Pranit BauvaMar 25, 2016
  10. Eric SunshineMar 25, 2016
  11. Pranit BauvaMar 25, 2016
  12. Eric SunshineMar 25, 2016
  13. 3/3 commit: add a commit.verbose config variablePranit Bauva, Mar 24, 2016
  14. SZEDER GáborMar 24, 2016
  15. Pranit BauvaMar 24, 2016
  16. Pranit BauvaMar 24, 2016
  17. Eric SunshineMar 25, 2016
  18. Pranit BauvaMar 25, 2016
  19. 1/3 parse-options.c: make OPTION__COUNTUP consider negative valuesSZEDER Gábor, Mar 24, 2016
  20. Pranit BauvaMar 24, 2016
  21. Eric SunshineMar 24, 2016
  22. Pranit BauvaMar 28, 2016
  23. Eric SunshineMar 28, 2016

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.