From: Jonathan Nieder <jrnieder@gmail.com>
To: Chris Smith <smiles@worksmail.net>
Cc: git@vger.kernel.org
Subject: gitk: add "grep diff" selection criterion (Re: find commit adding/removing could use changing option)
Date: Fri, 16 Jul 2010 12:28:06 -0500 [thread overview]
Message-ID: <20100716172806.GA15491@burratino> (raw)
In-Reply-To: <D163BB49BCC4479AB3E4BA4F87826184@csmith>
Hi Chris,
Chris Smith wrote:
> One thing I find myself wishing for is the ability to find a line that has
> been modified by using gitk. It seems to me that if I have the following in a
> diff
>
> - def foo(this)
> + def foo(this, that=False)
>
> that I can't find the line by searching for foo.
Ah, so you want a cousin to ‘log -S’ that /does/ search through
diffs. See [1].
As that thread explains, it is doable from the commandline already,
though not in a nicely packaged form. But what about from gitk?
A possible hack would be to teach gitk to add arbitrary criteria to
the end of the ‘git diff-tree’ command line[2]. In this case, the
criterion would be ‘| search-diff $term’, where search-diff is a
script something like the following:
#!/bin/sh
while read -r commit
do
if
git diff-tree -p -c "$commit" | grep -q "$@"
then
printf '%s\n' "$commit"
fi
done
If that proves useful, afterwards one could teach ‘diff-tree’ to do
the check itself, which would allow commands like
git log --search-diff=foo
too.
Thoughts?
Jonathan
[1] http://thread.gmane.org/gmane.comp.version-control.git/122478
[2] You can find the code one would need to touch for this by
searching for gdtargs and gdttype in the gitk script.
next parent reply other threads:[~2010-07-16 17:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <D163BB49BCC4479AB3E4BA4F87826184@csmith>
2010-07-16 17:28 ` Jonathan Nieder [this message]
2010-07-19 22:44 ` gitk: add "grep diff" selection criterion (Re: find commit adding/removing could use changing option) Junio C Hamano
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=20100716172806.GA15491@burratino \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=smiles@worksmail.net \
/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).