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

[PATCH] Fix a false negative in t5512 when run using sh -x

From
Johannes Sixt <j6t@kdbg.org>
Date
May 10, 2010, 07:19 UTC
Message-ID
<1273475946-2079-1-git-send-email-j6t@kdbg.org>

The test compares the stderr of a git command called with test_must_fail to some expected output. With bash (and probably other shells as well) when run with -x turned on, command trace output ends up in the captured output. Of course, the actual output does not match the expected output anymore.

Use 'grep' to check for expected output.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 t/t5512-ls-remote.sh |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh
index 3cf1b3d..24c8684 100755
--- a/t/t5512-ls-remote.sh
+++ b/t/t5512-ls-remote.sh
@@ -86,10 +86,6 @@ test_expect_success 'use branch.<name>.remote if possible' '
 
 '
 
-cat >exp <<EOF
-fatal: 'refs*master' does not appear to be a git repository
-fatal: The remote end hung up unexpectedly
-EOF
 test_expect_success 'confuses pattern as remote when no remote specified' '
 	#
 	# Do not expect "git ls-remote <pattern>" to work; ls-remote, correctly,
@@ -103,7 +99,7 @@ test_expect_success 'confuses pattern as remote when no remote specified' '
 	# We could just as easily have used "master"; the "*" emphasizes its
 	# role as a pattern.
 	test_must_fail git ls-remote refs*master >actual 2>&1 &&
-	test_cmp exp actual
+	grep "does not appear to be a git repository" actual
 
 '
 
-- 
1.7.1.75.g68e2c
Next: Tay Ray Chuan
Message 1 of 9 in “Fix a false negative in t5512 when run using sh -x”
  1. Fix a false negative in t5512 when run using sh -xJohannes Sixt, May 10, 2010
  2. Tay Ray ChuanMay 10, 2010
  3. Sverre RabbelierMay 10, 2010
  4. Johannes SixtMay 10, 2010
  5. Sverre RabbelierMay 10, 2010
  6. Jonathan NiederMay 10, 2010
  7. Johannes SixtMay 10, 2010
  8. Jonathan NiederMay 10, 2010
  9. Johannes SixtMay 10, 2010

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.