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

Re: [PATCH] feat(log): add option to search for header or body to `git log`

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Apr 6, 2024, 14:04 UTC
Message-ID
<c93817ba-5945-4ec0-9775-5621481b972c@gmail.com>
In-Reply-To
<pull.1710.git.1712353687464.gitgitgadget@gmail.com>
Hi Max
On 05/04/2024 22:48, Max Coplan via GitGitGadget wrote:
Show 11 quoted lines
> From: =?UTF-8?q?Max=20=F0=9F=91=A8=F0=9F=8F=BD=E2=80=8D=F0=9F=92=BB=20Copl?=
>   =?UTF-8?q?an?= <mchcopl@gmail.com>
> 
> Note to reviewer: I hate the name `--header-or`!  Please help me come up
> with a better name.
> 
> Summary:
> 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 think that having a way to find all the commits that are authored by, or have a specific trailer naming someone is a good idea. I'm not sure about combining "--author" with "--grep" to do it though. Perhaps we could design a new option (tentatively called "--indent") that allows the user to specify a name and which trailers and commit headers (author and/or committer) to match.

A couple of house keeping notes. We do not use the "feat(...)" style of commit messages in this project. The subject line should just start with "log: " the rest of the subject looks fine. I think everything under the "Summary:" line above does a good job of explaining why the change is useful which is great. We tend to avoid emoji's in peoples names as well.

 > [...]
> +test_expect_success 'log --grep --author --header-or uses union' '
> +	# grep matches only third and fourth
> +	# author matches only initial and third

I'm a bit confused by this comment as we seem to only expect "third" and "fourth" below - what happened to "initial"?

> +	git log --author="A U Thor" --grep=r --header-or --format=%s >actual &&
> +	{
> +	    echo fourth && echo third
> +	} >expect &&
We have a test helper to help with this
     test_write_lines fourth third >expect
Best Wishes
Phillip
Previous: Max Coplan via GitGitGadgetNext: Max Coplan via GitGitGadget
Message 2 of 5 in “feat(log): add option to search for header or body to `git log`”
  1. feat(log): add option to search for header or body to `git log`Max Coplan via GitGitGadget, Apr 5, 2024
  2. Phillip WoodApr 6, 2024
  3. log: add option to search for header or bodyMax Coplan via GitGitGadget, Apr 7, 2024
  4. Junio C HamanoApr 7, 2024
  5. Phillip WoodApr 7, 2024

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.