pub struct PathChange {
pub staged: Option<PathStatus>,
pub unstaged: Option<PathStatus>,
pub original_path: Option<PathBuf>,
}Expand description
A path’s porcelain XY status, kept as the TWO independent axes git
reports rather than collapsed into one value.
X is the index vs HEAD (“what a commit would record”) and Y is
the working tree vs the index (“what staging would add”). They vary
independently: MM means a file has staged changes and further
unstaged ones, and it belongs in both of magit’s sections with
“modified” on each row.
Collapsing them into a single PathStatus is what produced the
reported bug — a staged modification (M ) had to be reported as
Added to make it land in the staged section, so it rendered as
“new file”, and MM had to be reported as Conflicted (which means
a merge conflict) purely to make it appear in both. One value cannot
answer both “which section” and “what label” without lying about one
of them.
Fields§
§staged: Option<PathStatus>Index vs HEAD. None when nothing is staged for this path.
unstaged: Option<PathStatus>Working tree vs index. None when the worktree matches the
index. Also carries PathStatus::Untracked / Ignored /
Unmerged, which are whole-path states rather than one axis.
original_path: Option<PathBuf>Where a PathStatus::Renamed / PathStatus::Copied path
came from. None for every other status.
Implementations§
Trait Implementations§
Source§impl Clone for PathChange
impl Clone for PathChange
Source§fn clone(&self) -> PathChange
fn clone(&self) -> PathChange
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PathChange
impl Debug for PathChange
impl Eq for PathChange
Source§impl PartialEq for PathChange
impl PartialEq for PathChange
impl StructuralPartialEq for PathChange
Auto Trait Implementations§
impl Freeze for PathChange
impl RefUnwindSafe for PathChange
impl Send for PathChange
impl Sync for PathChange
impl Unpin for PathChange
impl UnsafeUnpin for PathChange
impl UnwindSafe for PathChange
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.