Skip to main content

TreeDiffOptions

Struct TreeDiffOptions 

Source
#[non_exhaustive]
pub struct TreeDiffOptions { pub renames: RenameDetection, pub copies: CopyDetection, pub break_rewrites: BreakRewrites, pub show_tree_entries: bool, pub prefix: String, pub threads: Option<ThreadPolicy>, pub pathspec: Option<Pathspec>, pub submodules: SubmoduleIgnoreMode, pub refresh_index_stat: bool, pub for_status: bool, }
Expand description

Options shared by the metadata diffs on Diff: Diff::tree_to_tree, Diff::commits, Diff::index_to_tree, Diff::index_to_worktree, Diff::tree_to_worktree and Diff::detect_renames.

The default compares every path with no rename, copy or break pairing (like git diff-tree -r). Configuration such as diff.renameLimit and core.autocrlf is read from the repository by the handle.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§renames: RenameDetection

Rename pairing (Git -M). Defaults to RenameDetection::Off.

§copies: CopyDetection

Copy pairing (Git -C). Defaults to CopyDetection::Off.

§break_rewrites: BreakRewrites

Break-rewrite splitting (Git -B). Defaults to BreakRewrites::Off.

§show_tree_entries: bool

Also report changed subtrees themselves, not only the paths inside them (Git diff-tree -t). Applies to tree and commit diffs.

§prefix: String

Path prefix prepended to every reported path (empty for the repository root). Applies to tree and commit diffs, whose trees are then subtrees at that prefix.

§threads: Option<ThreadPolicy>

Worker limits for rename scoring and work-tree stat; None uses the repository’s thread_policy.

§pathspec: Option<Pathspec>

Report only paths this pathspec selects; None reports every path. Tree walks skip directories the pathspec cannot reach.

§submodules: SubmoduleIgnoreMode

Which submodule (gitlink) changes to report. SubmoduleIgnoreMode::All omits gitlink paths entirely.

§refresh_index_stat: bool

Index-to-work-tree only: adopt fresh stat data for unchanged entries in the same scan, so a later index write makes the next diff cheaper. The outcome reports whether the in-memory index changed in DiffEntriesResult::index_stat_refreshed.

§for_status: bool

Index-to-work-tree only: status shortcuts. A tracked file whose size changed is reported as modified without being read, with a null work-tree new_oid, and intent-to-add entries are not hashed. Leave off when the contents of the changes are loaded next.

Implementations§

Source§

impl TreeDiffOptions

Source

pub fn with_renames(self, renames: RenameDetection) -> Self

Sets renames.

Source

pub fn with_copies(self, copies: CopyDetection) -> Self

Sets copies.

Source

pub fn with_break_rewrites(self, break_rewrites: BreakRewrites) -> Self

Source

pub fn with_show_tree_entries(self, show_tree_entries: bool) -> Self

Source

pub fn with_prefix(self, prefix: impl Into<String>) -> Self

Sets prefix.

Source

pub fn with_threads(self, threads: Option<ThreadPolicy>) -> Self

Sets threads.

Source

pub fn with_pathspec(self, pathspec: Option<Pathspec>) -> Self

Sets pathspec.

Source

pub fn with_submodules(self, submodules: SubmoduleIgnoreMode) -> Self

Sets submodules.

Source

pub fn with_refresh_index_stat(self, refresh_index_stat: bool) -> Self

Source

pub fn with_for_status(self, for_status: bool) -> Self

Sets for_status.

Trait Implementations§

Source§

impl Clone for TreeDiffOptions

Source§

fn clone(&self) -> Self

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 Debug for TreeDiffOptions

Source§

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

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

impl Default for TreeDiffOptions

Source§

fn default() -> Self

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

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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.