summaryrefslogtreecommitdiff
path: root/combine-diff.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2011-08-17 22:03:12 -0700
committerJunio C Hamano <gitster@pobox.com>2011-08-18 14:35:53 -0700
commitf1c9626105d5e4962a5ccaa4620114d03f32ad02 (patch)
treed777e2316283c1972844977c821091dd77fd6262 /combine-diff.c
parent2e6c012e10fd866eb3259de3a929e0296daabbaf (diff)
downloadgit-f1c9626105d5e4962a5ccaa4620114d03f32ad02.tar.gz
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>
Diffstat (limited to 'combine-diff.c')
-rw-r--r--combine-diff.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/combine-diff.c b/combine-diff.c
index be67cfcd45..c588c79351 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -702,9 +702,8 @@ static void show_combined_header(struct combine_diff_path *elem,
int abbrev = DIFF_OPT_TST(opt, FULL_INDEX) ? 40 : DEFAULT_ABBREV;
const char *a_prefix = opt->a_prefix ? opt->a_prefix : "a/";
const char *b_prefix = opt->b_prefix ? opt->b_prefix : "b/";
- int use_color = DIFF_OPT_TST(opt, COLOR_DIFF);
- const char *c_meta = diff_get_color(use_color, DIFF_METAINFO);
- const char *c_reset = diff_get_color(use_color, DIFF_RESET);
+ const char *c_meta = diff_get_color_opt(opt, DIFF_METAINFO);
+ const char *c_reset = diff_get_color_opt(opt, DIFF_RESET);
const char *abb;
int added = 0;
int deleted = 0;
@@ -964,7 +963,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
show_combined_header(elem, num_parent, dense, rev,
mode_differs, 1);
dump_sline(sline, cnt, num_parent,
- DIFF_OPT_TST(opt, COLOR_DIFF), result_deleted);
+ opt->use_color, result_deleted);
}
free(result);