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

Re: t4151 missing quotes

From
Junio C Hamano <gitster@pobox.com>
Date
May 9, 2016, 18:56 UTC
Message-ID
<xmqq37pruklb.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CALR6jEgaNSAQOpxSK46h71PMRhakDa=UCC5gbTyg77BcaOaoPg@mail.gmail.com>

Something like this follows Documentation/SubmittingPatches, except that it further needs your Sign-off before mine, which I can forge if you say it is OK.

Thanks for a report and an analysis of the issue.
-- >8 --
From: Armin Kunaschik <megabreit@googlemail.com>
Subject: t4151: make sure argument to 'test -z' is given

88d50724 (am --skip: revert changes introduced by failed 3way merge, 2015-06-06), unlike all the other patches in the series, forgot to quote the output from "$(git ls-files -u)" when using it as the argument to "test -z", leading to a syntax error.

Note that $(git ls-files -u | wc -l) are deliberately left unquoted, as some implementations of "wc -l" includes extra blank characters in its output and cannot be compared as string, i.e. "test 0 = $(...)".

Signed-off-by: 
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t4151-am-abort.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t4151-am-abort.sh b/t/t4151-am-abort.sh
index 833e7b2..b878c21 100755
--- a/t/t4151-am-abort.sh
+++ b/t/t4151-am-abort.sh
@@ -82,7 +82,7 @@ test_expect_success 'am -3 --abort removes otherfile-4' '
 	test 4 = "$(cat otherfile-4)" &&
 	git am --abort &&
 	test_cmp_rev initial HEAD &&
-	test -z $(git ls-files -u) &&
+	test -z "$(git ls-files -u)" &&
 	test_path_is_missing otherfile-4
 '
 
Previous: Armin KunaschikNext: Stefan Beller
Message 7 of 13 in “t4151 missing quotes”
  1. Armin KunaschikMay 9, 2016
  2. Eric SunshineMay 9, 2016
  3. Eric SunshineMay 9, 2016
  4. Armin KunaschikMay 9, 2016
  5. Eric SunshineMay 9, 2016
  6. Armin KunaschikMay 9, 2016
  7. Junio C HamanoMay 9, 2016
  8. Stefan BellerMay 9, 2016
  9. Eric SunshineMay 9, 2016
  10. Junio C HamanoMay 9, 2016
  11. Eric SunshineMay 9, 2016
  12. Armin KunaschikMay 10, 2016
  13. Jeff KingMay 10, 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.