git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git log: invert --author and --committer
@ 2016-05-23  9:54 Per Cederqvist
  2016-05-23 17:11 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Per Cederqvist @ 2016-05-23  9:54 UTC (permalink / raw)
  To: git

We have a repository that mostly contains configuration data.
This is updated by our continuous integration build system, but
every once in a while there are also more interesting commits
made by humans.

For several years I have suffered in silence, wishing for a way
to do something like

    git log --author-not cibot

Today a friend told me that you can actually list all commits
except those made by cibot with this commandline:

    git log --invert-grep --author cibot

The documentation for --invert-grep should mention that it
also inverts the meaning of --author and --committer.  Perphaps
something like this would make sense?

    /ceder

diff --git a/Documentation/rev-list-options.txt
b/Documentation/rev-list-options.txt
index 4f009d4..ae12687 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -70,7 +70,8 @@ endif::git-rev-list[]

 --invert-grep::
  Limit the commits output to ones with log message that do not
- match the pattern specified with `--grep=<pattern>`.
+ match the pattern specified with `--grep=<pattern>`.  Also
+ affects `--author=<pattern>` and `--committer=<pattern>`.

 -i::
 --regexp-ignore-case::

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

* Re: git log: invert --author and --committer
  2016-05-23  9:54 git log: invert --author and --committer Per Cederqvist
@ 2016-05-23 17:11 ` Junio C Hamano
  2016-05-23 19:26   ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2016-05-23 17:11 UTC (permalink / raw)
  To: Per Cederqvist; +Cc: git

Per Cederqvist <cederp@opera.com> writes:

> We have a repository that mostly contains configuration data.
> This is updated by our continuous integration build system, but
> every once in a while there are also more interesting commits
> made by humans.
>
> For several years I have suffered in silence, wishing for a way
> to do something like
>
>     git log --author-not cibot
>
> Today a friend told me that you can actually list all commits
> except those made by cibot with this commandline:
>
>     git log --invert-grep --author cibot
>
> The documentation for --invert-grep should mention that it
> also inverts the meaning of --author and --committer.  Perphaps
> something like this would make sense?
>
>     /ceder

Yeah, the author/committer search piggy-backs the more generic "grep
in the log" machinery, but it is quite hidden and the document
failed to tell the end users that is what is going on.  Mentioning
that invert (or any tweak that works on the grep machinery) affects
author/committer search is a good idea.

Does "-i/--regexp-ignore-case" also need the same treatment?

> diff --git a/Documentation/rev-list-options.txt
> b/Documentation/rev-list-options.txt
> index 4f009d4..ae12687 100644
> --- a/Documentation/rev-list-options.txt
> +++ b/Documentation/rev-list-options.txt
> @@ -70,7 +70,8 @@ endif::git-rev-list[]
>
>  --invert-grep::
>   Limit the commits output to ones with log message that do not
> - match the pattern specified with `--grep=<pattern>`.
> + match the pattern specified with `--grep=<pattern>`.  Also
> + affects `--author=<pattern>` and `--committer=<pattern>`.
>
>  -i::
>  --regexp-ignore-case::

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

* Re: git log: invert --author and --committer
  2016-05-23 17:11 ` Junio C Hamano
@ 2016-05-23 19:26   ` Junio C Hamano
  2016-05-23 21:21     ` Per Cederqvist
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2016-05-23 19:26 UTC (permalink / raw)
  To: Per Cederqvist; +Cc: git

Junio C Hamano <gitster@pobox.com> writes:

> Per Cederqvist <cederp@opera.com> writes:
>
>>     git log --invert-grep --author cibot
>...
> Yeah, the author/committer search piggy-backs the more generic "grep
> in the log" machinery, but it is quite hidden and the document
> failed to tell the end users that is what is going on.  Mentioning
> that invert (or any tweak that works on the grep machinery) affects
> author/committer search is a good idea.
>
> Does "-i/--regexp-ignore-case" also need the same treatment?

It seems it does.

How about making this clarification not about --invert-grep but
about --committer/--author option, perhaps like this?

 Documentation/rev-list-options.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index 4f009d4..3fca366 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -44,6 +44,10 @@ endif::git-rev-list[]
 	expression).  With more than one `--author=<pattern>`,
 	commits whose author matches any of the given patterns are
 	chosen (similarly for multiple `--committer=<pattern>`).
++
+Options that affect how a regular expression match is performed
+(such as `-i`, `-E`, `--invert-grep`) can also be used affect these
+options.
 
 --grep-reflog=<pattern>::
 	Limit the commits output to ones with reflog entries that

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

* Re: git log: invert --author and --committer
  2016-05-23 19:26   ` Junio C Hamano
@ 2016-05-23 21:21     ` Per Cederqvist
  2016-05-23 21:26       ` Junio C Hamano
  2016-05-23 21:47       ` Junio C Hamano
  0 siblings, 2 replies; 6+ messages in thread
From: Per Cederqvist @ 2016-05-23 21:21 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Mon, May 23, 2016 at 9:26 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Per Cederqvist <cederp@opera.com> writes:
>>
>>>     git log --invert-grep --author cibot
>>...
>> Yeah, the author/committer search piggy-backs the more generic "grep
>> in the log" machinery, but it is quite hidden and the document
>> failed to tell the end users that is what is going on.  Mentioning
>> that invert (or any tweak that works on the grep machinery) affects
>> author/committer search is a good idea.
>>
>> Does "-i/--regexp-ignore-case" also need the same treatment?
>
> It seems it does.
>
> How about making this clarification not about --invert-grep but
> about --committer/--author option, perhaps like this?
>
>  Documentation/rev-list-options.txt | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
> index 4f009d4..3fca366 100644
> --- a/Documentation/rev-list-options.txt
> +++ b/Documentation/rev-list-options.txt
> @@ -44,6 +44,10 @@ endif::git-rev-list[]
>         expression).  With more than one `--author=<pattern>`,
>         commits whose author matches any of the given patterns are
>         chosen (similarly for multiple `--committer=<pattern>`).
> ++
> +Options that affect how a regular expression match is performed
> +(such as `-i`, `-E`, `--invert-grep`) can also be used affect these
> +options.
>
>  --grep-reflog=<pattern>::
>         Limit the commits output to ones with reflog entries that

"can also be used to affect", right? (I think the word "to" is missing.)

I think it does make sense to document this with the --author/--committer
options.

That wording would however make me assume that --all-match could also
be used, so that

    git log --all-match --author ceder --author cibot

would list nothing (since there are no authors that match both
"ceder" and "cibot" in this codebase).  That isn't the fact, though.
It seems to list all commits that have either ceder or cibot as author,
just as if I had not used --all-match.

As a reader of the man-page, I would prefer to have the exact list
of options in the documentation.  (I realize that it will make it harder
to maintain.)

    /ceder

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

* Re: git log: invert --author and --committer
  2016-05-23 21:21     ` Per Cederqvist
@ 2016-05-23 21:26       ` Junio C Hamano
  2016-05-23 21:47       ` Junio C Hamano
  1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2016-05-23 21:26 UTC (permalink / raw)
  To: Per Cederqvist; +Cc: git

Per Cederqvist <cederp@opera.com> writes:

> "can also be used to affect", right? (I think the word "to" is missing.)

Correct.

> That wording would however make me assume that --all-match could also
> be used, so that
>
>     git log --all-match --author ceder --author cibot
>
> would list nothing (since there are no authors that match both
> "ceder" and "cibot" in this codebase).  That isn't the fact, though.

That is because "--all-match" does not affect "how a regular
expression match is performed".  The option affects the way how the
results from these multiple regular expression matches are combined.

> It seems to list all commits that have either ceder or cibot as author,
> just as if I had not used --all-match.
>
> As a reader of the man-page, I would prefer to have the exact list
> of options in the documentation.  (I realize that it will make it harder
> to maintain.)

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

* Re: git log: invert --author and --committer
  2016-05-23 21:21     ` Per Cederqvist
  2016-05-23 21:26       ` Junio C Hamano
@ 2016-05-23 21:47       ` Junio C Hamano
  1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2016-05-23 21:47 UTC (permalink / raw)
  To: Per Cederqvist; +Cc: git

Per Cederqvist <cederp@opera.com> writes:

> I think it does make sense to document this with the --author/--committer
> options.
>
> That wording would however make me assume that --all-match could also
> be used, so that
>
>     git log --all-match --author ceder --author cibot
>
> would list nothing (since there are no authors that match both
> "ceder" and "cibot" in this codebase).  That isn't the fact, though.
> It seems to list all commits that have either ceder or cibot as author,
> just as if I had not used --all-match.
>
> As a reader of the man-page, I would prefer to have the exact list
> of options in the documentation.  (I realize that it will make it harder
> to maintain.)
>
>     /ceder

Ok, take 2.

This makes `--all-match` the only one that explicitly mentions that
the option applies to patterns given with the `--grep` option; from
an end-user's point of view, --author/--committer is not given via
the `--grep` option, so it may help to alleviate the above issue.

All others use "limiting patterns" consistently, so that eyeballing
for the phrase would catch things like "--invert-grep", "-E", etc.
and it would be easier to keep future additions to conform to the
convention, hopefully.

 Documentation/rev-list-options.txt | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index 4f009d4..51ead72 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -44,6 +44,10 @@ endif::git-rev-list[]
 	expression).  With more than one `--author=<pattern>`,
 	commits whose author matches any of the given patterns are
 	chosen (similarly for multiple `--committer=<pattern>`).
++
+Options that affect how a limiting pattern matches (listed below,
+such as `-i`, `-E`, `--invert-grep`) can also be used to affect
+these options.
 
 --grep-reflog=<pattern>::
 	Limit the commits output to ones with reflog entries that
@@ -70,7 +74,7 @@ endif::git-rev-list[]
 
 --invert-grep::
 	Limit the commits output to ones with log message that do not
-	match the pattern specified with `--grep=<pattern>`.
+	match the regular expression limiting patterns.
 
 -i::
 --regexp-ignore-case::

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

end of thread, other threads:[~2016-05-23 21:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-23  9:54 git log: invert --author and --committer Per Cederqvist
2016-05-23 17:11 ` Junio C Hamano
2016-05-23 19:26   ` Junio C Hamano
2016-05-23 21:21     ` Per Cederqvist
2016-05-23 21:26       ` Junio C Hamano
2016-05-23 21:47       ` Junio C Hamano

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).