Skip to main content

RenameDetectionOptions

Struct RenameDetectionOptions 

Source
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: DiffNameStatusOptions

The base name-status options (rename/copy enable flags, find-copies-harder, rename-empty). Exact detection honours these exactly as before.

§detect_inexact: bool

Enable inexact (content-similarity) detection. When false, only exact OID matches are detected, matching the legacy *_with_options behaviour.

§rename_threshold: u8

Minimum similarity percentage (0..=100) for an inexact rename. Pairs scoring below this are not reported as renames. Defaults to DEFAULT_RENAME_THRESHOLD.

§copy_threshold: u8

Minimum 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: usize

Cap 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

Source

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

Source§

fn clone(&self) -> RenameDetectionOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RenameDetectionOptions

Source§

impl Debug for RenameDetectionOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RenameDetectionOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for RenameDetectionOptions

Source§

impl PartialEq for RenameDetectionOptions

Source§

fn eq(&self, other: &RenameDetectionOptions) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for RenameDetectionOptions

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.