All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Mikael Magnusson <mikachu@gmail.com>,
	Mark Burton <markb@ordern.com>
Subject: [PATCH] Fix describe --tags --long so it does not segfault
Date: Thu, 3 Jul 2008 02:32:45 +0000	[thread overview]
Message-ID: <20080703023245.GA31579@spearce.org> (raw)
In-Reply-To: <237967ef0807021256j3e67bceaoecbb8f37112db2ab@mail.gmail.com>

If we match a lightweight (non-annotated tag) as the name to
output and --long was requested we do not have a tag, nor do
we have a tagged object to display.  Instead we must use the
object we were passed as input for the long format display.

Reported-by: Mark Burton <markb@ordern.com>
Backtraced-by: Mikael Magnusson <mikachu@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---

 Thanks Mikael, the backtrace really made it easy to figure out
 what the breakage was here.

 builtin-describe.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin-describe.c b/builtin-describe.c
index 3da99c1..e515f9c 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c
@@ -204,7 +204,7 @@ static void describe(const char *arg, int last_one)
 		 */
 		display_name(n);
 		if (longformat)
-			show_suffix(0, n->tag->tagged->sha1);
+			show_suffix(0, n->tag ? n->tag->tagged->sha1 : sha1);
 		printf("\n");
 		return;
 	}
-- 
1.5.6.74.g8a5e

  reply	other threads:[~2008-07-03  7:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-02 14:45 git describe --tags --long barfs on new tags? Mark Burton
2008-07-02 19:56 ` Mikael Magnusson
2008-07-03  2:32   ` Shawn O. Pearce [this message]
2008-07-03  4:23     ` [PATCH] Fix describe --tags --long so it does not segfault Junio C Hamano
2008-07-03  2:49   ` git describe --tags --long barfs on new tags? Abhijit Menon-Sen

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=20080703023245.GA31579@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=markb@ordern.com \
    --cc=mikachu@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.