Re: [PATCH] grep: allow -E and -n to be turned on by default via configuration
- From
Joe Ratterman <jratt0@gmail.com>
- Date
- Mar 28, 2011, 22:41 UTC
- Message-ID
- <AANLkTimpp+dyt8cONp_nK72eTXXgsOfkHuWpPTr90h=u@mail.gmail.com>
- In-Reply-To
- <7vbp0ux5c9.fsf_-_@alter.siamese.dyndns.org>
On Mon, Mar 28, 2011 at 5:12 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 6 quoted lines
> +grep.lineNumbers:: > + If set to true, enable '-n' option by default. > + > +grep.extendedRegexp:: > + If set to true, enable '--extended-regexp' option by default. > +
I know my original patch was plural, but I since noticed that the GNU grep --line-number option is singular. I used the same thing in my patch to add that option to git grep. Should this one be singular?
Show 7 quoted lines
> +grep.lineNumbers:: > + If set to true, enable '-n' option by default. > + > +grep.extendedRegexp:: > + If set to true, enable '--extended-regexp' option by default. > + > +
...
Show 7 quoted lines
> + if (!strcmp(var, "grep.extendedregexp")) {
> + opt->regflags |= git_config_bool(var, value) ? REG_EXTENDED : 0;
> + return 0;
> + }
> +
> + if (!strcmp(var, "grep.linenumbers")) {
> + opt->linenum = git_config_bool(var, value);We need to match the case between the docs and the code or use strcasecmp(). Most config options I could find used all lower-case.
Joe