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_TMPso 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-tDid 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.