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

[PATCH] t3920: don't ignore errors of more than one command with `|| true`

From
Johannes Sixt <j6t@kdbg.org>
Date
Nov 21, 2022, 17:58 UTC
Message-ID
<febcfb0a-c410-fb71-cff9-92acfcb269e2@kdbg.org>

It is customary to write `A || true` to ignore a potential error exit of command A. But when we have a sequence `A && B && C || true && D`, then a failure of any of A, B, or C skips to D right away. This is not intended here. Turn the command whose failure is to be ignored into a compound command to ensure it is the only one that is allowed to fail.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 t/t3920-crlf-messages.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t3920-crlf-messages.sh b/t/t3920-crlf-messages.sh
index 4c661d4d54..a58522c163 100755
--- a/t/t3920-crlf-messages.sh
+++ b/t/t3920-crlf-messages.sh
@@ -12,7 +12,7 @@ create_crlf_ref () {
 	cat >.crlf-orig-$branch.txt &&
 	cat .crlf-orig-$branch.txt | append_cr >.crlf-message-$branch.txt &&
 	grep 'Subject' .crlf-orig-$branch.txt | tr '\n' ' ' | sed 's/[ ]*$//' | tr -d '\n' >.crlf-subject-$branch.txt &&
-	grep 'Body' .crlf-message-$branch.txt >.crlf-body-$branch.txt || true &&
+	{ grep 'Body' .crlf-message-$branch.txt >.crlf-body-$branch.txt || true; } &&
 	LIB_CRLF_BRANCHES="${LIB_CRLF_BRANCHES} ${branch}" &&
 	test_tick &&
 	hash=$(git commit-tree HEAD^{tree} -p HEAD -F .crlf-message-${branch}.txt) &&
-- 
2.36.0.137.geb37740430
Next: René Scharfe
Message 1 of 25 in “t3920: don't ignore errors of more than one command with `|| true`”
  1. t3920: don't ignore errors of more than one command with `|| true`Johannes Sixt, Nov 21, 2022
  2. René ScharfeNov 21, 2022
  3. Junio C HamanoNov 22, 2022
  4. Philippe BlainNov 22, 2022
  5. Ævar Arnfjörð BjarmasonNov 22, 2022
  6. Johannes SixtNov 22, 2022
  7. Ævar Arnfjörð BjarmasonNov 22, 2022
  8. Junio C HamanoNov 23, 2022
  9. 2/1 t3920: support CR-eating grepRené Scharfe, Dec 2, 2022
  10. Philippe BlainDec 2, 2022
  11. René ScharfeDec 3, 2022
  12. Eric SunshineDec 2, 2022
  13. René ScharfeDec 3, 2022
  14. Junio C HamanoDec 5, 2022
  15. René ScharfeDec 5, 2022
  16. Junio C HamanoDec 5, 2022
  17. René ScharfeDec 5, 2022
  18. 3/1 t3920: simplify redirection of loop outputRené Scharfe, Dec 2, 2022
  19. 4/1 t3920: replace two cats with a teeRené Scharfe, Dec 2, 2022
  20. Eric SunshineDec 3, 2022
  21. René ScharfeDec 3, 2022
  22. Ævar Arnfjörð BjarmasonDec 3, 2022
  23. René ScharfeDec 3, 2022
  24. Ævar Arnfjörð BjarmasonDec 4, 2022
  25. Eric SunshineDec 4, 2022

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.