All of lore.kernel.org
 help / color / mirror / Atom feed
* Bug report: --invert-grep and --author seems to be incompatible.
@ 2016-07-13 16:52 Jehan Pagès
  2016-07-13 17:04 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Jehan Pagès @ 2016-07-13 16:52 UTC (permalink / raw)
  To: git

Hello,

> $ git version
> git version 2.5.5

Tested on a Fedora 23.

You can combine `git log --author=someone --grep=something` to have
all commits by "someone" where "something" can be grepped. If I want
all commits by someone where "something" is not grepped, I would
expect this command to return it:

> git log --author=someone --invert-grep --grep=something

But it does not work. Actually it looks like it just returns
everything (as though I had done a simple `git log`). So there seems
to be a problem here.
Thanks!

Jehan

-- 
ZeMarmot open animation film
http://film.zemarmot.net
Patreon: https://patreon.com/zemarmot
Tipeee: https://www.tipeee.com/zemarmot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug report: --invert-grep and --author seems to be incompatible.
  2016-07-13 16:52 Bug report: --invert-grep and --author seems to be incompatible Jehan Pagès
@ 2016-07-13 17:04 ` Junio C Hamano
  2016-07-13 17:16   ` Jehan Pagès
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2016-07-13 17:04 UTC (permalink / raw)
  To: Jehan Pagès; +Cc: git

Jehan Pagès <jehan.marmottard@gmail.com> writes:

>> git log --author=someone --invert-grep --grep=something
>
> But it does not work. Actually it looks like it just returns
> everything (as though I had done a simple `git log`).

Do you see a commit that is by "someone" and has "something" in it
in the output from the command?

I think --author=someone greps the "author " field in the commit
object looking for the hit with "someone", and your request asks to
show commits that either do not have "something" or was not written
by "someone", I would guess.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug report: --invert-grep and --author seems to be incompatible.
  2016-07-13 17:04 ` Junio C Hamano
@ 2016-07-13 17:16   ` Jehan Pagès
  2016-07-13 17:37     ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Jehan Pagès @ 2016-07-13 17:16 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi,

On Wed, Jul 13, 2016 at 7:04 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Jehan Pagès <jehan.marmottard@gmail.com> writes:
>
>>> git log --author=someone --invert-grep --grep=something
>>
>> But it does not work. Actually it looks like it just returns
>> everything (as though I had done a simple `git log`).
>
> Do you see a commit that is by "someone" and has "something" in it
> in the output from the command?

Indeed you are right! Commits which are by "someone" and have
"something" in it in the same time are missing.
So here --invert-grep works as a big "NOT" operator on the whole rest
of the command line, which is not expected (at least by me).

> I think --author=someone greps the "author " field in the commit
> object looking for the hit with "someone", and your request asks to
> show commits that either do not have "something" or was not written
> by "someone", I would guess.

Note that I can still see commits with "something", and I can also see
commits by "someone" in my results. So my request actually ask for
commits which have neither "something" nor are done by "someone".

Anyway I don't think that's the expected result, hence is still a bug.
Am I wrong?

Jehan

-- 
ZeMarmot open animation film
http://film.zemarmot.net
Patreon: https://patreon.com/zemarmot
Tipeee: https://www.tipeee.com/zemarmot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug report: --invert-grep and --author seems to be incompatible.
  2016-07-13 17:16   ` Jehan Pagès
@ 2016-07-13 17:37     ` Junio C Hamano
  2016-07-13 20:14       ` Jehan Pagès
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2016-07-13 17:37 UTC (permalink / raw)
  To: Jehan Pagès; +Cc: git

Jehan Pagès <jehan.marmottard@gmail.com> writes:

>> I think --author=someone greps the "author " field in the commit
>> object looking for the hit with "someone", and your request asks to
>> show commits that either do not have "something" or was not written
>> by "someone", I would guess.
>
> Note that I can still see commits with "something", and I can also see
> commits by "someone" in my results. So my request actually ask for
> commits which have neither "something" nor are done by "someone".
>
> Anyway I don't think that's the expected result, hence is still a bug.
> Am I wrong?

Unlike "git grep", "git log" works with boolean expression that does
not explicitly have a way to say "--and" and "--or", so only one
interpretation has been chosen long time ago.  All the terms are
ORed together, and then the whole thing can be inverted with
"--invert-grep".  i.e. you are telling an equivalent of

    $ git grep --not \( -e "author someone" --or -e "something" \)

with the command line, and there is no way to combine the requested
match criteria (there are two, "author must be somebody" and
"something must be in the message") differently.

Given that, that is the "right" expectation, and as long as you get
the behaviour, there is no "bug".

You can call it a lack of feature, though, and patches to implement
a more flexible combination of match criteria like "git grep" allows
is always welcome.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug report: --invert-grep and --author seems to be incompatible.
  2016-07-13 17:37     ` Junio C Hamano
@ 2016-07-13 20:14       ` Jehan Pagès
  2016-07-13 20:33         ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Jehan Pagès @ 2016-07-13 20:14 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi,

On Wed, Jul 13, 2016 at 7:37 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Jehan Pagès <jehan.marmottard@gmail.com> writes:
>
>>> I think --author=someone greps the "author " field in the commit
>>> object looking for the hit with "someone", and your request asks to
>>> show commits that either do not have "something" or was not written
>>> by "someone", I would guess.
>>
>> Note that I can still see commits with "something", and I can also see
>> commits by "someone" in my results. So my request actually ask for
>> commits which have neither "something" nor are done by "someone".
>>
>> Anyway I don't think that's the expected result, hence is still a bug.
>> Am I wrong?
>
> Unlike "git grep", "git log" works with boolean expression that does
> not explicitly have a way to say "--and" and "--or", so only one
> interpretation has been chosen long time ago.  All the terms are
> ORed together, and then the whole thing can be inverted with
> "--invert-grep".  i.e. you are telling an equivalent of
>
>     $ git grep --not \( -e "author someone" --or -e "something" \)
>
> with the command line, and there is no way to combine the requested
> match criteria (there are two, "author must be somebody" and
> "something must be in the message") differently.
>
> Given that, that is the "right" expectation, and as long as you get
> the behaviour, there is no "bug".

I see. Well it's a little counter-intuitive though, since the option
is called --invert-grep. And the man indicates:

« Limit the commits output to ones with log message that do not match
the pattern specified with --grep=<pattern>. »

So it gives the impression that the option is made only to invert the
--grep part. Whereas in fact, you are saying it inverts any other
optional selection (or at least also --author). A better naming should
have been called --invert-matches, or even just --invert.
And the man description should definitely be completed, IMO.

> You can call it a lack of feature, though, and patches to implement
> a more flexible combination of match criteria like "git grep" allows
> is always welcome.

Maybe I will! This would be useful to have a little more capabilities
for commit selection.
Thanks.

Jehan

-- 
ZeMarmot open animation film
http://film.zemarmot.net
Patreon: https://patreon.com/zemarmot
Tipeee: https://www.tipeee.com/zemarmot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug report: --invert-grep and --author seems to be incompatible.
  2016-07-13 20:14       ` Jehan Pagès
@ 2016-07-13 20:33         ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2016-07-13 20:33 UTC (permalink / raw)
  To: Jehan Pagès; +Cc: git

Jehan Pagès <jehan.marmottard@gmail.com> writes:

> ... A better naming should
> have been called --invert-matches, or even just --invert.
> And the man description should definitely be completed, IMO.

Renaming the options would not work well without harming existing
users, but a patch to update the documentation is certainly very
welcome.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-07-13 20:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-13 16:52 Bug report: --invert-grep and --author seems to be incompatible Jehan Pagès
2016-07-13 17:04 ` Junio C Hamano
2016-07-13 17:16   ` Jehan Pagès
2016-07-13 17:37     ` Junio C Hamano
2016-07-13 20:14       ` Jehan Pagès
2016-07-13 20:33         ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.