# Not-quite-a-bug in pickaxe

3 messages from 2008-11-24 to 2008-11-24. Participants: Johannes Schindelin, Mikael Magnusson.
Thread: https://gitlist.dev/t/16440

## Johannes Schindelin, 2008-11-24 11:43

Subject: Not-quite-a-bug in pickaxe
Message-ID: <alpine.DEB.1.00.0811241238450.30769@pacific.mpi-cbg.de>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0811241238450.30769%40pacific.mpi-cbg.de

```
Hi people,

I do not know if I hit that behavior before, but now it hit me big time: 
if a commit moves a certain string from one place to another, "git log 
-S<string>" does not pick up that commit.  The code responsible for this 
is in diffcore-pickaxe.c:

                        else if (!diff_unmodified_pair(p) &&
                                 contains(p->one, needle, len, regexp) !=
                                 contains(p->two, needle, len, regexp))
                                has_changes++;

Basically, the "contains()" method says how often the needle was found, 
and pickaxe just assumes that a move of a string is not interesting 
enough.

Now, this behavior is probably intended, as searching files is much 
cheaper than generating the diffs between them, yet it is something you'll 
have to keep in mind when using "-S".

Ciao,
Dscho

```

## Mikael Magnusson, 2008-11-24 15:08

Subject: Re: Not-quite-a-bug in pickaxe
Message-ID: <237967ef0811240708t58d48c84ud0626ba3aaed47b6@mail.gmail.com>
URL: https://gitlist.dev/e/237967ef0811240708t58d48c84ud0626ba3aaed47b6%40mail.gmail.com
In-Reply-To: <alpine.DEB.1.00.0811241238450.30769@pacific.mpi-cbg.de>

```
2008/11/24 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
> Hi people,
>
> I do not know if I hit that behavior before,

I'm pretty sure it has,
http://thread.gmane.org/gmane.comp.version-control.git/100113/focus=100115
(at least i think that's the same case?)

> but now it hit me big time:
> if a commit moves a certain string from one place to another, "git log
> -S<string>" does not pick up that commit.  The code responsible for this
> is in diffcore-pickaxe.c:
>
>                        else if (!diff_unmodified_pair(p) &&
>                                 contains(p->one, needle, len, regexp) !=
>                                 contains(p->two, needle, len, regexp))
>                                has_changes++;
>
> Basically, the "contains()" method says how often the needle was found,
> and pickaxe just assumes that a move of a string is not interesting
> enough.
>
> Now, this behavior is probably intended, as searching files is much
> cheaper than generating the diffs between them, yet it is something you'll
> have to keep in mind when using "-S".

-- 
Mikael Magnusson

```

## Johannes Schindelin, 2008-11-24 17:36

Subject: Re: Not-quite-a-bug in pickaxe
Message-ID: <alpine.DEB.1.00.0811241836050.30769@pacific.mpi-cbg.de>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0811241836050.30769%40pacific.mpi-cbg.de
In-Reply-To: <237967ef0811240708t58d48c84ud0626ba3aaed47b6@mail.gmail.com>

```
Hi,

On Mon, 24 Nov 2008, Mikael Magnusson wrote:

> 2008/11/24 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
>
> > I do not know if I hit that behavior before,
> 
> I'm pretty sure it has, 
> http://thread.gmane.org/gmane.comp.version-control.git/100113/focus=100115 
> (at least i think that's the same case?)

Ah, I finally got around to read Junio's reply.  It did not stick back 
then.

Thanks,
Dscho

```
