git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Subject: Re: Has anyone tried to implement git grep --blame?
Date: Thu, 30 May 2013 10:12:29 +0000 (UTC)	[thread overview]
Message-ID: <loom.20130530T121036-210@post.gmane.org> (raw)
In-Reply-To: CACBZZX5R=zaNBv4OGh30dxj+BAi26jDxDBO5pZTQ2QxGUB6WXw@mail.gmail.com

Ævar Arnfjörð Bjarmason <avarab <at> gmail.com> writes:

> This would be so much more convenient if git-grep supported it natively:
> 
> $ git grep -n 'if \(0\)' | perl -pe's/([^:]+):([^:]+).*/`git blame -L
> $2,$2 $1`/se'
> d18f76dc (Ævar Arnfjörð Bjarmason 2010-08-17 09:24:38 +0000 2278)   if (0)
> 65648283 (David Brown 2007-12-25 19:56:29 -0800 433) if (0) {
> 
> I.e. with all the coloring/pager interaction. Some Googling around
> reveals people piping things to git-blame like that, but has anyone
> made a stab at a smarter implementation (that would know to blame the
> whole file if it had lots of hits etc..).
> 
> Don't know if I have time myself, but I'd be very pleased if someone
> hacked that up.

Errr... 'git blame -L' supports regexps as starting and ending point,
see git-blame(1) manpage:

    git blame -L '/^sub hello {/,/^}$/' foo

It does not color matching, though...
-- 
Jakub Narębski

      reply	other threads:[~2013-05-30 10:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-29  5:41 Has anyone tried to implement git grep --blame? Ævar Arnfjörð Bjarmason
2013-05-30 10:12 ` Jakub Narebski [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=loom.20130530T121036-210@post.gmane.org \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    /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).