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

Re: [PATCH/RFC v2 0/2] add regex match flags to git describe

From
Duy Nguyen <pclouds@gmail.com>
Date
Dec 30, 2015, 09:52 UTC
Message-ID
<CACsJy8ADrHW=Tr2Tx04NoAKP3MfP__Ndjut_G_7HitLPHKn46w@mail.gmail.com>
In-Reply-To
<xmqqk2nxi002.fsf@gitster.mtv.corp.google.com>
On Wed, Dec 30, 2015 at 1:27 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 32 quoted lines
> It is more important to envision what we would do in the future when
> a command that takes a pattern (or a set of patterns) to match the
> refnames with _and_ another pattern (or a set of patterns) to match
> something else, and take that into account when designing this
> "allowing matching logic for refnames to be customized from glob to
> something else" feature, so that we do not paint outselves into a
> corner we cannot later get out of.  Imagine a hypothetical command
> 'git mgrep' that can look for a pattern in tips of multiple branches
> that can be used this way:
>
>     $ git mgrep -e 'froo*tz' --refs 'refs/heads/release/*'
>
> which may look for strings that match "froo*tz" in the trees of
> all branches whose name match the pattern 'release/*'.  In this
> example, the pattern to match strings is a BRE (same default as
> "git grep"), and the pattern to match refnames is a glob.
>
> Consistency & similarity with "git grep" would most likely lead us
> to add -E/-F/-G/-P options to this command and to make it affect how
> the pattern to match strings works.  For example:
>
>     $ git mgrep -E -e 'fro+tz' --match-refs 'refs/heads/release/*'
>
> may look for the same strings that would match the first example,
> but the pattern is expressed in ERE.  "-P", "-G", and "-F" options
> would also work the same way.
>
> Now, the question is what this "-E" (or -P/-G/-F) should do with the
> matching the command does with the refnames.  The easiest (and
> laziest) way out from the implementors' point of view might be to
> declare that they affect both at the same time.
> ...
What about not using command line options? We could go with something
like pathspec magic. I think as long as we provide three options:
literal, some pattern matching and backquote, then the user has enough
flexibility to specify any set of refs. For pattern matching I'd
prefer wildmatch. regex can be used via backquote, e.g. `for-each-ref
| grep ...` (or teach for-each-ref about regex to avoid grep).
-- 
Duy
Previous: Junio C HamanoNext: Mostyn Bramley-Moore
Message 7 of 14 in “add regex match flags to git describe”
  1. 0/2 add regex match flags to git describeMostyn Bramley-Moore, Dec 28, 2015
  2. 1/2 describe: add option to use perl-compatible regexes with --matchMostyn Bramley-Moore, Dec 28, 2015
  3. 2/2 describe: add basic and extended posix regex matching for completenessMostyn Bramley-Moore, Dec 28, 2015
  4. Junio C HamanoDec 28, 2015
  5. Mostyn Bramley-MooreDec 29, 2015
  6. Junio C HamanoDec 29, 2015
  7. Duy NguyenDec 30, 2015
  8. Mostyn Bramley-MooreDec 31, 2015
  9. Mostyn Bramley-MooreDec 31, 2015
  10. Junio C HamanoDec 31, 2015
  11. Mostyn Bramley-MooreDec 31, 2015
  12. Junio C HamanoJan 4, 2016
  13. Mostyn Bramley-MooreJan 6, 2016
  14. Duy NguyenJan 6, 2016

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.