Struct git2::DiffOptions
source · [−]pub struct DiffOptions { /* private fields */ }
Expand description
Structure describing options about how the diff should be executed.
Implementations
sourceimpl DiffOptions
impl DiffOptions
sourcepub fn new() -> DiffOptions
pub fn new() -> DiffOptions
Creates a new set of empty diff options.
All flags and other options are defaulted to false or their otherwise zero equivalents.
sourcepub fn reverse(&mut self, reverse: bool) -> &mut DiffOptions
pub fn reverse(&mut self, reverse: bool) -> &mut DiffOptions
Flag indicating whether the sides of the diff will be reversed.
sourcepub fn include_ignored(&mut self, include: bool) -> &mut DiffOptions
pub fn include_ignored(&mut self, include: bool) -> &mut DiffOptions
Flag indicating whether ignored files are included.
sourcepub fn recurse_ignored_dirs(&mut self, recurse: bool) -> &mut DiffOptions
pub fn recurse_ignored_dirs(&mut self, recurse: bool) -> &mut DiffOptions
Flag indicating whether ignored directories are traversed deeply or not.
sourcepub fn include_untracked(&mut self, include: bool) -> &mut DiffOptions
pub fn include_untracked(&mut self, include: bool) -> &mut DiffOptions
Flag indicating whether untracked files are in the diff
sourcepub fn recurse_untracked_dirs(&mut self, recurse: bool) -> &mut DiffOptions
pub fn recurse_untracked_dirs(&mut self, recurse: bool) -> &mut DiffOptions
Flag indicating whether untracked directories are traversed deeply or not.
sourcepub fn include_unmodified(&mut self, include: bool) -> &mut DiffOptions
pub fn include_unmodified(&mut self, include: bool) -> &mut DiffOptions
Flag indicating whether unmodified files are in the diff.
sourcepub fn include_typechange(&mut self, include: bool) -> &mut DiffOptions
pub fn include_typechange(&mut self, include: bool) -> &mut DiffOptions
If enabled, then Typechange delta records are generated.
sourcepub fn include_typechange_trees(&mut self, include: bool) -> &mut DiffOptions
pub fn include_typechange_trees(&mut self, include: bool) -> &mut DiffOptions
Event with include_typechange
, the tree returned generally shows a
deleted blob. This flag correctly labels the tree transitions as a
typechange record with the new_file
’s mode set to tree.
Note that the tree SHA will not be available.
sourcepub fn ignore_filemode(&mut self, ignore: bool) -> &mut DiffOptions
pub fn ignore_filemode(&mut self, ignore: bool) -> &mut DiffOptions
Flag indicating whether file mode changes are ignored.
sourcepub fn ignore_submodules(&mut self, ignore: bool) -> &mut DiffOptions
pub fn ignore_submodules(&mut self, ignore: bool) -> &mut DiffOptions
Flag indicating whether all submodules should be treated as unmodified.
sourcepub fn ignore_case(&mut self, ignore: bool) -> &mut DiffOptions
pub fn ignore_case(&mut self, ignore: bool) -> &mut DiffOptions
Flag indicating whether case insensitive filenames should be used.
sourcepub fn disable_pathspec_match(&mut self, disable: bool) -> &mut DiffOptions
pub fn disable_pathspec_match(&mut self, disable: bool) -> &mut DiffOptions
If pathspecs are specified, this flag means that they should be applied as an exact match instead of a fnmatch pattern.
sourcepub fn skip_binary_check(&mut self, skip: bool) -> &mut DiffOptions
pub fn skip_binary_check(&mut self, skip: bool) -> &mut DiffOptions
Disable updating the binary
flag in delta records. This is useful when
iterating over a diff if you don’t need hunk and data callbacks and want
to avoid having to load a file completely.
sourcepub fn enable_fast_untracked_dirs(&mut self, enable: bool) -> &mut DiffOptions
pub fn enable_fast_untracked_dirs(&mut self, enable: bool) -> &mut DiffOptions
When diff finds an untracked directory, to match the behavior of core Git, it scans the contents for ignored and untracked files. If all contents are ignored, then the directory is ignored; if any contents are not ignored, then the directory is untracked. This is extra work that may not matter in many cases.
This flag turns off that scan and immediately labels an untracked directory as untracked (changing the behavior to not match core git).
sourcepub fn update_index(&mut self, update: bool) -> &mut DiffOptions
pub fn update_index(&mut self, update: bool) -> &mut DiffOptions
When diff finds a file in the working directory with stat information different from the index, but the OID ends up being the same, write the correct stat information into the index. Note: without this flag, diff will always leave the index untouched.
sourcepub fn include_unreadable(&mut self, include: bool) -> &mut DiffOptions
pub fn include_unreadable(&mut self, include: bool) -> &mut DiffOptions
Include unreadable files in the diff
sourcepub fn include_unreadable_as_untracked(
&mut self,
include: bool
) -> &mut DiffOptions
pub fn include_unreadable_as_untracked(
&mut self,
include: bool
) -> &mut DiffOptions
Include unreadable files in the diff as untracked files
sourcepub fn force_text(&mut self, force: bool) -> &mut DiffOptions
pub fn force_text(&mut self, force: bool) -> &mut DiffOptions
Treat all files as text, disabling binary attributes and detection.
sourcepub fn force_binary(&mut self, force: bool) -> &mut DiffOptions
pub fn force_binary(&mut self, force: bool) -> &mut DiffOptions
Treat all files as binary, disabling text diffs
sourcepub fn ignore_whitespace(&mut self, ignore: bool) -> &mut DiffOptions
pub fn ignore_whitespace(&mut self, ignore: bool) -> &mut DiffOptions
Ignore all whitespace
sourcepub fn ignore_whitespace_change(&mut self, ignore: bool) -> &mut DiffOptions
pub fn ignore_whitespace_change(&mut self, ignore: bool) -> &mut DiffOptions
Ignore changes in the amount of whitespace
sourcepub fn ignore_whitespace_eol(&mut self, ignore: bool) -> &mut DiffOptions
pub fn ignore_whitespace_eol(&mut self, ignore: bool) -> &mut DiffOptions
Ignore whitespace at the end of line
sourcepub fn ignore_blank_lines(&mut self, ignore: bool) -> &mut DiffOptions
pub fn ignore_blank_lines(&mut self, ignore: bool) -> &mut DiffOptions
Ignore blank lines
sourcepub fn show_untracked_content(&mut self, show: bool) -> &mut DiffOptions
pub fn show_untracked_content(&mut self, show: bool) -> &mut DiffOptions
When generating patch text, include the content of untracked files.
This automatically turns on include_untracked
but it does not turn on
recurse_untracked_dirs
. Add that flag if you want the content of every
single untracked file.
sourcepub fn show_unmodified(&mut self, show: bool) -> &mut DiffOptions
pub fn show_unmodified(&mut self, show: bool) -> &mut DiffOptions
When generating output, include the names of unmodified files if they
are included in the Diff
. Normally these are skipped in the formats
that list files (e.g. name-only, name-status, raw). Even with this these
will not be included in the patch format.
sourcepub fn patience(&mut self, patience: bool) -> &mut DiffOptions
pub fn patience(&mut self, patience: bool) -> &mut DiffOptions
Use the “patience diff” algorithm
sourcepub fn minimal(&mut self, minimal: bool) -> &mut DiffOptions
pub fn minimal(&mut self, minimal: bool) -> &mut DiffOptions
Take extra time to find the minimal diff
sourcepub fn show_binary(&mut self, show: bool) -> &mut DiffOptions
pub fn show_binary(&mut self, show: bool) -> &mut DiffOptions
Include the necessary deflate/delta information so that git-apply
can
apply given diff information to binary files.
sourcepub fn indent_heuristic(&mut self, heuristic: bool) -> &mut DiffOptions
pub fn indent_heuristic(&mut self, heuristic: bool) -> &mut DiffOptions
Use a heuristic that takes indentation and whitespace into account which generally can produce better diffs when dealing with ambiguous diff hunks.
sourcepub fn context_lines(&mut self, lines: u32) -> &mut DiffOptions
pub fn context_lines(&mut self, lines: u32) -> &mut DiffOptions
Set the number of unchanged lines that define the boundary of a hunk (and to display before and after).
The default value for this is 3.
sourcepub fn interhunk_lines(&mut self, lines: u32) -> &mut DiffOptions
pub fn interhunk_lines(&mut self, lines: u32) -> &mut DiffOptions
Set the maximum number of unchanged lines between hunk boundaries before the hunks will be merged into one.
The default value for this is 0.
sourcepub fn id_abbrev(&mut self, abbrev: u16) -> &mut DiffOptions
pub fn id_abbrev(&mut self, abbrev: u16) -> &mut DiffOptions
The default value for this is core.abbrev
or 7 if unset.
sourcepub fn max_size(&mut self, size: i64) -> &mut DiffOptions
pub fn max_size(&mut self, size: i64) -> &mut DiffOptions
Maximum size (in bytes) above which a blob will be marked as binary automatically.
A negative value will disable this entirely.
The default value for this is 512MB.
sourcepub fn old_prefix<T: IntoCString>(&mut self, t: T) -> &mut DiffOptions
pub fn old_prefix<T: IntoCString>(&mut self, t: T) -> &mut DiffOptions
The virtual “directory” to prefix old file names with in hunk headers.
The default value for this is “a”.
sourcepub fn new_prefix<T: IntoCString>(&mut self, t: T) -> &mut DiffOptions
pub fn new_prefix<T: IntoCString>(&mut self, t: T) -> &mut DiffOptions
The virtual “directory” to prefix new file names with in hunk headers.
The default value for this is “b”.
sourcepub fn pathspec<T: IntoCString>(&mut self, pathspec: T) -> &mut DiffOptions
pub fn pathspec<T: IntoCString>(&mut self, pathspec: T) -> &mut DiffOptions
Add to the array of paths/fnmatch patterns to constrain the diff.
sourcepub unsafe fn raw(&mut self) -> *const git_diff_options
pub unsafe fn raw(&mut self) -> *const git_diff_options
Acquire a pointer to the underlying raw options.
This function is unsafe as the pointer is only valid so long as this structure is not moved, modified, or used elsewhere.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for DiffOptions
impl !Send for DiffOptions
impl !Sync for DiffOptions
impl Unpin for DiffOptions
impl UnwindSafe for DiffOptions
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more