git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Max Coplan via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org,  Phillip Wood <phillip.wood123@gmail.com>,
	 strager <strager.nds@gmail.com>,  me <mchcopl@gmail.com>
Subject: Re: [PATCH v2] log: add option to search for header or body
Date: Sat, 06 Apr 2024 23:08:14 -0700	[thread overview]
Message-ID: <xmqq4jcdhfht.fsf@gitster.g> (raw)
In-Reply-To: <pull.1710.v2.git.1712460247516.gitgitgadget@gmail.com> (Max Coplan via GitGitGadget's message of "Sun, 07 Apr 2024 03:24:07 +0000")

"Max Coplan via GitGitGadget" <gitgitgadget@gmail.com> writes:

> This change adds a new option to `git log` that allows users to search
> for commits that match either the author or the commit message. This is
> useful for finding commits that were either authored or co-authored by a
> specific person.

I have this feeling that the "solution" presented is not quite
addressing the use case in a more useful and direct way than it
could be.  When I designed how the --author/--committer restriction
and --grep in the body of the message interact, I made a concious
decision that "among those commits that were authored by person X,
find the ones that mention Y" is far more useful than "done by X, or
done by anybody that mention Y", especially when Y is just a text
search in the free form.  There was nothing that limits the mention
of Y to those specifically involved in the commit---the mention could
just have been part of text, like "earlier Max Coplan sent a patch,
but this commit is not related to it".

But these days, we have a more established "convention" that lists
people at the end in the form of "trailers", and that changes the
picture quite a lot from how the world order was back then.

In other words, if the true objective is to find commits that
involved person X, Y or Z (which is very common and would be a lot
more useful than finding those that involve all of them), shouldn't
we be limiting the --grep side even further so that a random mention
of person Y is excluded and hit is counted only when person Y is
mentioned on a trailer (while loosening the --author side so that it
is OR'ed instead of AND'ed)?

I am imagining a pair of new options to name people (all OR'ed) and
to name places the names of these people should appear (again, all
OR'ed).  I am not good at naming, so the option names in the example
is not more than illustration of an idea and not my recommendation,
but a command:

    git log --by="Max Coplan" --by="Junio C Hamano" \
	    --by-where=author,Signed-off-by,Co-authored-by

would find a commit that has one (or more) of the given names
in one (or more) of the places that are specified, where the places
can be either "author", "committer" to specify these headers in the
commit object, or random other string to specify trailer lines with
given keys.

Hmm?

  reply	other threads:[~2024-04-07  6:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-05 21:48 [PATCH] feat(log): add option to search for header or body to `git log` Max Coplan via GitGitGadget
2024-04-06 14:04 ` Phillip Wood
2024-04-07  3:24 ` [PATCH v2] log: add option to search for header or body Max Coplan via GitGitGadget
2024-04-07  6:08   ` Junio C Hamano [this message]
2024-04-07 14:00     ` Phillip Wood

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq4jcdhfht.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=mchcopl@gmail.com \
    --cc=phillip.wood123@gmail.com \
    --cc=strager.nds@gmail.com \
    /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.
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 NNTP newsgroup(s).