aboutsummaryrefslogtreecommitdiff
path: root/log-tree.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 /log-tree.c
parent2e6c012e10fd866eb3259de3a929e0296daabbaf (diff)
downloadgit-f1c9626105d5e4962a5ccaa4620114d03f32ad02.tar.gz
git-f1c9626105d5e4962a5ccaa4620114d03f32ad02.tar.xz
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 'log-tree.c')
-rw-r--r--log-tree.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/log-tree.c b/log-tree.c
index e9457019d..9ba8fb2af 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -31,7 +31,7 @@ static char decoration_colors[][COLOR_MAXLEN] = {
static const char *decorate_get_color(int decorate_use_color, enum decoration_type ix)
{
- if (decorate_use_color)
+ if (decorate_use_color > 0)
return decoration_colors[ix];
return "";
}
@@ -77,7 +77,7 @@ int parse_decorate_color_config(const char *var, const int ofs, const char *valu
* for showing the commit sha1, use the same check for --decorate
*/
#define decorate_get_color_opt(o, ix) \
- decorate_get_color(DIFF_OPT_TST((o), COLOR_DIFF), ix)
+ decorate_get_color((o)->use_color, ix)
static void add_name_decoration(enum decoration_type type, const char *name, struct object *obj)
{