All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vijay Lakshminarayanan <laksvij@gmail.com>
To: Sebastian Schuberth <sschuberth@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: How to find a commit that introduces (not removes) a string?
Date: Thu, 03 Nov 2011 21:43:21 +0530	[thread overview]
Message-ID: <87zkgdgp5q.fsf@gmail.com> (raw)
In-Reply-To: <j8to8h$vqd$1@dough.gmane.org> (Sebastian Schuberth's message of "Thu, 03 Nov 2011 10:50:18 +0100")

Sebastian Schuberth <sschuberth@gmail.com> writes:

> Hi all,
>
> I know about git log's -S / -G, but I'm unable to make these search through *introduced* strings only. Is there a way to do so?

This appears to work:

$ for ref in `git log -SWORD --pretty=format:"%h"` ; do 
    git log -1 -p $ref | grep WORD | grep -E '^[+]' > /dev/null ; 
    if [ $? -eq 0 ]; then 
        echo $ref; 
    fi ;
  done

substitute WORD for what you're looking for.  Note that it is repeated
twice.

> Thanks!
>
> PS: I also read [1], but although the author claims to be interested in introduced strings only, he seems to be satisfied with -G, which slightly puzzles me.
>
> [1] http://stackoverflow.com/questions/5816134/git-finding-a-commit-that-introduced-a-string

-- 
Cheers
~vijay

  parent reply	other threads:[~2011-11-03 16:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-03  9:50 How to find a commit that introduces (not removes) a string? Sebastian Schuberth
2011-11-03 15:56 ` Neal Kreitzinger
2011-11-03 16:13 ` Vijay Lakshminarayanan [this message]
2011-11-04 10:59 ` Sebastian Schuberth

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=87zkgdgp5q.fsf@gmail.com \
    --to=laksvij@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=sschuberth@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.