Merge branch 'js/branch-symref'
authorJunio C Hamano <gitster@pobox.com>
Thu, 5 Mar 2009 23:41:35 +0000 (15:41 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Mar 2009 23:41:35 +0000 (15:41 -0800)
* js/branch-symref:
  add basic branch display tests
  branch: clean up repeated strlen
  Avoid segfault with 'git branch' when the HEAD is detached
  builtin-branch: improve output when displaying remote branches

Conflicts:
builtin-branch.c

1  2 
builtin-branch.c

index 60f70acd144f95c9502f5d8c370fea20d1d6b010,b15d3517f338477e6a7014cf4373914e2c962d64..14d4b917e5bb929f40efd3fc5e010cec5d3507de
@@@ -323,10 -350,21 +357,21 @@@ static void print_ref_item(struct ref_i
        c = ' ';
        if (current) {
                c = '*';
 -              color = COLOR_BRANCH_CURRENT;
 +              color = BRANCH_COLOR_CURRENT;
        }
  
-       if (verbose) {
+       strbuf_addf(&name, "%s%s", prefix, item->name);
+       if (verbose)
+               strbuf_addf(&out, "%c %s%-*s%s", c, branch_get_color(color),
+                           maxwidth, name.buf,
 -                          branch_get_color(COLOR_BRANCH_RESET));
++                          branch_get_color(BRANCH_COLOR_RESET));
+       else
+               strbuf_addf(&out, "%c %s%s%s", c, branch_get_color(color),
 -                          name.buf, branch_get_color(COLOR_BRANCH_RESET));
++                          name.buf, branch_get_color(BRANCH_COLOR_RESET));
+       if (item->dest)
+               strbuf_addf(&out, " -> %s", item->dest);
+       else if (verbose) {
                struct strbuf subject = STRBUF_INIT, stat = STRBUF_INIT;
                const char *sub = " **** invalid ref ****";