summaryrefslogtreecommitdiff
path: root/builtin/describe.c
diff options
context:
space:
mode:
authorDaniel Knittl-Frank <knittl89+git@googlemail.com>2017-12-11 17:24:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-12-27 18:23:11 (GMT)
commit1bba00130a1a0332ec0ad2f878a09ca9b2b18ee2 (patch)
tree93b326475fb56bc80fe4954a10150f53bb4b4f3c /builtin/describe.c
parent3013dff8662eae06457fe6e5348dfe2270810ab2 (diff)
downloadgit-1bba00130a1a0332ec0ad2f878a09ca9b2b18ee2.zip
git-1bba00130a1a0332ec0ad2f878a09ca9b2b18ee2.tar.gz
git-1bba00130a1a0332ec0ad2f878a09ca9b2b18ee2.tar.bz2
describe: prepend "tags/" when describing tags with embedded name
The man page of the "git describe" command explains the expected output when using the --all option, i.e. the full reference path is shown, including heads/ or tags/ prefix. When 212945d4a85dfa172ea55ec73b1d830ef2d8582f ("Teach git-describe to verify annotated tag names before output") made Git favor the embedded name of annotated tags, it accidentally changed the output format when the --all flag is given, only printing the tag's name without the prefix. Check if --all was specified and re-add the "tags/" prefix for this special case to fix the regresssion. Signed-off-by: Daniel Knittl-Frank <knittl89+git@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/describe.c')
-rw-r--r--builtin/describe.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/builtin/describe.c b/builtin/describe.c
index 29075db..2004a1a 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -271,10 +271,13 @@ static void display_name(struct commit_name *n)
n->name_checked = 1;
}
- if (n->tag)
+ if (n->tag) {
+ if (all)
+ printf("tags/");
printf("%s", n->tag->tag);
- else
+ } else {
printf("%s", n->path);
+ }
}
static void show_suffix(int depth, const struct object_id *oid)