Re: [PATCH v2 10/10] tag: don't misreport type of tagged objects in errors
- From
Jeff King <peff@peff.net>
- Date
- Mar 31, 2021, 19:00 UTC
- Message-ID
- <YGTGt+xGM9FN/ewm@coredump.intra.peff.net>
- In-Reply-To
- <xmqqv9976u9d.fsf@gitster.g>
On Wed, Mar 31, 2021 at 11:41:18AM -0700, Junio C Hamano wrote:
Show 18 quoted lines
> Jeff King <peff@peff.net> writes:
>
> > + if (flags & OBJECT_AS_TYPE_EXPECT_PARSED)
> > + error(_("object %s is a %s, but was referred to as a %s"),
> > + oid_to_hex(&obj->oid), type_name(obj->type),
> > + type_name(type));
> > + else
> > + error(_("object %s referred to as both a %s and a %s"),
> > + oid_to_hex(&obj->oid),
> > + type_name(obj->type), type_name(type));
> > + }
>
> Am I correct to understand that the latter is after we read a tree
> that refers to an object with 100644 (blob) and then another tree
> that refers to the same object with 40000 (tree), before we have a
> need/chance to actually find out what that object is? The error
> would trigger while reading the second tree and find the second
> mention of the object that conflicts with the earlier one?Yes, exactly (or two tags, or a tag and a tree, or a commit and a tree, etc).
-Peff