Re: [PATCH] feat(log): add option to search for header or body to `git log`
- From
- Phillip 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