diff options
author | Jeff King <peff@peff.net> | 2008-10-26 00:49:35 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-10-26 14:09:48 -0700 |
commit | 4f672ad6c77bfe73cc5dd4b240fd42303d101d2a (patch) | |
tree | e3d9e6567ef56d9d6db05bb3dadf05a62b67c4fe /wt-status.c | |
parent | 2675773af893ae81f9b09f18c1f2ec86ca2158e7 (diff) | |
download | git-4f672ad6c77bfe73cc5dd4b240fd42303d101d2a.tar.gz |
wt-status: load diff ui config
When "git status -v" shows a diff, we did not respect the
user's usual diff preferences at all. Loading just
git_diff_basic_config would give us things like rename
limits and diff drivers. But it makes even more sense to
load git_diff_ui_config, which gives us colorization if the
user has requested it.
Note that we need to take special care to cancel
colorization when writing to the commit template file, as
described in the code comments.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wt-status.c')
-rw-r--r-- | wt-status.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/wt-status.c b/wt-status.c index c3a9cab898..54d2f58693 100644 --- a/wt-status.c +++ b/wt-status.c @@ -303,6 +303,14 @@ static void wt_status_print_verbose(struct wt_status *s) rev.diffopt.detect_rename = 1; rev.diffopt.file = s->fp; rev.diffopt.close_file = 0; + /* + * If we're not going to stdout, then we definitely don't + * want color, since we are going to the commit message + * file (and even the "auto" setting won't work, since it + * will have checked isatty on stdout). + */ + if (s->fp != stdout) + DIFF_OPT_CLR(&rev.diffopt, COLOR_DIFF); run_diff_index(&rev, 1); } @@ -422,5 +430,5 @@ int git_status_config(const char *k, const char *v, void *cb) return error("Invalid untracked files mode '%s'", v); return 0; } - return git_color_default_config(k, v, cb); + return git_diff_ui_config(k, v, cb); } |