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

Re: [PATCH] Add git-rev-list --invert-match

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Sep 20, 2007, 13:12 UTC
Message-ID
<Pine.LNX.4.64.0709201403540.28395@racer.site>
In-Reply-To
<20070920123849.GD12076@jukie.net>
Hi,
On Thu, 20 Sep 2007, Bart Trojanowski wrote:
Show 21 quoted lines
> * Johannes Schindelin <Johannes.Schindelin@gmx.de> [070920 06:34]:
> > On Wed, 19 Sep 2007, Bart Trojanowski wrote:
> > >   git log --invert-match --grep="uninteresting"
> > 
> > IMHO this is only half a solution.  Some of us want to say "git log 
> > --grep=this --but-not-(in-the-whole-message) --grep=that".
> 
> I have noticed that unique negation flags are getting scarce... we
> already have --reverse, --inverse, and --not  mean something elsewhere.
> --but-not maybe be good.
> 
> I also agree that git-grep could use this extension.
> 
> Anyways, I can see four solutions for adding "show me this but not that"
> functionality to git-rev-list:
> 
>  1) adding a --but-not flag, as you suggested.  It separates positive
>     matches that precede it with negative matches that follow.
> 
>   Example:
>     git log --grep=this --but-not --grep=that --committer="${MY_EMAIL}"
That is basically the approach taken by
http://article.gmane.org/gmane.comp.version-control.git/51874

(Yes, since you refused to search in the mailing list archives, I did it for you... this time!)

Show 5 quoted lines
>  2) Adding --not-grep, --not-author, --not-committer which add negative
>     matches.  Maybe even --grep!=PATTERN, --author!=PATTERN, ...
> 
>   Example:
>     git log --grep=this --not-grep=that --committer!="${MY_EMAIL}"
That sounds sensible.
Show 6 quoted lines
>  3) Extending the PATTERN we accept in --grep, --author, and --committer,
>     such that a prefix in the pattern tells us how to use the match:
>     --grep=!PATTERN
> 
>   Example:
>     git log --grep=this --grep='!that' --committer="!${MY_EMAIL}"

Now you can no longer avoid defining clean semantics: what does that mean? Does it mean that there is _one_ line that does not have "that" in it, or is it the complete message?

Further, it probably makes sense to have the option to say _both_: "Find me a commit that contains Bart in one line, but not Simpson, and that does not contain the word "Sverdoolaege" at all."

Show 5 quoted lines
>  4) (going on a limb here) Can this kind of match be done with perl
>     regular expressions?  Maybe we could use --perl-regexp
> 
>   Example:
>     I've got nothing :)
This time you'll have to find the thread yourself.  Hint: search for pcre.

Ciao, Dscho

Previous: Bart TrojanowskiNext: Junio C Hamano
Message 7 of 13 in “Add git-rev-list --invert-match”
  1. Add git-rev-list --invert-matchBart Trojanowski, Sep 19, 2007
  2. Add git-rev-list --invert-matchBart Trojanowski, Sep 20, 2007
  3. Junio C HamanoSep 20, 2007
  4. Bart TrojanowskiSep 20, 2007
  5. Johannes SchindelinSep 20, 2007
  6. Bart TrojanowskiSep 20, 2007
  7. Johannes SchindelinSep 20, 2007
  8. Junio C HamanoSep 20, 2007
  9. Johannes SchindelinSep 20, 2007
  10. [RFC] Add git-rev-list --not-(author|committer|grep)!=patternBart Trojanowski, Sep 22, 2007
  11. Jeff KingSep 21, 2007
  12. Johannes SchindelinSep 21, 2007
  13. Jeff KingSep 21, 2007

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.