git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] branch: don't assume the merge filter ref exists

From
Jeff King <peff@peff.net>
Date
Feb 27, 2012, 19:43 UTC
Message-ID
<20120227194305.GE1600@sigill.intra.peff.net>
In-Reply-To
<7vk4386pgi.fsf@alter.siamese.dyndns.org>
On Mon, Feb 27, 2012 at 11:33:49AM -0800, Junio C Hamano wrote:
Show 12 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > You would also get NULL if the object exists but is not a commit. Maybe:
> >
> >   die("object '%s' does not point to a commit", ...)
> >
> > would be better? It covers the wrong-type case, and is still technically
> > true when the object does not exist.
> 
> For this particular message I like the above a lot better.  The output
> from "git grep -e 'invalid object' -e 'bad object'" seems to show that
> the use of both are fairly evenly distributed.

It looks like "bad object" generally comes from parse_object failing, which makes sense. It either means object corruption or you fed a full 40-char sha1 that didn't exist (which, if you are being that specific, probably is an indication of broken-ness in your repository).

It looks like "invalid object" comes from failing to access the subject of an annotated tag or an entry in a tree, both of which would meet the same criteria (corruption or a missing 40-char sha1).

I don't think bad versus invalid in existing cases is a big deal, as they are both used consistently. But in this case, I think either would be wrong, since it is equally likely that the user gave an existing, OK object of the wrong type.

-Peff
Previous: Junio C HamanoNext: Carlos Martín Nieto
Message 6 of 8 in “[BUG] git branch --merged $unknown_checksum segfaults”
  1. Bernhard Reutner-FischerFeb 27, 2012
  2. branch: don't assume the merge filter ref existsCarlos Martín Nieto, Feb 27, 2012
  3. Junio C HamanoFeb 27, 2012
  4. Jeff KingFeb 27, 2012
  5. Junio C HamanoFeb 27, 2012
  6. Jeff KingFeb 27, 2012
  7. Carlos Martín NietoFeb 28, 2012
  8. Junio C HamanoFeb 28, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.