Re: [RFC PATCH] fast-export, fast-import: Let tags specify an internal name
- From
Luke Shumaker <lukeshu@lukeshu.com>
- Date
- Apr 21, 2021, 17:26 UTC
- Message-ID
- <87im4f35xi.wl-lukeshu@lukeshu.com>
- In-Reply-To
- <87k0ov38bv.wl-lukeshu@lukeshu.com>
On Wed, 21 Apr 2021 10:34:28 -0600, Luke Shumaker wrote:
Show 17 quoted lines
> On Wed, 21 Apr 2021 02:03:57 -0600,
> Ævar Arnfjörð Bjarmason wrote:
> > On Tue, Apr 20 2021, Luke Shumaker wrote:
> > > + tagname = memmem(buf, message ? message - buf : size, "\ntag ", 5);
> > > + if (!tagname)
> > > + die("malformed tag %s", oid_to_hex(&tag->object.oid));
> > > + tagname += 5;
> > > + tagname_end = strchrnul(tagname, '\n');
> >
> > So it's no longer possible to export a reporitory with a missing "tag"
> > entry in a tag? Maybe OK, but we have an escape hatch for it with fsck,
> > we don't need one here?
> >
> > In any case a test for it would be good to have.
>
> I hadn't realized that it was possible for a tag object to be missing
> the "tag" entry, I will fix that.Actually, can you expand on that? I don't see the escape hatch you speak of.
`git hash-object` doesn't want to even create such an object ("fatal: corrupt tag"), and I had to pass `--literally` to even create the object.
`git update-ref` doesn't want to even acknowledge the object to create the ref pointing to it ("fatal: cannot update ref 'refs/tags/badtag': trying to write ref 'refs/tags/badtag' with nonexistent object HASH"), and I had to `echo HASH > .git/refs/tags/badtag` to create the ref.
And then `git fsck` (even with `--no-tags`) complains about the object ("error: HASH: object could not be parsed: .git/objects/HA/SH").
It is my reading of the code that `parse_tag_buffer` will always fail to parse such an object, and so `fsck_walk_tag` and `fsck_walk` will always bubble up an error.
-- Happy hacking, ~ Luke Shumaker