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

Re: What's cooking in git.git (Mar 2010, #03; Wed, 10)

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 12, 2010, 05:52 UTC
Message-ID
<7vhbomt7be.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7vtysmt7wo.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> Subject: t9400: Use test_cmp when appropriate
And this is an obvious follow-up.
-- >8 --
Subject: t5516: Use test_cmp when appropriate

Consistently using test_cmp would make debugging test scripts far easier, as output from them run under "-v" option becomes readable.

Besides, some platforms' "diff" implementations lack "-q" option.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t5516-fetch-push.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 11adb0b..2de98e6 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -672,7 +672,7 @@ test_expect_success 'push --porcelain' '
 		test "z$r" = "z$the_commit" &&
 		test 1 = $(git for-each-ref refs/remotes/origin | wc -l)
 	) &&
-	diff -q .git/foo .git/bar
+	test_cmp .git/foo .git/bar
 '
 
 test_expect_success 'push --porcelain bad url' '
@@ -692,7 +692,7 @@ test_expect_success 'push --porcelain rejected' '
 	echo >>.git/foo "!	refs/heads/master:refs/heads/master	[remote rejected] (branch is currently checked out)" &&
 
 	test_must_fail git push >.git/bar --porcelain  testrepo refs/heads/master:refs/heads/master &&
-	diff -q .git/foo .git/bar
+	test_cmp .git/foo .git/bar
 '
 
 test_expect_success 'push --porcelain --dry-run rejected' '
@@ -707,7 +707,7 @@ test_expect_success 'push --porcelain --dry-run rejected' '
 	echo >>.git/foo "Done" &&
 
 	test_must_fail git push >.git/bar --porcelain  --dry-run testrepo refs/heads/master^:refs/heads/master &&
-	diff -q .git/foo .git/bar
+	test_cmp .git/foo .git/bar
 '
 
 test_done
Previous: Junio C Hamano
Message 7 of 7 in “What's cooking in git.git (Mar 2010, #03; Wed, 10)”
  1. Junio C HamanoMar 11, 2010
  2. Johan HerlandMar 11, 2010
  3. Junio C HamanoMar 11, 2010
  4. Thomas RastMar 12, 2010
  5. Nguyen Thai Ngoc DuyMar 12, 2010
  6. Junio C HamanoMar 12, 2010
  7. Junio C HamanoMar 12, 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.