diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-12-16 12:50:03 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-12-16 12:50:03 -0800 |
commit | f68b780b2575628eca75e9502e4997f98ad2af3b (patch) | |
tree | 885194f0e88689e63ad9aa154485f795f1dc0ba3 /wt-status.c | |
parent | b932c3c1c16844af9af2b71790caaca30546e99e (diff) | |
parent | 148135fc24dce1e61cfd7fcedea4210095099e78 (diff) | |
download | git-f68b780b2575628eca75e9502e4997f98ad2af3b.tar.gz |
Merge branch 'aa/status-hilite-branch'
* aa/status-hilite-branch:
default color.status.branch to "same as header"
status: show branchname with a configurable color
Diffstat (limited to 'wt-status.c')
-rw-r--r-- | wt-status.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/wt-status.c b/wt-status.c index 06ae161c67..123582b6cb 100644 --- a/wt-status.c +++ b/wt-status.c @@ -21,11 +21,15 @@ static char default_wt_status_colors[][COLOR_MAXLEN] = { GIT_COLOR_RED, /* WT_STATUS_UNMERGED */ GIT_COLOR_GREEN, /* WT_STATUS_LOCAL_BRANCH */ GIT_COLOR_RED, /* WT_STATUS_REMOTE_BRANCH */ + GIT_COLOR_NIL, /* WT_STATUS_ONBRANCH */ }; static const char *color(int slot, struct wt_status *s) { - return s->use_color > 0 ? s->color_palette[slot] : ""; + const char *c = s->use_color > 0 ? s->color_palette[slot] : ""; + if (slot == WT_STATUS_ONBRANCH && color_is_nil(c)) + c = s->color_palette[WT_STATUS_HEADER]; + return c; } void wt_status_prepare(struct wt_status *s) @@ -625,7 +629,8 @@ static void wt_status_print_tracking(struct wt_status *s) void wt_status_print(struct wt_status *s) { - const char *branch_color = color(WT_STATUS_HEADER, s); + const char *branch_color = color(WT_STATUS_ONBRANCH, s); + const char *branch_status_color = color(WT_STATUS_HEADER, s); if (s->branch) { const char *on_what = "On branch "; @@ -634,11 +639,12 @@ void wt_status_print(struct wt_status *s) branch_name += 11; else if (!strcmp(branch_name, "HEAD")) { branch_name = ""; - branch_color = color(WT_STATUS_NOBRANCH, s); + branch_status_color = color(WT_STATUS_NOBRANCH, s); on_what = "Not currently on any branch."; } color_fprintf(s->fp, color(WT_STATUS_HEADER, s), "# "); - color_fprintf_ln(s->fp, branch_color, "%s%s", on_what, branch_name); + color_fprintf(s->fp, branch_status_color, "%s", on_what); + color_fprintf_ln(s->fp, branch_color, "%s", branch_name); if (!s->is_initial) wt_status_print_tracking(s); } |