Re: [PATCH/RFC] grep: add a grep.patternType configuration setting
- From
J Smith <dark.panda@gmail.com>
- Date
- Aug 2, 2012, 14:47 UTC
- Message-ID
- <CADFUPgfeEYSOH8scLatTGqCWQQ=goA2KZogLC+UmVNZWi3UrcA@mail.gmail.com>
- In-Reply-To
- <CADFUPgdX44pCFhytPj-hHSCPH9UHNBKk5pYkpses86M1ntxvyA@mail.gmail.com>
Alright, I have revised the patch and fixed up the nits that were picked and made a quick modification. I've added a setting for grep.patternType for "default" which can restore the default grep pattern matching behaviour and restores the functionality back to grep.extendedRegexp. I added this functionality for situations like where you would have grep.patternType set to, say, "perl" in your $HOME/.gitconfig but don't want that functionality set in a specific repo and would rather to have it fall back to the older grep.extendedRegexp behaviour so you can set it to "default" in the repo's .git/config.
This change also lets us determine the final set of pattern type options in one place rather than the current code which does two checks -- once when we call grep_config to determine the configuration options and then another a few lines later when we call it for the arguments given to grep. Now we capture the values we receive from grep.patternType and grep.extendedRegexp in the grep_opt struct as pattern_type_option and extended_regexp_option, capture the pattern type argument given to the command itself, and then make the final determination for the options to be used in one place rather than the current manner. I think it should be more obvious this way.
I'll post the latest patch shortly for review if this sounds reasonable. Cheers.