All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/3] t1503: test rev-parse --verify --quiet with deleted reflogs
@ 2014-09-15 19:07 David Aguilar
  2014-09-15 19:07 ` [PATCH v3 2/3] t1503: use test_must_be_empty David Aguilar
  2014-09-15 22:32 ` [PATCH v3 1/3] t1503: test rev-parse --verify --quiet with deleted reflogs Junio C Hamano
  0 siblings, 2 replies; 7+ messages in thread
From: David Aguilar @ 2014-09-15 19:07 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Fabian Ruch

Ensure that rev-parse --verify --quiet is silent when asked
about deleted reflog entries.

Helped-by: Fabian Ruch <bafain@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
Differences since last time:

This goes back to the original approach of using "git update-ref"
plumbing instead of "git branch" when testing deleted reflogs.

 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..fd9d0c3 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 "reflog message for refs/test" refs/test "$ref" &&
+	git reflog delete --updateref --rewrite refs/test@{0} &&
+	test_must_fail git rev-parse -q --verify refs/test@{0} >error 2>&1 &&
+	test -z "$(cat error)"
+'
+
 test_expect_success 'no stdout output on error' '
 	test -z "$(git rev-parse --verify)" &&
 	test -z "$(git rev-parse --verify foo)" &&
-- 
2.1.0.30.g05c535b.dirty

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

* [PATCH v3 2/3] t1503: use test_must_be_empty
  2014-09-15 19:07 [PATCH v3 1/3] t1503: test rev-parse --verify --quiet with deleted reflogs David Aguilar
@ 2014-09-15 19:07 ` David Aguilar
  2014-09-15 19:07   ` [PATCH v3 3/3] Documentation: a note about stdout for git rev-parse --verify --quiet David Aguilar
  2014-09-15 22:33   ` [PATCH v3 2/3] t1503: use test_must_be_empty Junio C Hamano
  2014-09-15 22:32 ` [PATCH v3 1/3] t1503: test rev-parse --verify --quiet with deleted reflogs Junio C Hamano
  1 sibling, 2 replies; 7+ messages in thread
From: David Aguilar @ 2014-09-15 19:07 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Fabian Ruch

Use `test_must_be_be_empty <file>` instead of `test -z "$(cat <file>)"`.

Suggested-by: Fabian Ruch <bafain@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
Unchanged since last time, but rebased for the change in the
previous patch.

 t/t1503-rev-parse-verify.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/t/t1503-rev-parse-verify.sh b/t/t1503-rev-parse-verify.sh
index fd9d0c3..4fe9f0e 100755
--- a/t/t1503-rev-parse-verify.sh
+++ b/t/t1503-rev-parse-verify.sh
@@ -72,15 +72,15 @@ test_expect_success 'fails with any bad rev or many good revs' '
 
 test_expect_success 'fails silently when using -q' '
 	test_must_fail git rev-parse --verify --quiet 2>error &&
-	test -z "$(cat error)" &&
+	test_must_be_empty error &&
 	test_must_fail git rev-parse -q --verify foo 2>error &&
-	test -z "$(cat error)" &&
+	test_must_be_empty error &&
 	test_must_fail git rev-parse --verify -q HEAD bar 2>error &&
-	test -z "$(cat error)" &&
+	test_must_be_empty error &&
 	test_must_fail git rev-parse --quiet --verify baz HEAD 2>error &&
-	test -z "$(cat error)" &&
+	test_must_be_empty error &&
 	test_must_fail git rev-parse -q --verify $HASH2 HEAD 2>error &&
-	test -z "$(cat error)"
+	test_must_be_empty error
 '
 
 test_expect_success 'fails silently when using -q with deleted reflogs' '
@@ -89,7 +89,7 @@ test_expect_success 'fails silently when using -q with deleted reflogs' '
 	git update-ref -m "reflog message for refs/test" refs/test "$ref" &&
 	git reflog delete --updateref --rewrite refs/test@{0} &&
 	test_must_fail git rev-parse -q --verify refs/test@{0} >error 2>&1 &&
-	test -z "$(cat error)"
+	test_must_be_empty error
 '
 
 test_expect_success 'no stdout output on error' '
-- 
2.1.0.30.g05c535b.dirty

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

* [PATCH v3 3/3] Documentation: a note about stdout for git rev-parse --verify --quiet
  2014-09-15 19:07 ` [PATCH v3 2/3] t1503: use test_must_be_empty David Aguilar
@ 2014-09-15 19:07   ` David Aguilar
  2014-09-15 22:34     ` Junio C Hamano
  2014-09-15 22:33   ` [PATCH v3 2/3] t1503: use test_must_be_empty Junio C Hamano
  1 sibling, 1 reply; 7+ messages in thread
From: David Aguilar @ 2014-09-15 19:07 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Fabian Ruch

Signed-off-by: David Aguilar <davvid@gmail.com>
---
This patch is new: we now mention that stdout contains the valid object name
when --quiet is used, which may not be clear when reading this paragraph in
isolation.

 Documentation/git-rev-parse.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt
index 0b84769..fa4a8c3 100644
--- a/Documentation/git-rev-parse.txt
+++ b/Documentation/git-rev-parse.txt
@@ -114,6 +114,7 @@ can be used.
 	Only meaningful in `--verify` mode. Do not output an error
 	message if the first argument is not a valid object name;
 	instead exit with non-zero status silently.
+	SHA-1s for valid object names are printed to stdout on success.
 
 --sq::
 	Usually the output is made one line per flag and
-- 
2.1.0.30.g05c535b.dirty

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

* Re: [PATCH v3 1/3] t1503: test rev-parse --verify --quiet with deleted reflogs
  2014-09-15 19:07 [PATCH v3 1/3] t1503: test rev-parse --verify --quiet with deleted reflogs David Aguilar
  2014-09-15 19:07 ` [PATCH v3 2/3] t1503: use test_must_be_empty David Aguilar
@ 2014-09-15 22:32 ` Junio C Hamano
  2014-09-16  3:06   ` David Aguilar
  1 sibling, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2014-09-15 22:32 UTC (permalink / raw)
  To: David Aguilar; +Cc: git, Fabian Ruch

David Aguilar <davvid@gmail.com> writes:

> Ensure that rev-parse --verify --quiet is silent when asked
> about deleted reflog entries.
>
> Helped-by: Fabian Ruch <bafain@gmail.com>
> Signed-off-by: David Aguilar <davvid@gmail.com>
> ---
> Differences since last time:
>
> This goes back to the original approach of using "git update-ref"
> plumbing instead of "git branch" when testing deleted reflogs.

Is this 1/3 (the first one in the series) supposed to pass without
no other patches, either in the series or something outside?

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

* Re: [PATCH v3 2/3] t1503: use test_must_be_empty
  2014-09-15 19:07 ` [PATCH v3 2/3] t1503: use test_must_be_empty David Aguilar
  2014-09-15 19:07   ` [PATCH v3 3/3] Documentation: a note about stdout for git rev-parse --verify --quiet David Aguilar
@ 2014-09-15 22:33   ` Junio C Hamano
  1 sibling, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2014-09-15 22:33 UTC (permalink / raw)
  To: David Aguilar; +Cc: git, Fabian Ruch

David Aguilar <davvid@gmail.com> writes:

> Use `test_must_be_be_empty <file>` instead of `test -z "$(cat <file>)"`.
>
> Suggested-by: Fabian Ruch <bafain@gmail.com>
> Signed-off-by: David Aguilar <davvid@gmail.com>
> ---
> Unchanged since last time, but rebased for the change in the
> previous patch.

It probably makes more sense to have this at the beginning of a
series as preliminary clean-up.  That way, the more interesting
change does not have to have "test -z $(cat ...)" that makes readers
go "Huh?".



>
>  t/t1503-rev-parse-verify.sh | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/t/t1503-rev-parse-verify.sh b/t/t1503-rev-parse-verify.sh
> index fd9d0c3..4fe9f0e 100755
> --- a/t/t1503-rev-parse-verify.sh
> +++ b/t/t1503-rev-parse-verify.sh
> @@ -72,15 +72,15 @@ test_expect_success 'fails with any bad rev or many good revs' '
>  
>  test_expect_success 'fails silently when using -q' '
>  	test_must_fail git rev-parse --verify --quiet 2>error &&
> -	test -z "$(cat error)" &&
> +	test_must_be_empty error &&
>  	test_must_fail git rev-parse -q --verify foo 2>error &&
> -	test -z "$(cat error)" &&
> +	test_must_be_empty error &&
>  	test_must_fail git rev-parse --verify -q HEAD bar 2>error &&
> -	test -z "$(cat error)" &&
> +	test_must_be_empty error &&
>  	test_must_fail git rev-parse --quiet --verify baz HEAD 2>error &&
> -	test -z "$(cat error)" &&
> +	test_must_be_empty error &&
>  	test_must_fail git rev-parse -q --verify $HASH2 HEAD 2>error &&
> -	test -z "$(cat error)"
> +	test_must_be_empty error
>  '
>  
>  test_expect_success 'fails silently when using -q with deleted reflogs' '
> @@ -89,7 +89,7 @@ test_expect_success 'fails silently when using -q with deleted reflogs' '
>  	git update-ref -m "reflog message for refs/test" refs/test "$ref" &&
>  	git reflog delete --updateref --rewrite refs/test@{0} &&
>  	test_must_fail git rev-parse -q --verify refs/test@{0} >error 2>&1 &&
> -	test -z "$(cat error)"
> +	test_must_be_empty error
>  '
>  
>  test_expect_success 'no stdout output on error' '

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

* Re: [PATCH v3 3/3] Documentation: a note about stdout for git rev-parse --verify --quiet
  2014-09-15 19:07   ` [PATCH v3 3/3] Documentation: a note about stdout for git rev-parse --verify --quiet David Aguilar
@ 2014-09-15 22:34     ` Junio C Hamano
  0 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2014-09-15 22:34 UTC (permalink / raw)
  To: David Aguilar; +Cc: git, Fabian Ruch

David Aguilar <davvid@gmail.com> writes:

> Signed-off-by: David Aguilar <davvid@gmail.com>
> ---
> This patch is new: we now mention that stdout contains the valid object name
> when --quiet is used, which may not be clear when reading this paragraph in
> isolation.
>
>  Documentation/git-rev-parse.txt | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt
> index 0b84769..fa4a8c3 100644
> --- a/Documentation/git-rev-parse.txt
> +++ b/Documentation/git-rev-parse.txt
> @@ -114,6 +114,7 @@ can be used.
>  	Only meaningful in `--verify` mode. Do not output an error
>  	message if the first argument is not a valid object name;
>  	instead exit with non-zero status silently.
> +	SHA-1s for valid object names are printed to stdout on success.

OK.  Thanks.

>  
>  --sq::
>  	Usually the output is made one line per flag and

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

* Re: [PATCH v3 1/3] t1503: test rev-parse --verify --quiet with deleted reflogs
  2014-09-15 22:32 ` [PATCH v3 1/3] t1503: test rev-parse --verify --quiet with deleted reflogs Junio C Hamano
@ 2014-09-16  3:06   ` David Aguilar
  0 siblings, 0 replies; 7+ messages in thread
From: David Aguilar @ 2014-09-16  3:06 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Fabian Ruch

On Mon, Sep 15, 2014 at 03:32:37PM -0700, Junio C Hamano wrote:
> David Aguilar <davvid@gmail.com> writes:
> 
> > Ensure that rev-parse --verify --quiet is silent when asked
> > about deleted reflog entries.
> >
> > Helped-by: Fabian Ruch <bafain@gmail.com>
> > Signed-off-by: David Aguilar <davvid@gmail.com>
> > ---
> > Differences since last time:
> >
> > This goes back to the original approach of using "git update-ref"
> > plumbing instead of "git branch" when testing deleted reflogs.
> 
> Is this 1/3 (the first one in the series) supposed to pass without
> no other patches, either in the series or something outside?
> 

It depends on the patch I sent not too long ago that makes
rev-parse --quiet actually quiet.

I'll rework this series to do the test_must_be_empty cleanup
first and include the prerequisite patch when I re-roll shortly.
-- 
David

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

end of thread, other threads:[~2014-09-16  3:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-15 19:07 [PATCH v3 1/3] t1503: test rev-parse --verify --quiet with deleted reflogs David Aguilar
2014-09-15 19:07 ` [PATCH v3 2/3] t1503: use test_must_be_empty David Aguilar
2014-09-15 19:07   ` [PATCH v3 3/3] Documentation: a note about stdout for git rev-parse --verify --quiet David Aguilar
2014-09-15 22:34     ` Junio C Hamano
2014-09-15 22:33   ` [PATCH v3 2/3] t1503: use test_must_be_empty Junio C Hamano
2014-09-15 22:32 ` [PATCH v3 1/3] t1503: test rev-parse --verify --quiet with deleted reflogs Junio C Hamano
2014-09-16  3:06   ` David Aguilar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.