Merge branch 'rs/describe-unique-abbrev'
authorJunio C Hamano <gitster@pobox.com>
Tue, 13 Feb 2018 21:39:07 +0000 (13:39 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Feb 2018 21:39:07 +0000 (13:39 -0800)
Code clean-up.

* rs/describe-unique-abbrev:
describe: use strbuf_add_unique_abbrev() for adding short hashes

1  2 
builtin/describe.c
diff --combined builtin/describe.c
index 6fe1c51281bf1bb6a92f00d837fecf60fe38ca31,21e37f5daea600fb9c7c9225a7ef63d83aa56f9e..c4289847063ac02ed061f890ffd71cd329d67109
@@@ -274,13 -274,10 +274,13 @@@ static void append_name(struct commit_n
                n->name_checked = 1;
        }
  
 -      if (n->tag)
 +      if (n->tag) {
 +              if (all)
 +                      strbuf_addstr(dst, "tags/");
                strbuf_addstr(dst, n->tag->tag);
 -      else
 +      } else {
                strbuf_addstr(dst, n->path);
 +      }
  }
  
  static void append_suffix(int depth, const struct object_id *oid, struct strbuf *dst)
@@@ -383,7 -380,7 +383,7 @@@ static void describe_commit(struct obje
        if (!match_cnt) {
                struct object_id *cmit_oid = &cmit->object.oid;
                if (always) {
-                       strbuf_addstr(dst, find_unique_abbrev(cmit_oid->hash, abbrev));
+                       strbuf_add_unique_abbrev(dst, cmit_oid->hash, abbrev);
                        if (suffix)
                                strbuf_addstr(dst, suffix);
                        return;