diff mbox series

[17/18] t4202: mark bogus head hash test with REFFILES

Message ID a2cce772d44f5939475a1dfddc1a55ab9bbb8ac5.1618829584.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series Prepare tests for reftable backend | expand

Commit Message

Han-Wen Nienhuys April 19, 2021, 10:53 a.m. UTC
From: Han-Wen Nienhuys <hanwen@google.com>

In reftable, hashes are correctly formed by design

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
 t/t4202-log.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ævar Arnfjörð Bjarmason April 21, 2021, 7:08 a.m. UTC | #1
On Mon, Apr 19 2021, Han-Wen Nienhuys via GitGitGadget wrote:

> From: Han-Wen Nienhuys <hanwen@google.com>
>
> In reftable, hashes are correctly formed by design

With the file backend this hits this in revision.c:

        if (!refname || !(flags & REF_ISSYMREF) || (flags & REF_ISBROKEN))
                die(_("your current branch appears to be broken"));

There's a REF_ISBROKEN is the reftable code, so is hitting this codepath
impossible under reftable and therefore we won't need this test at all?

Maybe, and that would be cool, but re [1]'s 3rd item ("[...]what we
*don't* cover[...]") shouldn't revision.c have a "if (reftable) BUG()"
condition there then?

1. https://lore.kernel.org/git/87wnt2th1v.fsf@evledraar.gmail.com/

> Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
> ---
>  t/t4202-log.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/t/t4202-log.sh b/t/t4202-log.sh
> index c575deaad4fb..ed6d4ecd3a28 100755
> --- a/t/t4202-log.sh
> +++ b/t/t4202-log.sh
> @@ -1834,7 +1834,7 @@ test_expect_success 'log --graph --no-walk is forbidden' '
>  	test_must_fail git log --graph --no-walk
>  '
>  
> -test_expect_success 'log diagnoses bogus HEAD hash' '
> +test_expect_success REFFILES 'log diagnoses bogus HEAD hash' '
>  	git init empty &&
>  	test_must_fail git -C empty log 2>stderr &&
>  	test_i18ngrep does.not.have.any.commits stderr &&
Han-Wen Nienhuys April 26, 2021, 6:02 p.m. UTC | #2
On Wed, Apr 21, 2021 at 9:08 AM Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:
> > In reftable, hashes are correctly formed by design
>
> With the file backend this hits this in revision.c:
>
>         if (!refname || !(flags & REF_ISSYMREF) || (flags & REF_ISBROKEN))
>                 die(_("your current branch appears to be broken"));
>
> There's a REF_ISBROKEN is the reftable code, so is hitting this codepath
> impossible under reftable and therefore we won't need this test at all?

I've removed the REF_ISBROKEN bit. It would only trigger in case of
unknown record_types, and I made it a BUG instead.
diff mbox series

Patch

diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index c575deaad4fb..ed6d4ecd3a28 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -1834,7 +1834,7 @@  test_expect_success 'log --graph --no-walk is forbidden' '
 	test_must_fail git log --graph --no-walk
 '
 
-test_expect_success 'log diagnoses bogus HEAD hash' '
+test_expect_success REFFILES 'log diagnoses bogus HEAD hash' '
 	git init empty &&
 	test_must_fail git -C empty log 2>stderr &&
 	test_i18ngrep does.not.have.any.commits stderr &&