#[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
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.renames: RenameDetectionRename pairing (Git -M). Defaults to RenameDetection::Off.
copies: CopyDetectionCopy pairing (Git -C). Defaults to CopyDetection::Off.
break_rewrites: BreakRewritesBreak-rewrite splitting (Git -B). Defaults to BreakRewrites::Off.
show_tree_entries: boolAlso report changed subtrees themselves, not only the paths inside them (Git
diff-tree -t). Applies to tree and commit diffs.
prefix: StringPath 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: SubmoduleIgnoreModeWhich submodule (gitlink) changes to report. SubmoduleIgnoreMode::All omits gitlink
paths entirely.
refresh_index_stat: boolIndex-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: boolIndex-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
impl TreeDiffOptions
Sourcepub fn with_renames(self, renames: RenameDetection) -> Self
pub fn with_renames(self, renames: RenameDetection) -> Self
Sets renames.
Sourcepub fn with_copies(self, copies: CopyDetection) -> Self
pub fn with_copies(self, copies: CopyDetection) -> Self
Sets copies.
Sourcepub fn with_break_rewrites(self, break_rewrites: BreakRewrites) -> Self
pub fn with_break_rewrites(self, break_rewrites: BreakRewrites) -> Self
Sets break_rewrites.
Sourcepub fn with_show_tree_entries(self, show_tree_entries: bool) -> Self
pub fn with_show_tree_entries(self, show_tree_entries: bool) -> Self
Sets show_tree_entries.
Sourcepub fn with_prefix(self, prefix: impl Into<String>) -> Self
pub fn with_prefix(self, prefix: impl Into<String>) -> Self
Sets prefix.
Sourcepub fn with_threads(self, threads: Option<ThreadPolicy>) -> Self
pub fn with_threads(self, threads: Option<ThreadPolicy>) -> Self
Sets threads.
Sourcepub fn with_pathspec(self, pathspec: Option<Pathspec>) -> Self
pub fn with_pathspec(self, pathspec: Option<Pathspec>) -> Self
Sets pathspec.
Sourcepub fn with_submodules(self, submodules: SubmoduleIgnoreMode) -> Self
pub fn with_submodules(self, submodules: SubmoduleIgnoreMode) -> Self
Sets submodules.
Sourcepub fn with_refresh_index_stat(self, refresh_index_stat: bool) -> Self
pub fn with_refresh_index_stat(self, refresh_index_stat: bool) -> Self
Sets refresh_index_stat.
Sourcepub fn with_for_status(self, for_status: bool) -> Self
pub fn with_for_status(self, for_status: bool) -> Self
Sets for_status.