Subject: Re: git log -Sfoo ignores indentation (whitespace?) changes...

From: Junio C Hamano <[email-masked]>
Date: Tue, 03 Mar 2009 07:58:56 -0800

"Peter Valdemar Mørch (Lists)"  <[email-masked]> writes:

> 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!)

No.  You should be running "git log -p" which spawns "less" and then type
/foo to jump to the occurrences of "foo".

The pickaxe -Sfoo looks for a filepair that contains different number
of substring "foo".  It was designed as a basic building block for a very
different kind of Porcelain, whose final shape would look like the tool
described in http://article.gmane.org/gmane.comp.version-control.git/217,
but not yet written by anybody yet.

And I think it might be the good topic for a SoC project.  From some GUI,
you let the user grab a block of text, feed it to "log -S<that multi-line
string> -1" to find where that block of text last changed, and inspect the
commit you have found very carefully using things like "git grep" to find
other places in the commit that could be related to the change of the
block of text, present all of them to the user.  From there you let the
user dig deeper in the history by choosing what to look for next, most
likely giving the default selection to the block of text that roughly
corresponds to the original selection.

To make the iteration fast for this use case, the pickaxe cannot afford to
actually run diff and then grep inside the diff output (which is what you
would be doing with "log -p | less" and looking for your string in it).