pub struct ListedFileDiff {
pub path: String,
pub old_path: Option<String>,
pub status: DiffStatus,
pub old_mode: Option<String>,
pub new_mode: Option<String>,
pub binary: bool,
pub similarity: Option<u32>,
pub stat: Option<LineStat>,
pub structured: Option<StructuredFileDiff>,
pub combined: Option<CombinedStructuredTextDiff>,
pub combined_status: Option<String>,
}Expand description
One changed file with optional patch body or line counts.
Fields§
§path: StringDisplay path (new side, or old for deletions).
old_path: Option<String>Pre-rename path when it differs from Self::path.
status: DiffStatusChange kind.
old_mode: Option<String>Old git mode (octal), when present.
new_mode: Option<String>New git mode (octal), when present.
binary: boolEither side looks like a binary blob.
similarity: Option<u32>Rename/copy similarity (0–100), when applicable.
stat: Option<LineStat>Line counts when DiffDetail::Stat was requested.
structured: Option<StructuredFileDiff>Structured hunks when DiffDetail::Patch was requested.
combined: Option<CombinedStructuredTextDiff>Combined (--cc) hunks for merge commits; mutually exclusive with Self::structured.
combined_status: Option<String>Per-parent status letters for combined merge name-status (e.g. MM, DD).
Implementations§
Source§impl FileDiff
impl FileDiff
Sourcepub fn from_metadata(entry: DiffEntry) -> Self
pub fn from_metadata(entry: DiffEntry) -> Self
Metadata-only row for name-only and name-status output.
Moves the paths and modes out of entry without reading any blob, so converting a
list entry by entry costs no more than the entries themselves. This is the row
build_file_diffs produces for DiffDetail::NameOnly and DiffDetail::NameStatus.
§Parameters
entry: one tree or index diff record.
§Returns
A FileDiff whose path is the new path (old path for deletions), with old_path
set only when it differs, absent-side modes (000000) as None, and no stat or hunks.
Source§impl FileDiff
impl FileDiff
Sourcepub fn line_stat(&self) -> LineStat
pub fn line_stat(&self) -> LineStat
Line counts for this file, whichever detail level produced it.
§Returns
Self::stat when stat detail was computed; otherwise the counts of
the structured (or combined) hunks; zero when neither is present (for
example binary files and name-only listings).
Sourcepub fn changes_all_ignored(&self, whitespace: WhitespaceMode) -> bool
pub fn changes_all_ignored(&self, whitespace: WhitespaceMode) -> bool
Whether whitespace hid every change in this file.
Git leaves such files out of --stat and --numstat under -w, -b,
--ignore-space-at-eol and --ignore-blank-lines. Only a text
modification with unchanged modes and no remaining changed lines
qualifies: additions, deletions, renames, mode changes and binary files
always stay listed.
§Parameters
whitespace: the rules the file was diffed with.
Trait Implementations§
impl Eq for FileDiff
impl StructuralPartialEq for FileDiff
Auto Trait Implementations§
impl Freeze for FileDiff
impl RefUnwindSafe for FileDiff
impl Send for FileDiff
impl Sync for FileDiff
impl Unpin for FileDiff
impl UnsafeUnpin for FileDiff
impl UnwindSafe for FileDiff
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.