summaryrefslogtreecommitdiff
path: root/src/diff.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-05-22 10:37:12 -0700
committerRussell Belfer <rb@github.com>2013-05-22 10:37:12 -0700
commita21cbb12db62426ca789045d5ac5c96ca069f0ea (patch)
tree73885773654c6869003fb4d855383165d14d6a5e /src/diff.h
parent4742148d54334629495eeaf0382e6c9da8786f17 (diff)
downloadlibgit2-a21cbb12db62426ca789045d5ac5c96ca069f0ea.tar.gz
Significant rename detection rewrite
This flips rename detection around so instead of creating a forward mapping from deltas to possible rename targets, instead it creates a reverse mapping, looking at possible targets and trying to find a source that they could have been renamed or copied from. This is important because each output can only have a single source, but a given source could map to multiple outputs (in the form of COPIED records). Additionally, this makes a couple of tweaks to the public rename detection APIs, mostly renaming a couple of options that control the behavior to make more sense and to be more like core Git. I walked through the tests looking at the exact results and updated the expectations based on what I saw. The new code is different from the old because it cannot give some nonsense results (like A was renamed to both B and C) which were part of the outputs previously.
Diffstat (limited to 'src/diff.h')
-rw-r--r--src/diff.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/diff.h b/src/diff.h
index 16df431ed..a9a543ecd 100644
--- a/src/diff.h
+++ b/src/diff.h
@@ -34,10 +34,16 @@ enum {
GIT_DIFF_FLAG__FREE_DATA = (1 << 8), /* internal file data is allocated */
GIT_DIFF_FLAG__UNMAP_DATA = (1 << 9), /* internal file data is mmap'ed */
GIT_DIFF_FLAG__NO_DATA = (1 << 10), /* file data should not be loaded */
- GIT_DIFF_FLAG__TO_DELETE = (1 << 11), /* delete entry during rename det. */
- GIT_DIFF_FLAG__TO_SPLIT = (1 << 12), /* split entry during rename det. */
+
+ GIT_DIFF_FLAG__TO_DELETE = (1 << 16), /* delete entry during rename det. */
+ GIT_DIFF_FLAG__TO_SPLIT = (1 << 17), /* split entry during rename det. */
+ GIT_DIFF_FLAG__IS_RENAME_TARGET = (1 << 18),
+ GIT_DIFF_FLAG__IS_RENAME_SOURCE = (1 << 19),
+ GIT_DIFF_FLAG__HAS_SELF_SIMILARITY = (1 << 20),
};
+#define GIT_DIFF_FLAG__CLEAR_INTERNAL(F) (F) = ((F) & 0x00FFFF)
+
struct git_diff_list {
git_refcount rc;
git_repository *repo;