aboutsummaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-03-02 12:44:06 -0800
committerJunio C Hamano <gitster@pobox.com>2010-03-02 12:44:06 -0800
commitc06951894ac943b2aaa288b0e9dc1eb605dfb7b6 (patch)
treec84152355c7fe666d0bb16197e36eb63e33e0c13 /diff.c
parent6954ef206343d366c365f5946caa967f92d7bab1 (diff)
parent73e9da019655261e456ed862340880de365111f0 (diff)
downloadgit-c06951894ac943b2aaa288b0e9dc1eb605dfb7b6.tar.gz
git-c06951894ac943b2aaa288b0e9dc1eb605dfb7b6.tar.xz
Merge branch 'ml/color-when'
* ml/color-when: Add an optional argument for --color options
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/diff.c b/diff.c
index 989dbc54c..ed3e7c5aa 100644
--- a/diff.c
+++ b/diff.c
@@ -2826,6 +2826,15 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
DIFF_OPT_SET(options, FOLLOW_RENAMES);
else if (!strcmp(arg, "--color"))
DIFF_OPT_SET(options, COLOR_DIFF);
+ else if (!prefixcmp(arg, "--color=")) {
+ int value = git_config_colorbool(NULL, arg+8, -1);
+ if (value == 0)
+ DIFF_OPT_CLR(options, COLOR_DIFF);
+ else if (value > 0)
+ DIFF_OPT_SET(options, COLOR_DIFF);
+ else
+ return error("option `color' expects \"always\", \"auto\", or \"never\"");
+ }
else if (!strcmp(arg, "--no-color"))
DIFF_OPT_CLR(options, COLOR_DIFF);
else if (!strcmp(arg, "--color-words")) {