git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] test-lib-functions: suppress a 'git rev-parse' error in 'test_commit_bulk'
@ 2019-11-25 12:59 SZEDER Gábor
  2019-11-25 13:19 ` Jeff King
  0 siblings, 1 reply; 2+ messages in thread
From: SZEDER Gábor @ 2019-11-25 12:59 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, git, SZEDER Gábor

When 'test_commit_bulk' is invoked in an empty test repository, it
prints a "fatal: Needed a single revision" error, but still does what
it's supposed to do.  A test helper function displaying a fatal error
and still succeeding is always suspect to be buggy, but luckily that's
not the case here: that error comes from a 'git rev-parse --verify
HEAD' command invoked in a condition, which doesn't have anything to
verify in an empty repository.

Use the '--quiet' option to suppress that error message.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
---
 t/test-lib-functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index b299ecc326..6302bfb51d 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -308,7 +308,7 @@ test_commit_bulk () {
 	total=$1
 
 	add_from=
-	if git -C "$indir" rev-parse --verify "$ref"
+	if git -C "$indir" rev-parse --quiet --verify "$ref"
 	then
 		add_from=t
 	fi
-- 
2.24.0.587.g7096fda53a


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] test-lib-functions: suppress a 'git rev-parse' error in 'test_commit_bulk'
  2019-11-25 12:59 [PATCH] test-lib-functions: suppress a 'git rev-parse' error in 'test_commit_bulk' SZEDER Gábor
@ 2019-11-25 13:19 ` Jeff King
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2019-11-25 13:19 UTC (permalink / raw)
  To: SZEDER Gábor; +Cc: Junio C Hamano, git

On Mon, Nov 25, 2019 at 01:59:07PM +0100, SZEDER Gábor wrote:

> When 'test_commit_bulk' is invoked in an empty test repository, it
> prints a "fatal: Needed a single revision" error, but still does what
> it's supposed to do.  A test helper function displaying a fatal error
> and still succeeding is always suspect to be buggy, but luckily that's
> not the case here: that error comes from a 'git rev-parse --verify
> HEAD' command invoked in a condition, which doesn't have anything to
> verify in an empty repository.
> 
> Use the '--quiet' option to suppress that error message.

Yep, makes perfect sense. Thanks.

-Peff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-25 13:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-25 12:59 [PATCH] test-lib-functions: suppress a 'git rev-parse' error in 'test_commit_bulk' SZEDER Gábor
2019-11-25 13:19 ` Jeff King

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).