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

Re: [PATCH] fsck: do not crash on tag objects which do not contain an empty line

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 8, 2007, 05:17 UTC
Message-ID
<7vmyzbm3cx.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.64.0706072338260.4046@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 9 quoted lines
> The first empty line in a tag object separates the header from the
> message. If the tag object has no empty line, do not crash, but
> complain loudly instead.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>
> 	I have no idea how this tag crept into one of my repos, but it is 
> 	no good to crash for git-fsck.

Absolutely. git-fsck is to find suspicious data and should not crash on them.

Thanks.
But it _does_ make me wonder how.  Recent git-tag does this
    ( printf 'object %s\ntype %s\ntag %s\ntagger %s\n\n' \
	"$object" "$type" "$name" "$tagger";
      cat "$GIT_DIR"/TAG_FINALMSG ) >"$GIT_DIR"/TAG_TMP

so even if TAG_FINALMSG (which is -m or edited message after filtering out the comments and git-stripspace) is empty, you would have the two LFs at the end of the header. Ancient "git-tag-script" did this, which is a moral equivalent with echo and has the same effect:

  ( echo -e "object $object\ntype $type\ntag $name\ntagger $tagger\n";
    cat .tagmsg ) > .tmp-t

Did this tag come from cvsimport (or svnimport) perhaps? We are in the process of updating its use of git-mktag to git-tag, but they use git-mktag and do not leave a blank line after the header (and they do not add any body).

I notice that gitk creates lightweight tag by hand (it directly goes to the filesystem) It should probably use git-tag as well.

I agree with you that if something does not have body, we should not require an empty trailing line after the header.

Previous: Johan HerlandNext: Johannes Schindelin
Message 8 of 10 in “fsck: do not crash on tag objects which do not contain an empty line”
  1. fsck: do not crash on tag objects which do not contain an empty lineJohannes Schindelin, Jun 7, 2007
  2. Johan HerlandJun 7, 2007
  3. Johannes SchindelinJun 7, 2007
  4. Johan HerlandJun 7, 2007
  5. Johannes SchindelinJun 7, 2007
  6. Nicolas PitreJun 8, 2007
  7. Johan HerlandJun 8, 2007
  8. Junio C HamanoJun 8, 2007
  9. Johannes SchindelinJun 8, 2007
  10. Andy ParkinsJun 8, 2007

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.