diff: refactor COLOR_DIFF from a flag into an int
This lets us store more than just a bit flag for whether we want color; we can also store whether we want automatic colors. This can be useful for making the automatic-color decision closer to the point of use. This mostly just involves replacing DIFF_OPT_* calls with manipulations of the flag. The biggest exception is that calls to DIFF_OPT_TST must check for "o->use_color > 0", which lets an "unknown" value (i.e., the default) stay at "no color". In the previous code, a value of "-1" was not propagated at all. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
2e6c012e10
commit
f1c9626105
@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user