Subject: Re: [PATCH v2 6/6] Make sure that index-pack --strict fails upon invalid tag objects

From: Junio C Hamano <[email-masked]>
Date: Wed, 10 Sep 2014 14:54:12 -0700

Johannes Schindelin <[email-masked]> writes:

> +test_expect_success 'index-pack --strict fails upon invalid tag' '
> +    sha=$(git rev-parse HEAD) &&
> +    cat >wrong-tag <<EOF &&
> +object $sha
> +type commit
> +tag guten tag
> +
> +This is an invalid tag.
> +EOF

Missing tagger is merely a warning event (thanks for a good comment
in the code, by the way, to explain the reason why it is so is
because of annotated tags in earlier versions of Git).  tag names
that are not ref-formed is only a warning event in this reroll.

So this is not really "invalid" in the sense that index-pack can
notice it as an error, no?

> +
> +    tag=$(git hash-object -t tag -w --stdin <wrong-tag) &&
> +    pack1=$(echo $tag | git pack-objects tag-test) &&
> +    echo remove tag object &&
> +    thirtyeight=${tag#??} &&
> +    rm -f .git/objects/${tag%$thirtyeight}/$thirtyeight &&
> +    test_must_fail git index-pack --strict tag-test-${pack1}.pack 2> err &&

I had to drop "must fail" from this one (will amend the "SQUASH???"
again).

Perhaps you would want to add a real error, e.g. a tag with tagger
whose ident does not pass fsck-ident or something?

> +    grep "invalid .tag. name" err
> +'
> +
>  test_done