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

Re: Why does "git log -G<regex>" works with "regexp-ignore-case" but not with other regexp-related options?

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 20, 2015, 17:41 UTC
Message-ID
<xmqqbniin1cw.fsf@gitster.dls.corp.google.com>
In-Reply-To
<5534BD87.8020709@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
> They [jc: -S and -G] have different semantics, and *therefore*
> they have different defaults, and *therefore* a user may want to
> switch one of them (or --grep or --author or...) to
> --fixed--strings and keep the other to --regexp.

Ahh, OK. And not just -S and -G, the "fields in headers" may be something user may want to switch independently?

Show 6 quoted lines
> One idea would be to make
>
> --regexp -S --fixed-strings -G
>
> work the obvious way (match option affects following grep
> options),...

I understand that your idea is for options to accumulate up to what consumes them, e.g. -S, -G, --author,..., and then get reset for the next consumer. I would think it is very much debatable if that way of working is "the obvious" one, though. If I had no prior Git experience, I would imagine that I would find it more intuitive if

    $ git log --regexp-ignore-case --author=tiM --grep=wip
showed a commit authored by Tim that is labelled with "[WIP]".

It may be tempting to expose that our underlying machinery could use 3 different regexp matching settings for header fields (i.e. author, committer), log messages and the patch bodies somehow to the end users, and either interpreting options position-dependently or having separate options may be possible ways to do so. That would give the end users full flexibility the underlying machinery offers.

I am however not yet convinced that additional complexity at the UI level that would burden the end users is a reasonable price to pay for such a flexibility. When was the last time you wanted to grep for log messages case insensitively for commits authored by Tim but wanted to hide commits authored by tim when you used the above "log" command line or similar?

Previous: Michael J GruberNext: Linus Torvalds
Message 7 of 12 in “Why does "git log -G<regex>" works with "regexp-ignore-case" but not with other regexp-related options?”
  1. Tim FriskeApr 17, 2015
  2. Michael J GruberApr 17, 2015
  3. Junio C HamanoApr 17, 2015
  4. Junio C HamanoApr 17, 2015
  5. Junio C HamanoApr 17, 2015
  6. Michael J GruberApr 20, 2015
  7. Junio C HamanoApr 20, 2015
  8. Linus TorvaldsApr 20, 2015
  9. Junio C HamanoApr 20, 2015
  10. Michael J GruberApr 21, 2015
  11. Junio C HamanoApr 21, 2015
  12. Michael J GruberApr 22, 2015

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.