libgit2

git_diff_find_options

Version:

Control behavior of rename and copy detection

These options mostly mimic parameters that can be passed to git-diff.

  • rename_threshold is the same as the -M option with a value
  • 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

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 hashes of ranges of data in the file. The default metric is a pretty good similarity approximation that should work fairly well for both text and binary data, and is pretty fast with fixed memory overhead.

Signature

typedef struct git_diff_find_options { unsigned int version unsigned int flags unsigned int rename_threshold unsigned int rename_from_rewrite_threshold unsigned int copy_threshold unsigned int break_rewrite_threshold unsigned int target_limit git_diff_similarity_metric *metric };

Members

unsigned int
version
unsigned int
flags

Combination of git_diff_find_t values (default FIND_RENAMES)

unsigned int
rename_threshold

Similarity to consider a file renamed (default 50)

unsigned int
rename_from_rewrite_threshold

Similarity of modified to be eligible rename source (default 50)

unsigned int
copy_threshold

Similarity to consider a file a copy (default 50)

unsigned int
break_rewrite_threshold

Similarity to split modify into delete/add pair (default 60)

unsigned int
target_limit

Maximum similarity sources to examine (a la diff's -l option or the diff.renameLimit config) (default 200)

metric

Pluggable similarity metric; pass NULL to use internal metric

Parameter To

Versions