Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksi Aalto <aga@iki.fi>2010-11-18 02:40:05 +0300
committerJunio C Hamano <gitster@pobox.com>2010-11-30 03:31:34 +0300
commit1d282327d7354dd3a1caefa4af06562aa816710d (patch)
tree8779a64c22934c6be78c08705576272b5276bfdf /wt-status.c
parent7d43de925b2771d295d8fc4341b7bd544e2a74fa (diff)
status: show branchname with a configurable color
You can tell "git status" to paint the name of the current branch in its output (the line that says "On branch ...") by setting the configuration variable color.status.branch; it is by default turned off. Signed-off-by: Aleksi Aalto <aga@iki.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wt-status.c')
-rw-r--r--wt-status.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/wt-status.c b/wt-status.c
index d9f3d9fe93..19c9cb1d23 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -21,6 +21,7 @@ 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_NORMAL, /* WT_STATUS_ONBRANCH */
};
static const char *color(int slot, struct wt_status *s)
@@ -625,7 +626,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 +636,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);
}