[PATCH] Fix describe --tags --long so it does not segfault
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Jul 3, 2008, 02:32 UTC
- Message-ID
- <20080703023245.GA31579@spearce.org>
- 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