git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: Jeff King <peff@peff.net>
Cc: "\"Peter Valdemar Mørch (Lists)\"" <4ux6as402@sneakemail.com>,
	git@vger.kernel.org
Subject: Re: git log -Sfoo ignores indentation (whitespace?) changes...
Date: Tue, 03 Mar 2009 17:02:06 +0100	[thread overview]
Message-ID: <49AD547E.7030703@drmicha.warpmail.net> (raw)
In-Reply-To: <20090303152333.GB24593@coredump.intra.peff.net>

Jeff King venit, vidit, dixit 03.03.2009 16:23:
> On Tue, Mar 03, 2009 at 03:28:08PM +0100, "Peter Valdemar Mørch (Lists)" wrote:
> 
>> Commits where only the indentation of 'foo' is changed are not shown with 
>> "git log -Sfoo". Is there any way to force showing them along with other 
>> changes involving foo? (E.g. for python, indentation matters!)
>>
>> Why doesn't the second commit show up in the following?
> 
> Because you misunderstand how "-S" works (but don't worry, it's not your
> fault -- the documentation is somewhat misleading). The documentation says:
> 
>   -S<string>
>     Look for differences that contain the change in <string>.
> 
> but what it actually does is find changes where the string was introduced
> or removed. So it literally counts the number of occurences before and
> after the commit, and the commit is interesting if they are not equal.

Hmm. The diffcore doc sounds more like if the filepair is picked if
#before > 0 and #after = 0, but not if #after > 0.

In any case, the pickaxe can't detect moving around of strings, right?

>> # Create text containing 'line' without whitespace
>> $ echo 'line' > text
>> $ git add text
>> $ git commit -m "first" text
>>
>> # Here, I add one space of indentation in front of 'line'
>> $ echo ' line' > text
>> $ git commit -m "second" text
> 
> So "line" wasn't actually changed. It just happens to be on a line which
> _did_ change.
> 
>> I would like to see both "first" and "second" somehow - can I do that?
> 
> I don't think there's an easy way to do this right now; you would need
> to do "git log -p" and search through the output to get what you want (I
> often do this just using the pager's search function).

If you know what your are looking for you can do variations on

git log -S'line| line' --pickaxe-regex

which seems to be different from

git log -S'line' -S' line'

which was my first attempt...

Michael

  parent reply	other threads:[~2009-03-03 16:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-03 14:28 git log -Sfoo ignores indentation (whitespace?) changes "Peter Valdemar Mørch (Lists)"
2009-03-03 15:23 ` Jeff King
2009-03-03 15:40   ` [PATCH] doc: clarify how -S works Jeff King
2009-03-03 16:12     ` John Tapsell
2009-03-03 16:19       ` Jeff King
2009-03-03 16:22         ` John Tapsell
2009-03-03 16:42     ` Junio C Hamano
2009-03-03 17:11       ` Jeff King
2009-03-03 17:39         ` John Tapsell
2009-03-03 17:57           ` Jeff King
2009-03-03 18:24           ` Junio C Hamano
2009-03-03 15:48   ` git log -Sfoo ignores indentation (whitespace?) changes "Peter Valdemar Mørch (Lists)"
2009-03-03 16:03     ` Jeff King
2009-03-03 16:21     ` Junio C Hamano
2009-03-03 16:02   ` Michael J Gruber [this message]
2009-03-03 16:25     ` Jeff King
2009-03-03 15:58 ` 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=49AD547E.7030703@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=4ux6as402@sneakemail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.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).