Merge branch 'ml/color-when'

* ml/color-when:
  Add an optional argument for --color options
This commit is contained in:
Junio C Hamano
2010-03-02 12:44:06 -08:00
12 changed files with 66 additions and 11 deletions

9
diff.c
View File

@ -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")) {