Re: [PATCH] color-words: make regex configurable via attributes
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jan 14, 2009, 20:12 UTC
- Message-ID
- <alpine.DEB.1.00.0901142104400.3586@pacific.mpi-cbg.de>
- In-Reply-To
- <1231962401-26974-1-git-send-email-trast@student.ethz.ch>
Hi,
On Wed, 14 Jan 2009, Thomas Rast wrote:
Show 11 quoted lines
> diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt > index 2c1fa4b..ef0e2f5 100644 > --- a/Documentation/diff-options.txt > +++ b/Documentation/diff-options.txt > @@ -97,6 +97,9 @@ endif::git-format-patch[] > Optionally, you can pass a regular expression that tells Git what the > words are that you are looking for; The default is to interpret any > stretch of non-whitespace as a word. > +The regex can also be set via a diff driver, see > +linkgit:gitattributes[1]; giving it explicitly overrides any diff > +driver setting.
How about making this an extra paragraph?
Show 10 quoted lines
> diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt > index 8af22ec..17707ba 100644 > --- a/Documentation/gitattributes.txt > +++ b/Documentation/gitattributes.txt > @@ -317,6 +317,8 @@ patterns are available: > > - `bibtex` suitable for files with BibTeX coded references. > > +- `cpp` suitable for source code in the C and C++ languages. > +
How about "written in C or C++"?
> +A built-in pattern is provided for all languages listed in the last > +section.
Wow. But how about "previous section"?
> diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh > index 0ed7e53..d6731d1 100755 > --- a/t/t4034-diff-words.sh > +++ b/t/t4034-diff-words.sh
That was fast!
Show 8 quoted lines
> +test_expect_success 'use default supplied by driver' ' > + > + test_must_fail git diff --no-index --color-words \ > + pre post > output && > + decrypt_color < output > output.decrypted && > + test_cmp expect-by-chars output.decrypted > + > +'
I am actually just about to post new revisions of the last two patches where this would read
test_expect_success 'use default supplied by driver' '
word_diff --color-words
'
instead...
I don't want to get bitten by stupid mistakes again, though, so I let it run with valgrind while glancing over the code. Stay tuned.
> +#define PATTERNS(name, pattern, wordregex) \
> + { name, NULL, -1, { pattern, REG_EXTENDED }, NULL, wordregex }You could get rid of that NULL if...
Show 10 quoted lines
> diff --git a/userdiff.h b/userdiff.h
> index ba29457..2aab13e 100644
> --- a/userdiff.h
> +++ b/userdiff.h
> @@ -12,6 +12,7 @@ struct userdiff_driver {
> int binary;
> struct userdiff_funcname funcname;
> const char *textconv;
> + const char *word_regex;
> };... you inserted word_regex before textconv. In a way, I find this more logical, since both funcname and word_regex have sensible defaults (provided by you), whereas textconv is strictly a user's option.
Ciao, Dscho