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
Junio C Hamano <gitster@pobox.com>
Date
Dec 28, 2015, 20:30 UTC
Message-ID
<xmqqy4cejoz4.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<cover.1451298323.git.mostynb@opera.com>
Mostyn Bramley-Moore <mostynb@opera.com> writes:
Show 8 quoted lines
> git describe currently only supports glob matching with the --matches flag.
> It would be useful to support regular expressions.
>
> For consistency, this uses the same regex flags as those used by git-grep.
>
> Some old discussion of this as a candidate feature is here, though nobody put
> together a patch as far as I can see:
> http://comments.gmane.org/gmane.comp.version-control.git/173873
Thanks.

I do not think it is wrong per-se to add an option to use regular expressions instead of globs, but if we are to do so, the endgame we aim for MUST be that we do so consistently to all the other commands that iterate over refs and limit their output to the ones that match given pattern (or a set of patterns), not just 'describe'.

Even if we are not adding such an option to these other commands right now (yet), we at least need to know what these commands are (e.g. "git tag -l" and "git for-each-ref" immediately come to mind, but there may be others), and make sure that the option names you choose here can be used sensibly in their context. I think "tag" and "for-each-ref" do no pattern matching against anything other than the refnames, so it would be clear what a new --perl-regexp option does in their contexts.

Unlike "grep" whose sole point is to perform pattern matching, the filtering of refs these commands do is merely a very small tweak in the overall picture (e.g. "git tag --contains $commit -l $pattern" does filter by matching $pattern against the refname, but that is a small detail compared to the filtering done by the reachability with the $commit), so I am not sure if short -E/-G/-F/-P should be given to these commands like "grep" does, though. These commands may have better uses for these shorter option names.

Previous: Mostyn Bramley-MooreNext: Mostyn Bramley-Moore
Message 4 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.