summaryrefslogtreecommitdiff
path: root/builtin-describe.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-03-03 13:08:26 -0800
committerJunio C Hamano <gitster@pobox.com>2008-03-03 13:09:20 -0800
commit870cf7d69872ebc925989b400fb4e7031870db5f (patch)
treece58d3de96acb71072f7a37e0a042f1148423c6f /builtin-describe.c
parentc374b91cf295f437d438a103bfd2cf3fffcce580 (diff)
downloadgit-870cf7d69872ebc925989b400fb4e7031870db5f.tar.gz
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>
Diffstat (limited to 'builtin-describe.c')
-rw-r--r--builtin-describe.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/builtin-describe.c b/builtin-describe.c
index c549d362b2..43be671827 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c
@@ -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)
@@ -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;
}
@@ -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)