#[non_exhaustive]pub struct FileChange {
pub path: PathBuf,
pub old_path: Option<PathBuf>,
pub kind: ChangeKind,
}Expand description
One changed path in the working copy, unified across git status /
jj diff --summary.
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.path: PathBufThe path (the new path for a rename).
A PathBuf (not a String) so a filename whose bytes are not valid UTF-8
— legal on Unix — is carried losslessly from status/diff and can be
fed straight back into Repo::commit_paths /
the backend add. A String filled via String::from_utf8_lossy would
substitute U+FFFD and address a different file. See the crate’s
serde-policy note for how a non-UTF-8 path is emitted as JSON.
old_path: Option<PathBuf>The original path for a rename, populated by both backends (git’s
R old -> new status; jj’s {old => new} diff-summary form); None
for non-renames.
kind: ChangeKindHow the file changed.
Implementations§
Source§impl FileChange
impl FileChange
Sourcepub fn new(path: impl Into<PathBuf>, kind: ChangeKind) -> Self
pub fn new(path: impl Into<PathBuf>, kind: ChangeKind) -> Self
A change to path of the given kind, with no original path. Chain the
old_path setter for a rename or copy. Lets an external VcsRepo impl or a
test build one despite the #[non_exhaustive].
Trait Implementations§
Source§impl Clone for FileChange
impl Clone for FileChange
Source§fn clone(&self) -> FileChange
fn clone(&self) -> FileChange
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more