Merge branch 'jk/build-with-asan'
[gitweb.git] / builtin / branch.c
index 83fcda43dceec0255c6164eb42a35d3d89011efb..8a0595e11587aeac0f784400c43609404da3e045 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include "cache.h"
+#include "config.h"
 #include "color.h"
 #include "refs.h"
 #include "commit.h"
@@ -334,8 +335,11 @@ static char *build_format(struct ref_filter *filter, int maxwidth, const char *r
        struct strbuf local = STRBUF_INIT;
        struct strbuf remote = STRBUF_INIT;
 
-       strbuf_addf(&fmt, "%%(if)%%(HEAD)%%(then)* %s%%(else)  %%(end)",
-                   branch_get_color(BRANCH_COLOR_CURRENT));
+       strbuf_addf(&local, "%%(if)%%(HEAD)%%(then)* %s%%(else)  %s%%(end)",
+                   branch_get_color(BRANCH_COLOR_CURRENT),
+                   branch_get_color(BRANCH_COLOR_LOCAL));
+       strbuf_addf(&remote, "  %s",
+                   branch_get_color(BRANCH_COLOR_REMOTE));
 
        if (filter->verbose) {
                struct strbuf obname = STRBUF_INIT;
@@ -358,17 +362,17 @@ static char *build_format(struct ref_filter *filter, int maxwidth, const char *r
                else
                        strbuf_addf(&local, "%%(if)%%(upstream:track)%%(then)%%(upstream:track) %%(end)%%(contents:subject)");
 
-               strbuf_addf(&remote, "%s%%(align:%d,left)%s%%(refname:lstrip=2)%%(end)%s"
+               strbuf_addf(&remote, "%%(align:%d,left)%s%%(refname:lstrip=2)%%(end)%s"
                            "%%(if)%%(symref)%%(then) -> %%(symref:short)"
                            "%%(else) %s %%(contents:subject)%%(end)",
-                           branch_get_color(BRANCH_COLOR_REMOTE), maxwidth, quote_literal_for_format(remote_prefix),
+                           maxwidth, quote_literal_for_format(remote_prefix),
                            branch_get_color(BRANCH_COLOR_RESET), obname.buf);
                strbuf_release(&obname);
        } else {
                strbuf_addf(&local, "%%(refname:lstrip=2)%s%%(if)%%(symref)%%(then) -> %%(symref:short)%%(end)",
                            branch_get_color(BRANCH_COLOR_RESET));
-               strbuf_addf(&remote, "%s%s%%(refname:lstrip=2)%s%%(if)%%(symref)%%(then) -> %%(symref:short)%%(end)",
-                           branch_get_color(BRANCH_COLOR_REMOTE), quote_literal_for_format(remote_prefix),
+               strbuf_addf(&remote, "%s%%(refname:lstrip=2)%s%%(if)%%(symref)%%(then) -> %%(symref:short)%%(end)",
+                           quote_literal_for_format(remote_prefix),
                            branch_get_color(BRANCH_COLOR_RESET));
        }