git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.
Previous: J Smith
Message 5 of 5 in “grep: add a grep.patternType configuration setting”
  1. grep: add a grep.patternType configuration settingJ Smith, Aug 1, 2012
  2. Junio C HamanoAug 1, 2012
  3. Štěpán NěmecAug 1, 2012
  4. J SmithAug 1, 2012
  5. J SmithAug 2, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.