summaryrefslogtreecommitdiff
path: root/builtin/branch.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-07-12 15:23:09 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-07-12 15:23:09 -0700
commit55bdfa022f007b5666d923012296f04872a8f3d9 (patch)
tree3f4eb9c2a3ea2c1603517904d0a731d1e1375ee1 /builtin/branch.c
parentMerge branch 'ks/typofix-commit-c-comment' into maint (diff)
parentref-filter.c: drop return from void function (diff)
downloadtgif-55bdfa022f007b5666d923012296f04872a8f3d9.tar.xz
Merge branch 'kn/ref-filter-branch-list' into maint
The rewrite of "git branch --list" using for-each-ref's internals that happened in v2.13 regressed its handling of color.branch.local; this has been fixed. * kn/ref-filter-branch-list: ref-filter.c: drop return from void function branch: set remote color in ref-filter branch immediately branch: use BRANCH_COLOR_LOCAL in ref-filter format branch: only perform HEAD check for local branches
Diffstat (limited to 'builtin/branch.c')
-rw-r--r--builtin/branch.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/builtin/branch.c b/builtin/branch.c
index 48a513a84d..a3bd2262b3 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -334,8 +334,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 +361,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));
}