OSDN Git Service

Merge branch 'dk/describe-all-output-fix'
authorJunio C Hamano <gitster@pobox.com>
Tue, 23 Jan 2018 21:16:28 +0000 (13:16 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 23 Jan 2018 21:16:28 +0000 (13:16 -0800)
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

1  2 
builtin/describe.c
t/t6120-describe.sh

@@@ -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;
Simple merge