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

Re: [PATCH] parse_tag: fail, if tagged objected would be NULL

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 16, 2008, 19:13 UTC
Message-ID
<7vpruw90jv.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<12031670802582-git-send-email-mkoegler@auto.tuwien.ac.at>
Martin Koegler <mkoegler@auto.tuwien.ac.at> writes:
Show 8 quoted lines
> The cause of a NULL in tag->tagged can be:
> * a unknown object type is used
> * the tag points to a object with an other type as stated
>   in the tag.
>
> Both situations are most likley be caused by a not welformed
> tag. Catching this error here avoids doing tag->tagged!=NULL
> checks in the rest of git.
Honestly, I am torn on this.

The approach certainly is attractive if you care only about working in a perfectly well connected repository of a known vintage.

On the other hand, however, this robs from callers the clue that the tag itself was Ok but it points at something we do not know about. Maybe the caller was only interested in the tag itself but did not care about the pointee, and erroring out like this may make it impossible for the caller to act on the tag itself. Maybe the caller even knew about the breakage of the repository and wanted to salvage as much as possible, but because this errors out, it would now consider this tag object itself is bad and give up, salvaging one less object. It looks to me that this, along with other "tighten parse_X_buffer()" changes you sent earlier, closes door to them. That's why I think that parse_X_buffer() should be more lenient than fsck and keep saying it.

Previous: Martin KoeglerNext: Martin Koegler
Message 2 of 3 in “parse_tag: fail, if tagged objected would be NULL”
  1. parse_tag: fail, if tagged objected would be NULLMartin Koegler, Feb 16, 2008
  2. Junio C HamanoFeb 16, 2008
  3. Martin KoeglerFeb 17, 2008

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.