diff options
| author | Junio C Hamano <gitster@pobox.com> | 2010-03-02 12:44:06 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2010-03-02 12:44:06 -0800 |
| commit | c06951894ac943b2aaa288b0e9dc1eb605dfb7b6 (patch) | |
| tree | c84152355c7fe666d0bb16197e36eb63e33e0c13 /diff.c | |
| parent | Merge branch 'ac/cvsimport-revision-mapping' (diff) | |
| parent | Add an optional argument for --color options (diff) | |
| download | git-c06951894ac943b2aaa288b0e9dc1eb605dfb7b6.tar.gz git-c06951894ac943b2aaa288b0e9dc1eb605dfb7b6.zip | |
Merge branch 'ml/color-when'
* ml/color-when:
Add an optional argument for --color options
Diffstat (limited to 'diff.c')
| -rw-r--r-- | diff.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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")) { |
