diff options
author | Boyd Stephen Smith Jr <bss@iguanasuicide.net> | 2009-01-20 21:46:57 -0600 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-01-21 00:51:12 -0800 |
commit | 98a4d87b87e9846eafd21ba232cc2b7ba3f718fc (patch) | |
tree | 801c8a827250699199969198c34878714fb65617 /diff.c | |
parent | 80c49c3de2d5a3aa12b0980a65f1163c8aef0c16 (diff) | |
download | git-98a4d87b87e9846eafd21ba232cc2b7ba3f718fc.tar.gz git-98a4d87b87e9846eafd21ba232cc2b7ba3f718fc.tar.xz |
color-words: Support diff.wordregex config option
When diff is invoked with --color-words (w/o =regex), use the regular
expression the user has configured as diff.wordregex.
diff drivers configured via attributes take precedence over the
diff.wordregex-words setting. If the user wants to change them, they have
their own configuration variables.
Signed-off-by: Boyd Stephen Smith Jr <bss@iguanasuicide.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r-- | diff.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -23,6 +23,7 @@ static int diff_detect_rename_default; static int diff_rename_limit_default = 200; static int diff_suppress_blank_empty; int diff_use_color_default = -1; +static const char *diff_word_regex_cfg; static const char *external_diff_cmd_cfg; int diff_auto_refresh_index = 1; static int diff_mnemonic_prefix; @@ -92,6 +93,8 @@ int git_diff_ui_config(const char *var, const char *value, void *cb) } if (!strcmp(var, "diff.external")) return git_config_string(&external_diff_cmd_cfg, var, value); + if (!strcmp(var, "diff.wordregex")) + return git_config_string(&diff_word_regex_cfg, var, value); return git_diff_basic_config(var, value, cb); } @@ -1550,6 +1553,8 @@ static void builtin_diff(const char *name_a, o->word_regex = userdiff_word_regex(one); if (!o->word_regex) o->word_regex = userdiff_word_regex(two); + if (!o->word_regex) + o->word_regex = diff_word_regex_cfg; if (o->word_regex) { ecbdata.diff_words->word_regex = (regex_t *) xmalloc(sizeof(regex_t)); |