From: Junio C Hamano Date: Thu, 15 Feb 2018 23:18:10 +0000 (-0800) Subject: Merge branch 'dk/describe-all-output-fix' into maint X-Git-Tag: v2.16.2~9 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/468dc22e0085db29994b4296ca0127f27a686fa0 Merge branch 'dk/describe-all-output-fix' into maint An old regression in "git describe --all $annotated_tag^0" has been fixed. * dk/describe-all-output-fix: describe: prepend "tags/" when describing tags with embedded name --- 468dc22e0085db29994b4296ca0127f27a686fa0 diff --cc builtin/describe.c index 3b0b204b1e,2004a1a86e..6fe1c51281 --- a/builtin/describe.c +++ b/builtin/describe.c @@@ -274,19 -271,23 +274,22 @@@ static void append_name(struct commit_n n->name_checked = 1; } - if (n->tag) + if (n->tag) { + if (all) - printf("tags/"); - printf("%s", n->tag->tag); ++ strbuf_addstr(dst, "tags/"); + strbuf_addstr(dst, n->tag->tag); - else + } else { - printf("%s", n->path); + strbuf_addstr(dst, n->path); + } } -static void show_suffix(int depth, const struct object_id *oid) +static void append_suffix(int depth, const struct object_id *oid, struct strbuf *dst) { - printf("-%d-g%s", depth, find_unique_abbrev(oid->hash, abbrev)); + strbuf_addf(dst, "-%d-g%s", depth, find_unique_abbrev(oid->hash, abbrev)); } -static void describe(const char *arg, int last_one) +static void describe_commit(struct object_id *oid, struct strbuf *dst) { - struct object_id oid; struct commit *cmit, *gave_up_on = NULL; struct commit_list *list; struct commit_name *n;