Struct git2::DiffFindOptions
source · [−]pub struct DiffFindOptions { /* private fields */ }
Expand description
Control behavior of rename and copy detection
Implementations
sourceimpl DiffFindOptions
impl DiffFindOptions
sourcepub fn new() -> DiffFindOptions
pub fn new() -> DiffFindOptions
Creates a new set of empty diff find options.
All flags and other options are defaulted to false or their otherwise zero equivalents.
sourcepub fn by_config(&mut self) -> &mut DiffFindOptions
pub fn by_config(&mut self) -> &mut DiffFindOptions
Reset all flags back to their unset state, indicating that
diff.renames
should be used instead. This is overridden once any flag
is set.
sourcepub fn renames(&mut self, find: bool) -> &mut DiffFindOptions
pub fn renames(&mut self, find: bool) -> &mut DiffFindOptions
Look for renames?
sourcepub fn renames_from_rewrites(&mut self, find: bool) -> &mut DiffFindOptions
pub fn renames_from_rewrites(&mut self, find: bool) -> &mut DiffFindOptions
Consider old side of modified for renames?
sourcepub fn copies(&mut self, find: bool) -> &mut DiffFindOptions
pub fn copies(&mut self, find: bool) -> &mut DiffFindOptions
Look for copies?
sourcepub fn copies_from_unmodified(&mut self, find: bool) -> &mut DiffFindOptions
pub fn copies_from_unmodified(&mut self, find: bool) -> &mut DiffFindOptions
Consider unmodified as copy sources?
For this to work correctly, use include_unmodified
when the initial
diff is being generated.
sourcepub fn rewrites(&mut self, find: bool) -> &mut DiffFindOptions
pub fn rewrites(&mut self, find: bool) -> &mut DiffFindOptions
Mark significant rewrites for split.
sourcepub fn break_rewrites(&mut self, find: bool) -> &mut DiffFindOptions
pub fn break_rewrites(&mut self, find: bool) -> &mut DiffFindOptions
Actually split large rewrites into delete/add pairs
sourcepub fn for_untracked(&mut self, find: bool) -> &mut DiffFindOptions
pub fn for_untracked(&mut self, find: bool) -> &mut DiffFindOptions
Find renames/copies for untracked items in working directory.
For this to work correctly use the include_untracked
option when the
initial diff is being generated.
sourcepub fn all(&mut self, find: bool) -> &mut DiffFindOptions
pub fn all(&mut self, find: bool) -> &mut DiffFindOptions
Turn on all finding features.
sourcepub fn ignore_leading_whitespace(
&mut self,
ignore: bool
) -> &mut DiffFindOptions
pub fn ignore_leading_whitespace(
&mut self,
ignore: bool
) -> &mut DiffFindOptions
Measure similarity ignoring leading whitespace (default)
sourcepub fn ignore_whitespace(&mut self, ignore: bool) -> &mut DiffFindOptions
pub fn ignore_whitespace(&mut self, ignore: bool) -> &mut DiffFindOptions
Measure similarity ignoring all whitespace
sourcepub fn dont_ignore_whitespace(&mut self, dont: bool) -> &mut DiffFindOptions
pub fn dont_ignore_whitespace(&mut self, dont: bool) -> &mut DiffFindOptions
Measure similarity including all data
sourcepub fn exact_match_only(&mut self, exact: bool) -> &mut DiffFindOptions
pub fn exact_match_only(&mut self, exact: bool) -> &mut DiffFindOptions
Measure similarity only by comparing SHAs (fast and cheap)
sourcepub fn break_rewrites_for_renames_only(
&mut self,
b: bool
) -> &mut DiffFindOptions
pub fn break_rewrites_for_renames_only(
&mut self,
b: bool
) -> &mut DiffFindOptions
Do not break rewrites unless they contribute to a rename.
Normally, break_rewrites
and rewrites
will measure the
self-similarity of modified files and split the ones that have changed a
lot into a delete/add pair. Then the sides of that pair will be
considered candidates for rename and copy detection
If you add this flag in and the split pair is not used for an actual rename or copy, then the modified record will be restored to a regular modified record instead of being split.
sourcepub fn remove_unmodified(&mut self, remove: bool) -> &mut DiffFindOptions
pub fn remove_unmodified(&mut self, remove: bool) -> &mut DiffFindOptions
Remove any unmodified deltas after find_similar is done.
Using copies_from_unmodified
to emulate the --find-copies-harder
behavior requires building a diff with the include_unmodified
flag. If
you do not want unmodified records in the final result, pas this flag to
have them removed.
sourcepub fn rename_threshold(&mut self, thresh: u16) -> &mut DiffFindOptions
pub fn rename_threshold(&mut self, thresh: u16) -> &mut DiffFindOptions
Similarity to consider a file renamed (default 50)
sourcepub fn rename_from_rewrite_threshold(
&mut self,
thresh: u16
) -> &mut DiffFindOptions
pub fn rename_from_rewrite_threshold(
&mut self,
thresh: u16
) -> &mut DiffFindOptions
Similarity of modified to be eligible rename source (default 50)
sourcepub fn copy_threshold(&mut self, thresh: u16) -> &mut DiffFindOptions
pub fn copy_threshold(&mut self, thresh: u16) -> &mut DiffFindOptions
Similarity to consider a file copy (default 50)
sourcepub fn break_rewrite_threshold(&mut self, thresh: u16) -> &mut DiffFindOptions
pub fn break_rewrite_threshold(&mut self, thresh: u16) -> &mut DiffFindOptions
Similarity to split modify into delete/add pair (default 60)
sourcepub fn rename_limit(&mut self, limit: usize) -> &mut DiffFindOptions
pub fn rename_limit(&mut self, limit: usize) -> &mut DiffFindOptions
Maximum similarity sources to examine for a file (somewhat like
git-diff’s -l
option or diff.renameLimit
config)
Defaults to 200
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for DiffFindOptions
impl !Send for DiffFindOptions
impl !Sync for DiffFindOptions
impl Unpin for DiffFindOptions
impl UnwindSafe for DiffFindOptions
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more