X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=wt-status.c;h=9ffc535f1ab0296fd0a3330b1f136d69f9ac9bb2;hb=4838237cb73a13d38a7e4348b71be96b60eed21e;hp=c01838c5ad5d04996478350c01a9c49231a467bc;hpb=43176d1e4cddc4ab2f2f7dc6f3ba10513ffc2f2b;p=git.git diff --git a/wt-status.c b/wt-status.c index c01838c5a..9ffc535f1 100644 --- a/wt-status.c +++ b/wt-status.c @@ -26,7 +26,9 @@ static char default_wt_status_colors[][COLOR_MAXLEN] = { static const char *color(int slot, struct wt_status *s) { - const char *c = s->use_color > 0 ? s->color_palette[slot] : ""; + const char *c = ""; + if (want_color(s->use_color)) + c = s->color_palette[slot]; if (slot == WT_STATUS_ONBRANCH && color_is_nil(c)) c = s->color_palette[WT_STATUS_HEADER]; return c; @@ -109,7 +111,6 @@ void status_printf_more(struct wt_status *s, const char *color, void wt_status_prepare(struct wt_status *s) { unsigned char sha1[20]; - const char *head; memset(s, 0, sizeof(*s)); memcpy(s->color_palette, default_wt_status_colors, @@ -117,8 +118,7 @@ void wt_status_prepare(struct wt_status *s) s->show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES; s->use_color = -1; s->relative_paths = 1; - head = resolve_ref("HEAD", sha1, 0, NULL); - s->branch = head ? xstrdup(head) : NULL; + s->branch = resolve_refdup("HEAD", sha1, 0, NULL); s->reference = "HEAD"; s->fp = stdout; s->index_file = get_index_file(); @@ -681,7 +681,7 @@ static void wt_status_print_verbose(struct wt_status *s) * will have checked isatty on stdout). */ if (s->fp != stdout) - DIFF_OPT_CLR(&rev.diffopt, COLOR_DIFF); + rev.diffopt.use_color = 0; run_diff_index(&rev, 1); }