Re: [PATCH v3 3/4] word diff: make regex configurable via attributes
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:45:55
Thomas Rast [off-list ref] writes:
quoted hunk
Make the --color-words splitting regular expression configurable via the diff driver's 'wordregex' attribute. The user can then set the driver on a file in .gitattributes. If a regex is given on the command line, it overrides the driver's setting. ...diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt index 6152d5b..d22c06b 100644 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt@@ -96,7 +96,9 @@ endif::git-format-patch[] By default, a new word only starts at whitespace, so that a 'word' is defined as a maximal sequence of non-whitespace characters. The optional argument <regex> can be used to - configure this. + configure this. It can also be set via a diff driver, see + linkgit:gitattributes[1]; if a <regex> is given explicitly, it + overrides any diff driver setting. + The <regex> must be an (extended) regular expression. When set, every non-overlapping match of the <regex> is considered a word. (Regular
One bikeshedding I think is better to get over with is that this probably should be called xwordregex for consistency with xfuncname where 'x' variant means POSIX ERE and the one without means POSIX BRE, even if we are not going to support diff.wordregex that uses BRE. I am assuming [3/4] can be trivially adjusted if we were to adopt the clean-up approach Dscho is taking?