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

[PATCH 3/8] t5512: stop losing return codes of git commands

From
Denton Liu <liu.denton@gmail.com>
Date
Mar 25, 2020, 05:54 UTC
Message-ID
<b3addeb98547783a31e2e2b876478a5dd96e04ec.1585115341.git.liu.denton@gmail.com>
In-Reply-To
<cover.1585115341.git.liu.denton@gmail.com>

In a pipe, only the return code of the last command is used. Thus, all other commands will have their return codes masked. Rewrite pipes so that there are no git commands upstream so that their failure is reported.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
---
 t/t5512-ls-remote.sh | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh
index 62d02152c7..fea64eb5c2 100755
--- a/t/t5512-ls-remote.sh
+++ b/t/t5512-ls-remote.sh
@@ -21,11 +21,11 @@ test_expect_success setup '
 	git tag mark1.1 &&
 	git tag mark1.2 &&
 	git tag mark1.10 &&
-	git show-ref --tags -d | sed -e "s/ /	/" >expected.tag &&
-	(
-		echo "$(git rev-parse HEAD)	HEAD" &&
-		git show-ref -d	| sed -e "s/ /	/"
-	) >expected.all &&
+	git show-ref --tags -d >expected.tag.raw &&
+	sed -e "s/ /	/" expected.tag.raw >expected.tag &&
+	generate_references HEAD >expected.all &&
+	git show-ref -d	>refs &&
+	sed -e "s/ /	/" refs >>expected.all &&
 
 	git remote add self "$(pwd)/.git"
 '
@@ -173,8 +173,8 @@ do
 		test_config $configsection.hiderefs refs/tags &&
 		git ls-remote . >actual &&
 		test_unconfig $configsection.hiderefs &&
-		git ls-remote . |
-		sed -e "/	refs\/tags\//d" >expect &&
+		git ls-remote . >expect.raw &&
+		sed -e "/	refs\/tags\//d" expect.raw >expect &&
 		test_cmp expect actual
 	'
 
-- 
2.25.0.114.g5b0ca878e0
Previous: Denton LiuNext: Denton Liu
Message 3 of 30 in “t: replace incorrect test_must_fail usage (part 3)”
  1. 0/8 t: replace incorrect test_must_fail usage (part 3)Denton Liu, Mar 25, 2020
  2. 1/8 t5512: don't use `test_must_fail test_cmp`Denton Liu, Mar 25, 2020
  3. 3/8 t5512: stop losing return codes of git commandsDenton Liu, Mar 25, 2020
  4. 2/8 t5512: generate references with generate_references()Denton Liu, Mar 25, 2020
  5. Eric SunshineMar 25, 2020
  6. Junio C HamanoMar 25, 2020
  7. 5/8 t5607: reorder `nongit test_must_fail`Denton Liu, Mar 25, 2020
  8. 4/8 t5550: remove use of `test_might_fail grep`Denton Liu, Mar 25, 2020
  9. Junio C HamanoMar 25, 2020
  10. 8/8 t5801: teach compare_refs() to accept !Denton Liu, Mar 25, 2020
  11. Junio C HamanoMar 25, 2020
  12. Eric SunshineMar 25, 2020
  13. 7/8 t5612: stop losing return codes of git commandsDenton Liu, Mar 25, 2020
  14. 6/8 t5612: don't use `test_must_fail test_cmp`Denton Liu, Mar 25, 2020
  15. Junio C HamanoMar 25, 2020
  16. 0/8 t: replace incorrect test_must_fail usage (part 3)Denton Liu, Mar 26, 2020
  17. 1/8 t5512: don't use `test_must_fail test_cmp`Denton Liu, Mar 26, 2020
  18. 2/8 t5512: stop losing git exit code in here-docsDenton Liu, Mar 26, 2020
  19. Eric SunshineMar 26, 2020
  20. 3/8 t5512: stop losing return codes of git commandsDenton Liu, Mar 26, 2020
  21. 4/8 t5550: simplify no matching line checkDenton Liu, Mar 26, 2020
  22. Eric SunshineMar 26, 2020
  23. 5/8 t5607: reorder `nongit test_must_fail`Denton Liu, Mar 26, 2020
  24. 6/8 t5612: don't use `test_must_fail test_cmp`Denton Liu, Mar 26, 2020
  25. 7/8 t5612: stop losing return codes of git commandsDenton Liu, Mar 26, 2020
  26. 8/8 t5801: teach compare_refs() to accept !Denton Liu, Mar 26, 2020
  27. 9/9 fixup! t5512: stop losing git exit code in here-docsDenton Liu, Mar 27, 2020
  28. Junio C HamanoMar 27, 2020
  29. Eric SunshineMar 27, 2020
  30. Junio C HamanoMar 27, 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.