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

Re: [PATCH] t1503: test rev-parse --verify --quiet with deleted reflogs

From
Fabian Ruch <bafain@gmail.com>
Date
Sep 14, 2014, 16:20 UTC
Message-ID
<5415C069.9000702@gmail.com>
In-Reply-To
<1410683442-74523-1-git-send-email-davvid@gmail.com>
Hi David,
On 09/14/2014 10:30 AM, David Aguilar wrote:
Show 22 quoted lines
> 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.

Show 6 quoted lines
> +'
> +
>  test_expect_success 'no stdout output on error' '
>  	test -z "$(git rev-parse --verify)" &&
>  	test -z "$(git rev-parse --verify foo)" &&
> 
Kind regards,
   Fabian
Previous: David AguilarNext: David Aguilar
Message 2 of 5 in “t1503: test rev-parse --verify --quiet with deleted reflogs”
  1. t1503: test rev-parse --verify --quiet with deleted reflogsDavid Aguilar, Sep 14, 2014
  2. Fabian RuchSep 14, 2014
  3. David AguilarSep 14, 2014
  4. Junio C HamanoSep 15, 2014
  5. Junio C HamanoSep 15, 2014

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.