1
0
mirror of https://github.com/git/git.git synced 2024-11-19 04:33:56 +01:00

describe: fix --long output

An error while hand-merging broke the new "--long" option.

This should fix it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano 2008-03-03 13:08:26 -08:00
parent c374b91cf2
commit 870cf7d698

@ -166,9 +166,11 @@ static void display_name(struct commit_name *n)
printf("%s", n->tag->tag); printf("%s", n->tag->tag);
else else
printf("%s", n->path); printf("%s", n->path);
if (longformat) }
printf("-0-g%s",
find_unique_abbrev(n->tag->tagged->sha1, abbrev)); static void show_suffix(int depth, const unsigned char *sha1)
{
printf("-%d-g%s", depth, find_unique_abbrev(sha1, abbrev));
} }
static void describe(const char *arg, int last_one) static void describe(const char *arg, int last_one)
@ -195,7 +197,12 @@ static void describe(const char *arg, int last_one)
n = cmit->util; n = cmit->util;
if (n) { if (n) {
/*
* Exact match to an existing ref.
*/
display_name(n); display_name(n);
if (longformat)
show_suffix(0, n->tag->tagged->sha1);
printf("\n"); printf("\n");
return; return;
} }
@ -281,8 +288,7 @@ static void describe(const char *arg, int last_one)
display_name(all_matches[0].name); display_name(all_matches[0].name);
if (abbrev) if (abbrev)
printf("-%d-g%s", all_matches[0].depth, show_suffix(all_matches[0].depth, cmit->object.sha1);
find_unique_abbrev(cmit->object.sha1, abbrev));
printf("\n"); printf("\n");
if (!last_one) if (!last_one)