pub struct RenameDetectionOptions {
pub base: DiffNameStatusOptions,
pub detect_inexact: bool,
pub rename_threshold: u8,
pub copy_threshold: u8,
pub rename_limit: usize,
}Expand description
Options controlling inexact (similarity-based) rename and copy detection,
layered additively on top of DiffNameStatusOptions.
This is a separate struct rather than new fields on DiffNameStatusOptions
so that existing callers — which build DiffNameStatusOptions with a struct
literal — keep compiling unchanged. Code that wants inexact detection uses
the *_with_rename_options entry points and this type instead.
Default preserves the existing behaviour exactly: detect_inexact is
false, so unless a caller opts in, only exact-OID rename/copy detection
runs (identical to the plain *_with_options functions). When
detect_inexact is enabled, files added on one side are paired with the most
similar deleted/modified file on the other side whose similarity meets the
relevant threshold; exact-OID matches still take priority and are always
scored 100.
Fields§
§base: DiffNameStatusOptionsThe base name-status options (rename/copy enable flags, find-copies-harder, rename-empty). Exact detection honours these exactly as before.
detect_inexact: boolEnable inexact (content-similarity) detection. When false, only exact
OID matches are detected, matching the legacy *_with_options behaviour.
rename_threshold: u8Minimum similarity percentage (0..=100) for an inexact rename. Pairs
scoring below this are not reported as renames. Defaults to
DEFAULT_RENAME_THRESHOLD.
copy_threshold: u8Minimum similarity percentage (0..=100) for an inexact copy. Defaults
to DEFAULT_RENAME_THRESHOLD; git uses the same default for -C as for
-M unless -C<n> overrides it.
rename_limit: usizeCap on the inexact rename matrix (git’s diff.renameLimit /
merge.renameLimit): when the number of candidate sources times the
number of candidate destinations exceeds rename_limit², inexact
detection is skipped entirely (only exact-OID renames survive). 0 means
unlimited — git’s too_many_rename_candidates treats a non-positive limit
the same way.
Implementations§
Source§impl RenameDetectionOptions
impl RenameDetectionOptions
Sourcepub fn inexact(base: DiffNameStatusOptions) -> Self
pub fn inexact(base: DiffNameStatusOptions) -> Self
Build inexact-enabled options from a base DiffNameStatusOptions, using
the default thresholds for both renames and copies.
Trait Implementations§
Source§impl Clone for RenameDetectionOptions
impl Clone for RenameDetectionOptions
Source§fn clone(&self) -> RenameDetectionOptions
fn clone(&self) -> RenameDetectionOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for RenameDetectionOptions
Source§impl Debug for RenameDetectionOptions
impl Debug for RenameDetectionOptions
Source§impl Default for RenameDetectionOptions
impl Default for RenameDetectionOptions
impl Eq for RenameDetectionOptions
Source§impl PartialEq for RenameDetectionOptions
impl PartialEq for RenameDetectionOptions
Source§fn eq(&self, other: &RenameDetectionOptions) -> bool
fn eq(&self, other: &RenameDetectionOptions) -> bool
self and other values to be equal, and is used by ==.