* Bug?: 'git log --find-copies' doesn't match 'git log --follow <rev> -- path/to/file'
@ 2011-09-30 15:32 Alexander Pepper
2011-09-30 21:38 ` Jeff King
0 siblings, 1 reply; 4+ messages in thread
From: Alexander Pepper @ 2011-09-30 15:32 UTC (permalink / raw)
To: git
Hello Again.
I'm not really sure, if this is a bug or if I am missing something, but the following is quite annoying:
$ git version
git version 1.7.6.3
$ git clone https://github.com/voldemort/voldemort.git
$ cd voldemort
$ git log --numstat --find-copies dd4e90f9
...
3 15 contrib/ec2-testing/src/java/voldemort/utils/{StopClusterException.java => ClusterOperation.java}
$ git log --numstat dd4e90f9 -- contrib/ec2-testing/src/java/voldemort/utils/ClusterOperation.java
...
23 0 contrib/ec2-testing/src/java/voldemort/utils/ClusterOperation.java
$ git log --numstat --follow dd4e90f9 -- contrib/ec2-testing/src/java/voldemort/utils/ClusterOperation.java
...
6 10 src/java/voldemort/annotations/concurrency/Immutable.java => contrib/ec2-testing/src/java/voldemort/utils/ClusterOperation.java
So git log with copy and rename detection on (--find-copies) tells me, that the file StopClusterException.java is copied to ClusterOperation.java. But If I ask git log for that specific file with --follow git claims a copy from Immutable.java to ClusterOperation.java!
I understand, that git doesn't record renames and copies, but only detects it afterwords. But at least I would expect, that git detects the same thing consistently between to (quite) alike flags.
I also tried adding "--find-copies" and "--find-copies-harder" to 'git log --numstat --follow dd4e90f9', but they also result in claiming Immutable.java as the origin of the copy.
Is there a flag to get consistent results between the two or is this really a bug?
Greetings from Berlin
Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug?: 'git log --find-copies' doesn't match 'git log --follow <rev> -- path/to/file'
2011-09-30 15:32 Bug?: 'git log --find-copies' doesn't match 'git log --follow <rev> -- path/to/file' Alexander Pepper
@ 2011-09-30 21:38 ` Jeff King
2011-10-02 15:10 ` Alexander Pepper
0 siblings, 1 reply; 4+ messages in thread
From: Jeff King @ 2011-09-30 21:38 UTC (permalink / raw)
To: Alexander Pepper; +Cc: git
On Fri, Sep 30, 2011 at 05:32:38PM +0200, Alexander Pepper wrote:
> So git log with copy and rename detection on (--find-copies) tells me,
> that the file StopClusterException.java is copied to
> ClusterOperation.java. But If I ask git log for that specific file
> with --follow git claims a copy from Immutable.java to
> ClusterOperation.java!
I think that --follow uses --find-copies-harder. Did you try:
git log --numstat --find-copies-harder dd4e90f9
? Does it find Immutable.java as the source?
-Peff
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug?: 'git log --find-copies' doesn't match 'git log --follow <rev> -- path/to/file'
2011-09-30 21:38 ` Jeff King
@ 2011-10-02 15:10 ` Alexander Pepper
2011-10-02 15:25 ` Jeff King
0 siblings, 1 reply; 4+ messages in thread
From: Alexander Pepper @ 2011-10-02 15:10 UTC (permalink / raw)
To: Jeff King; +Cc: git
Am 30.09.2011 um 23:38 schrieb Jeff King:
> On Fri, Sep 30, 2011 at 05:32:38PM +0200, Alexander Pepper wrote:
>
>> So git log with copy and rename detection on (--find-copies) tells me,
>> that the file StopClusterException.java is copied to
>> ClusterOperation.java. But If I ask git log for that specific file
>> with --follow git claims a copy from Immutable.java to
>> ClusterOperation.java!
>
> I think that --follow uses --find-copies-harder. Did you try:
>
> git log --numstat --find-copies-harder dd4e90f9
>
> ? Does it find Immutable.java as the source?
>
> -Peff
Using 'git log --numstat --find-copies-harder dd4e90f9' yields "immutable.java" as you expected:
$ git log --numstat --find-copies-harder dd4e90f9
[...]
6 10 src/java/voldemort/annotations/concurrency/Immutable.java => contrib/ec2-testing/src/java/voldemort/utils/ClusterOperation.java
So is there a way to tell --follow to only use --find-copies instead of --find-copies harder? And what is the advantage of using "--find-copies-harder" over "--find-copies"?
Greetings from Berlin
Alex
--
Alexander Pepper
pepper@inf.fu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug?: 'git log --find-copies' doesn't match 'git log --follow <rev> -- path/to/file'
2011-10-02 15:10 ` Alexander Pepper
@ 2011-10-02 15:25 ` Jeff King
0 siblings, 0 replies; 4+ messages in thread
From: Jeff King @ 2011-10-02 15:25 UTC (permalink / raw)
To: Alexander Pepper; +Cc: git
On Sun, Oct 02, 2011 at 05:10:26PM +0200, Alexander Pepper wrote:
> Using 'git log --numstat --find-copies-harder dd4e90f9' yields "immutable.java" as you expected:
>
> $ git log --numstat --find-copies-harder dd4e90f9
> [...]
> 6 10 src/java/voldemort/annotations/concurrency/Immutable.java => contrib/ec2-testing/src/java/voldemort/utils/ClusterOperation.java
OK. That at least explains what's going on.
> So is there a way to tell --follow to only use --find-copies instead
> of --find-copies harder?
No, it's hard-coded.
> And what is the advantage of using "--find-copies-harder" over "--find-copies"?
It finds more copies. The rename detection works like this:
--find-renames: for each newly-created file, consider any deleted
files as possible sources
--find-copies: like above, but also consider any modified files as
possible sources
--find-copies-harder: like above, but consider any file in the
repository as a possible source
So in theory --find-copies-harder is the most accurate, but it is also
the most expensive. We can afford to do it for --follow since we're only
considering a small subset of the possible destinations.
So git is saying that your immutable.java is actually a better match;
it's just that we don't usually find it because it wasn't modified in
the same commit. Have you looked at the contents? Is it actually a
better match, or is git wrong?
-Peff
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-10-02 15:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-30 15:32 Bug?: 'git log --find-copies' doesn't match 'git log --follow <rev> -- path/to/file' Alexander Pepper
2011-09-30 21:38 ` Jeff King
2011-10-02 15:10 ` Alexander Pepper
2011-10-02 15:25 ` Jeff King
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).