From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Anthony Sottile <asottile@umich.edu>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: bug: `git log --grep ... --invert-grep --author=...` negates / ignores --author
Date: Thu, 1 Jun 2017 21:45:51 +0200 [thread overview]
Message-ID: <CACBZZX5j=g=Lnv-X9F5Uaf0wW922R3N=LgrzRKPw853ECmoqYQ@mail.gmail.com> (raw)
In-Reply-To: <20170531214019.bbhjdaejvgje3v6g@sigill.intra.peff.net>
On Wed, May 31, 2017 at 11:40 PM, Jeff King <peff@peff.net> wrote:
> On Wed, May 31, 2017 at 08:08:54PM +0200, Ævar Arnfjörð Bjarmason wrote:
>
>> $ git log --grep=bar --author=Ævar --pretty=format:%an -100 origin/pu
>> |sort|uniq -c|sort -nr
>> 5 Ævar Arnfjörð Bjarmason
>>
>> $ git log --author=Ævar --pretty=format:%an -100 origin/pu |sort|uniq
>> -c|sort -nr
>> 100 Ævar Arnfjörð Bjarmason
>>
>> $ git log --grep=bar --invert-grep --author=Ævar --pretty=format:%an
>> -100 origin/pu |sort|uniq -c|sort -nr
>> 78 Junio C Hamano
>> 14 Jeff King
>> 2 Andreas Heiduk
>> 1 Sahil Dua
>> 1 Rikard Falkeborn
>> 1 Johannes Sixt
>> 1 Johannes Schindelin
>> 1 Ben Peart
>> 1 Ævar Arnfjörð Bjarmason
>>
>> That last command should only find my commits, but instead --author is
>> discarded.
>
> I would have thought that the last command wouldn't find _any_ of your
> commits. Don't we consider --author a greppable pattern and invert it?
There's two unrelated things going on here AFAICT:
* Anthony expected --author to be inverted by --invert-grep, but this
is not how it's documented, it's *only* for inverting the --grep
pattern: "Limit the commits output to ones with log message that do
not match the pattern specified with --grep=<pattern>."
* The --author filter should be applied un-inverted, but isn't, it's
seemingly just ignored in the presence of --grep, actually mostly
ignored, this is bizarre:
$ diff -ru <(git log --grep=bar --invert-grep --pretty=format:%an -100
origin/pu |sort|uniq -c|sort -nr) <(git log --grep=bar --invert-grep
--pretty=format:%an -100 --author=WeMostlyIgnoreThisButNotReally
origin/pu |sort|uniq -c|sort -nr)
--- /dev/fd/63 2017-06-01 21:44:08.952583804 +0200
+++ /dev/fd/62 2017-06-01 21:44:08.952583804 +0200
@@ -1,6 +1,6 @@
- 66 Junio C Hamano
+ 65 Junio C Hamano
10 Jeff King
- 8 Stefan Beller
+ 9 Stefan Beller
5 Lars Schneider
2 SZEDER Gábor
1 Tyler Brazier
> By itself:
>
> $ git log --author=Ævar --invert-grep --format=%an -100 origin/pu |
> sort | uniq -c | sort -rn
> 79 Junio C Hamano
> 8 Stefan Beller
> 8 Jeff King
> 1 Sahil Dua
> 1 Rikard Falkeborn
> 1 Johannes Sixt
> 1 Johannes Schindelin
> 1 Andreas Heiduk
>
> So that makes sense from the "--author is invertable" world-view.
>
> But I'm puzzled that you show up at all when --grep=bar is added (and
> moreover, that we get _one_ commit from you, not the 5 found in your
> initial command). That seems like a bug.
I think that's the only thing that's not a bug, i.e. we just find 1
match in the first 100 (note -100), sorry for the confusing example.
Anyway, much of the above may be incorrect, I haven't dug deeply
beyond just finding that something's funny going on and we definitely
have *some* bugs here.
next prev parent reply other threads:[~2017-06-01 19:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-31 15:45 bug: `git log --grep ... --invert-grep --author=...` negates / ignores --author Anthony Sottile
2017-05-31 18:08 ` Ævar Arnfjörð Bjarmason
2017-05-31 21:40 ` Jeff King
2017-06-01 19:45 ` Ævar Arnfjörð Bjarmason [this message]
2017-06-01 21:05 ` Anthony Sottile
2017-06-01 21:38 ` Junio C Hamano
2017-06-01 2:20 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACBZZX5j=g=Lnv-X9F5Uaf0wW922R3N=LgrzRKPw853ECmoqYQ@mail.gmail.com' \
--to=avarab@gmail.com \
--cc=asottile@umich.edu \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).