git-diff/git-diff-files: Turn off copy-detection?
Hi,
I'm trying to diff the header files between two version of a repo, to do an ABI review, but get too many diffs from 'similar copy', which makes the review hard. These are generally unrelated files, but due to large copyright header, and spaces, the actual changes are not large enough to be detected as new files. I'd therefore like to turn off copy detection completely, or at least set some kind of threshold before a file is considered a copy in the diff.
Doing a 'git diff origin/4.5..origin/4.6 -- src/corelib' gives me this excerpt:
origin/4.6/src/corelib/animation/qabstractanimation.h renamed from origin/4.5/src/corelib/tools/qtimeline.h +0 -0
...
origin/4.6/src/corelib/animation/qanimationgroup.h renamed from origin/4.5/src/corelib/kernel/qsystemsemaphore.h +0 -0
...
origin/4.6/src/corelib/animation/qparallelanimationgroup.h renamed from origin/4.5/src/corelib/kernel/qsystemsemaphore.h +0 -0
...
origin/4.6/src/corelib/animation/qpauseanimation.h renamed from origin/4.5/src/corelib/io/qresource_iterator_p.h +0 -0
...
origin/4.6/src/corelib/animation/qpropertyanimation.h renamed from origin/4.5/src/corelib/kernel/qsystemsemaphore.h +0 -0
...
origin/4.6/src/corelib/animation/qsequentialanimationgroup.h renamed from origin/4.5/src/corelib/kernel/qsystemsemaphore.h +0 -0
...
origin/4.6/src/corelib/animation/qvariantanimation.h new file +0 -0
...
origin/4.6/src/corelib/arch/qatomic_arch.h renamed from origin/4.5/src/corelib/arch/qatomic_arch.h +0 -0
So, not even related. They should really had shown up as new files, IMO. (I guess git stores the creation of the file as a delta of the indicated 'copy', but in this case I don't care about that :)
Thanks!
--
.marius
Quoted 3 lines · Marius Storm-Olsen
So, not even related. They should really had shown up as new files, IMO. (I guess git stores the creation of the file as a delta of the indicated 'copy', but in this case I don't care about that :)
No, it does not (as long as we are not talking about packfiles). AFAIK copy detection is disabled by default, so probably you have a setting that enables it for you and you forgot about it. Are you sure you don't have any settings like diff.renames = copies?
Quoted 8 lines · Marius Storm-Olsen
I'm trying to diff the header files between two version of a repo, to do an ABI review, but get too many diffs from 'similar copy', which makes the review hard. These are generally unrelated files, but due to large copyright header, and spaces, the actual changes are not large enough to be detected as new files. I'd therefore like to turn off copy detection completely, or at least set some kind of threshold before a file is considered a copy in the diff.
Quoted 7 lines
Doing a 'git diff origin/4.5..origin/4.6 -- src/corelib' gives me this excerpt:
(quoted diff) +0
-0
origin/4.6/src/corelib/animation/qabstractanimation.hsimilarity index 58%
...
You must have the config variable diff.renames set. But I would not expect that this setting applies to 'git diff-files', only to 'git diff'.
You can also try 'git diff -C99 -M99' if you don't want to unset the config variable.
-- Hannes
Johannes Sixt said the following on 29.09.2009 15:40:
Quoted 11 lines
Quoted 7 lines · Marius Storm-Olsen
Doing a 'git diff origin/4.5..origin/4.6 -- src/corelib' gives me this excerpt:
(quoted diff) +0
-0
origin/4.6/src/corelib/animation/qabstractanimation.hsimilarity index 58%
...You must have the config variable diff.renames set. But I would not expect that this setting applies to 'git diff-files', only to 'git diff'.
$ git config diff.renames copies
That's it, thanks! Strange that nothing in the git-diff documentation pointed me in this direction? Obviously I didn't connect the dots between 'copy' and 'renames' either..
Quoted 2 lines
You can also try 'git diff -C99 -M99' if you don't want to unset the config variable.
Thanks, I'll add that to my review script. Much appreciated!
--
.marius
Quoted 6 lines · Marius Storm-Olsen
$ git config diff.renames copiesThat's it, thanks! Strange that nothing in the git-diff documentation pointed me in this direction? Obviously I didn't connect the dots between 'copy' and 'renames' either..
See man git-config. :)