branch: use BRANCH_COLOR_LOCAL in ref-filter format
authorJeff King <peff@peff.net>
Sun, 9 Jul 2017 09:59:33 +0000 (05:59 -0400)
committerJunio C Hamano <gitster@pobox.com>
Sun, 9 Jul 2017 16:24:42 +0000 (09:24 -0700)
commit34d820ee336598d93f1fa619f517811ee0ef503d
tree96cb741c3d5ae524696dcbfec8aeaa45bb4dfded
parenta5b3663898d6e45a5d109ce89c516adc2fd4ded2
branch: use BRANCH_COLOR_LOCAL in ref-filter format

Since 949af0684 (branch: use ref-filter printing APIs,
2017-01-10), git-branch's output is generated by passing a
custom format to the ref-filter code. This format forgot to
pass BRANCH_COLOR_LOCAL, meaning that local branches
(besides the current one) were never colored at all.

We can add it in the %(if) block where we decide whether the
branch is "current" or merely "local".  Note that this means
the current/local coloring is either/or. You can't set:

  [color "branch"]
  local = blue
  current = bold

and expect the current branch to be "bold blue". This
matches the pre-949af0684 behavior.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/branch.c
t/t3205-branch-color.sh [new file with mode: 0755]