diff options
author | Russell Belfer <rb@github.com> | 2013-05-22 10:37:12 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-05-22 10:37:12 -0700 |
commit | a21cbb12db62426ca789045d5ac5c96ca069f0ea (patch) | |
tree | 73885773654c6869003fb4d855383165d14d6a5e /include/git2/diff.h | |
parent | 4742148d54334629495eeaf0382e6c9da8786f17 (diff) | |
download | libgit2-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 'include/git2/diff.h')
-rw-r--r-- | include/git2/diff.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/include/git2/diff.h b/include/git2/diff.h index 31f6e0591..6939f6a2e 100644 --- a/include/git2/diff.h +++ b/include/git2/diff.h @@ -429,8 +429,8 @@ typedef enum { GIT_DIFF_FIND_AND_BREAK_REWRITES = (GIT_DIFF_FIND_REWRITES | GIT_DIFF_BREAK_REWRITES), - /** consider untracked files as rename/copy targets */ - GIT_DIFF_FIND_FROM_UNTRACKED = (1 << 6), + /** find renames/copies for untracked items in working directory */ + GIT_DIFF_FIND_FOR_UNTRACKED = (1 << 6), /** turn on all finding features */ GIT_DIFF_FIND_ALL = (0x0ff), @@ -469,7 +469,10 @@ typedef struct { * - `copy_threshold` is the same as the -C option with a value * - `rename_from_rewrite_threshold` matches the top of the -B option * - `break_rewrite_threshold` matches the bottom of the -B option - * - `target_limit` matches the -l option (approximately) + * - `rename_limit` is the maximum number of matches to consider for + * a particular file. This is a little different from the `-l` option + * to regular Git because we will still process up to this many matches + * before abandoning the search. * * The `metric` option allows you to plug in a custom similarity metric. * Set it to NULL for the default internal metric which is based on sampling @@ -492,10 +495,10 @@ typedef struct { /** Similarity to split modify into delete/add pair (default 60) */ uint16_t break_rewrite_threshold; - /** Maximum similarity sources to examine (a la diff's `-l` option or - * the `diff.renameLimit` config) (default 200) + /** Maximum similarity sources to examine for a file (somewhat like + * git-diff's `-l` option or `diff.renameLimit` config) (default 200) */ - size_t target_limit; + size_t rename_limit; /** Pluggable similarity metric; pass NULL to use internal metric */ git_diff_similarity_metric *metric; |