From: Mirko Faina <mroik@delayed.space>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Mirko Faina <mroik@delayed.space>
Subject: Re: [RFD] not grep but not log -S
Date: Tue, 14 Apr 2026 00:04:39 +0200 [thread overview]
Message-ID: <ad1oMLdO4ZMVo__O@exploit> (raw)
In-Reply-To: <xmqq4ileh822.fsf@gitster.g>
On Mon, Apr 13, 2026 at 02:19:49PM -0700, Junio C Hamano wrote:
> may give something close to what I want, but it makes me feel dirty
> that I have to _guess_ how many is sufficient.
If you know when it is introduced and when it goes away you don't have
to guess at all. You should be able to log start..end (and filtering the
appropiate subject line).
topic=jc/test-set-e-clean
git log $(git log --oneline -S$topic --reverse whats-cooking.txt | \
head -n1 | cut -d \ -f 1)~1..$(git log --oneline -S$topic \
--max-count=1 whats-cooking.txt | cut -d \ -f 1)
I know it's a bit long but this way you won't have to guess (and I'm
assuming is going in a script anyway). The log command to get the first
and last occurrence would go on their own line as well.
last=$(git log --oneline -Sjc/test-set-e-clean --max-count=1 \
whats-cooking.txt | cut -d \ -f 1)
first=$(git log --oneline -Sjc/test-set-e-clean --reverse \
whats-cooking.txt | head -n1 | cut -d \ -f 1)
git log $first~1..$last
I would've used --max-count=1 to get just the first occurrence instead
of using 'head', but '--reverse', '-S' and '--max-count' don't interact
in the way a user might obviously presume (and I'm assuming it's a bug).
P.S. sorry if I end up in your inbox twice, I forgot to cc the list.
prev parent reply other threads:[~2026-04-13 22:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-13 21:19 [RFD] not grep but not log -S Junio C Hamano
2026-04-13 22:04 ` Mirko Faina [this message]
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=ad1oMLdO4ZMVo__O@exploit \
--to=mroik@delayed.space \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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