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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 03, 2009 at 04:48:52PM +0100, "Peter Valdemar Mørch (Lists)" wrote:

> If a commit removes mention of foo one place and just accidentally  
> happens to add foo somewhere completely unrelated then it wouldn't show  
> up in the output.

Right. But think for a minute about what it means to "move". If I have:

  foo
  bar

and then change it to:

  bar
  foo

Did "foo" move, or did "bar"?

So I'm not sure that what you're asking for is necessarily well-defined.

> Would be neat with a feature that does what I thought -S did tho...

You can do:

  git log -z -p | perl -0ne 'print if /^[-+].*string/m' | tr '\0' '\n'

which I think is what you want (show any commit that has changed lines
that contain the string). But of course you will lose colorizing and
automatic paging, and it's a lot slower. And note that whether it finds
the example above will depend on how the diff is generated: did "foo"
move or did "bar"? But in practice it will generally find what you are
looking for.

> Thanks, Jeff, for both the answer and the documentation patch.

You're welcome.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux