git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fabian Ruch <bafain@gmail.com>
To: David Aguilar <davvid@gmail.com>, Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] t1503: test rev-parse --verify --quiet with deleted reflogs
Date: Sun, 14 Sep 2014 18:20:57 +0200	[thread overview]
Message-ID: <5415C069.9000702@gmail.com> (raw)
In-Reply-To: <1410683442-74523-1-git-send-email-davvid@gmail.com>

Hi David,

On 09/14/2014 10:30 AM, David Aguilar wrote:
> Ensure that rev-parse --verify --quiet is silent when asked
> about deleted reflog entries.
> 
> Signed-off-by: David Aguilar <davvid@gmail.com>
> ---
> This verifies and depends on "refs: make rev-parse --quiet actually quiet".
> 
>  t/t1503-rev-parse-verify.sh | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/t/t1503-rev-parse-verify.sh b/t/t1503-rev-parse-verify.sh
> index 813cc1b..731c21c 100755
> --- a/t/t1503-rev-parse-verify.sh
> +++ b/t/t1503-rev-parse-verify.sh
> @@ -83,6 +83,15 @@ test_expect_success 'fails silently when using -q' '
>  	test -z "$(cat error)"
>  '
>  
> +test_expect_success 'fails silently when using -q with deleted reflogs' '
> +	ref=$(git rev-parse HEAD) &&
> +	: >.git/logs/refs/test &&
> +	git update-ref -m test refs/test "$ref" &&

I'm just curious, why not simply

   git branch test

?

> +	git reflog delete --updateref --rewrite refs/test@{0} &&
> +	test_must_fail git rev-parse --verify --quiet refs/test@{0} 2>error &&

Is it a shortcoming of the specification that it doesn't consider
whatever might be written to stdout? Is it acceptable that if the
git-rev-parse command succeeds, the error message from test_must_fail
will be written to the file "error" and, therefore, somewhat hidden from
the user running the tests?

> +	test -z "$(cat error)"

test(1) comes with an option (-s) to perform such tests and test-lib.sh
defines test_must_be_empty which additionally outputs the given file's
contents if its not empty.

> +'
> +
>  test_expect_success 'no stdout output on error' '
>  	test -z "$(git rev-parse --verify)" &&
>  	test -z "$(git rev-parse --verify foo)" &&
> 

Kind regards,
   Fabian

  reply	other threads:[~2014-09-14 16:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-14  8:30 [PATCH] t1503: test rev-parse --verify --quiet with deleted reflogs David Aguilar
2014-09-14 16:20 ` Fabian Ruch [this message]
2014-09-14 18:54   ` David Aguilar
2014-09-15 18:17     ` Junio C Hamano
2014-09-15 18:25     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5415C069.9000702@gmail.com \
    --to=bafain@gmail.com \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).