diff mbox series

t1512: test ambiguous cat-file --batch and --batch-output

Message ID 20190118222629.3nvcos24gmi6xe4i@dcvr (mailing list archive)
State New, archived
Headers show
Series t1512: test ambiguous cat-file --batch and --batch-output | expand

Commit Message

Eric Wong Jan. 18, 2019, 10:26 p.m. UTC
David Turner <novalis@novalis.org> wrote:
> Let's try this version.

Thanks!

Tested-by: Eric Wong <e@80x24.org>

Not sure if t1512 would be the best place to put the test, but
having a repo with ambiguous data already at hand was easiest.

---------8<-------
Subject: [PATCH] t1512: test ambiguous cat-file --batch and --batch-output

Test the new "ambiguous" result from cat-file --batch and
--batch-check.  This is in t1512 instead of t1006 since
we need a repo with ambiguous object_id names.

Signed-off-by: Eric Wong <e@80x24.org>
---
 t/t1512-rev-parse-disambiguation.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

David Turner Jan. 18, 2019, 10:29 p.m. UTC | #1
Thanks for adding the test. 

On Fri, 2019-01-18 at 22:26 +0000, Eric Wong wrote:
> David Turner <novalis@novalis.org> wrote:
> > Let's try this version.
> 
> Thanks!
> 
> Tested-by: Eric Wong <e@80x24.org>
> 
> Not sure if t1512 would be the best place to put the test, but
> having a repo with ambiguous data already at hand was easiest.
> 
> ---------8<-------
> Subject: [PATCH] t1512: test ambiguous cat-file --batch and --batch-
> output
> 
> Test the new "ambiguous" result from cat-file --batch and
> --batch-check.  This is in t1512 instead of t1006 since
> we need a repo with ambiguous object_id names.
> 
> Signed-off-by: Eric Wong <e@80x24.org>
> ---
>  t/t1512-rev-parse-disambiguation.sh | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/t/t1512-rev-parse-disambiguation.sh b/t/t1512-rev-parse-
> disambiguation.sh
> index e4d5b56014..b0819630c9 100755
> --- a/t/t1512-rev-parse-disambiguation.sh
> +++ b/t/t1512-rev-parse-disambiguation.sh
> @@ -388,4 +388,14 @@ test_expect_success C_LOCALE_OUTPUT 'ambiguous
> commits are printed by type first
>  	done
>  '
>  
> +test_expect_success 'cat-file --batch and --batch-check show
> ambiguous' '
> +	echo "0000 ambiguous" >expect &&
> +	echo 0000 | git cat-file --batch-check >actual 2>err &&
> +	test_cmp expect actual &&
> +	grep hint: err &&
> +	echo 0000 | git cat-file --batch >actual 2>err &&
> +	test_cmp expect actual &&
> +	grep hint: err
> +'
> +
>  test_done
SZEDER Gábor Jan. 23, 2019, 11:11 a.m. UTC | #2
On Fri, Jan 18, 2019 at 10:26:29PM +0000, Eric Wong wrote:
> Test the new "ambiguous" result from cat-file --batch and
> --batch-check.  This is in t1512 instead of t1006 since
> we need a repo with ambiguous object_id names.
> 
> Signed-off-by: Eric Wong <e@80x24.org>
> ---
>  t/t1512-rev-parse-disambiguation.sh | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/t/t1512-rev-parse-disambiguation.sh b/t/t1512-rev-parse-disambiguation.sh
> index e4d5b56014..b0819630c9 100755
> --- a/t/t1512-rev-parse-disambiguation.sh
> +++ b/t/t1512-rev-parse-disambiguation.sh
> @@ -388,4 +388,14 @@ test_expect_success C_LOCALE_OUTPUT 'ambiguous commits are printed by type first
>  	done
>  '
>  
> +test_expect_success 'cat-file --batch and --batch-check show ambiguous' '
> +	echo "0000 ambiguous" >expect &&
> +	echo 0000 | git cat-file --batch-check >actual 2>err &&
> +	test_cmp expect actual &&
> +	grep hint: err &&
> +	echo 0000 | git cat-file --batch >actual 2>err &&
> +	test_cmp expect actual &&
> +	grep hint: err

The 'git cat-file's error message and hints are translated, so they
should be checked by 'test_i18ngrep' instead of plain old grep.

> +'
> +
>  test_done
> -- 
> EW
diff mbox series

Patch

diff --git a/t/t1512-rev-parse-disambiguation.sh b/t/t1512-rev-parse-disambiguation.sh
index e4d5b56014..b0819630c9 100755
--- a/t/t1512-rev-parse-disambiguation.sh
+++ b/t/t1512-rev-parse-disambiguation.sh
@@ -388,4 +388,14 @@  test_expect_success C_LOCALE_OUTPUT 'ambiguous commits are printed by type first
 	done
 '
 
+test_expect_success 'cat-file --batch and --batch-check show ambiguous' '
+	echo "0000 ambiguous" >expect &&
+	echo 0000 | git cat-file --batch-check >actual 2>err &&
+	test_cmp expect actual &&
+	grep hint: err &&
+	echo 0000 | git cat-file --batch >actual 2>err &&
+	test_cmp expect actual &&
+	grep hint: err
+'
+
 test_done