git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: hanwen@xs4all.nl
Cc: git@vger.kernel.org
Subject: Re: git for-each-ref crashes for %(body) with tags
Date: Wed, 20 Aug 2008 12:12:53 -0700	[thread overview]
Message-ID: <7vhc9fqz4a.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <f329bf540808201128r2d21c40cr37eb63a6706ac0aa@mail.gmail.com> (Han-Wen Nienhuys's message of "Wed, 20 Aug 2008 15:28:41 -0300")

"Han-Wen Nienhuys" <hanwenn@gmail.com> writes:

> see gdb trace below.   Unfortunately, I don't have a repo that I can
> readily share to demonstrate this.

You have a tag that has a single incomplete line as its payload.  The
attached patch should fix it, but I wonder how you created such an unusual
(I would not say "broken") tag to begin with?


diff --git i/builtin-for-each-ref.c w/builtin-for-each-ref.c
index 445039e..4d25ec5 100644
--- i/builtin-for-each-ref.c
+++ w/builtin-for-each-ref.c
@@ -459,8 +459,10 @@ static void find_subpos(const char *buf, unsigned long sz, const char **sub, con
 		return;
 	*sub = buf; /* first non-empty line */
 	buf = strchr(buf, '\n');
-	if (!buf)
+	if (!buf) {
+		*body = "";
 		return; /* no body */
+	}
 	while (*buf == '\n')
 		buf++; /* skip blank between subject and body */
 	*body = buf;

  reply	other threads:[~2008-08-20 19:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-20 18:28 git for-each-ref crashes for %(body) with tags Han-Wen Nienhuys
2008-08-20 19:12 ` Junio C Hamano [this message]
2008-08-20 20:41   ` Han-Wen Nienhuys

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vhc9fqz4a.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=hanwen@xs4all.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).