Skip to content

Commit

Permalink
describe: fix --long output
Browse files Browse the repository at this point in the history
An error while hand-merging broke the new "--long" option.

This should fix it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Mar 3, 2008
1 parent c374b91 commit 870cf7d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions builtin-describe.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,11 @@ static void display_name(struct commit_name *n)
printf("%s", n->tag->tag);
else
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)
Expand All @@ -195,7 +197,12 @@ static void describe(const char *arg, int last_one)

n = cmit->util;
if (n) {
/*
* Exact match to an existing ref.
*/
display_name(n);
if (longformat)
show_suffix(0, n->tag->tagged->sha1);
printf("\n");
return;
}
Expand Down Expand Up @@ -281,8 +288,7 @@ static void describe(const char *arg, int last_one)

display_name(all_matches[0].name);
if (abbrev)
printf("-%d-g%s", all_matches[0].depth,
find_unique_abbrev(cmit->object.sha1, abbrev));
show_suffix(all_matches[0].depth, cmit->object.sha1);
printf("\n");

if (!last_one)
Expand Down

0 comments on commit 870cf7d

Please sign in to comment.