MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / has_uncommitted_edits

Method has_uncommitted_edits

atomic-repository/src/repository/status.rs:1206–1226  ·  view source on GitHub ↗

Whether a tracked path has working-copy edits that deleting it would destroy. This is the guard `git rm` applies before removing a file with local changes. Only content-bearing differences count: `Deleted` means the bytes are already gone, and a path absent from the status result is not something this call can destroy. # Example ```rust,ignore if repo.has_uncommitted_edits(working_copy, Path::n

(
        &self,
        working_copy: WorkingCopyId,
        path: &Path,
    )

Source from the content-addressed store, hash-verified

1204 /// }
1205 /// ```
1206 pub fn has_uncommitted_edits(
1207 &self,
1208 working_copy: WorkingCopyId,
1209 path: &Path,
1210 ) -> Result<bool, RepositoryError> {
1211 let options = StatusOptions {
1212 include_untracked: false,
1213 path_filters: vec![path.to_path_buf()],
1214 ..StatusOptions::default()
1215 };
1216 let status = self.status(working_copy, options)?;
1217 Ok(status.get(path).is_some_and(|entry| {
1218 matches!(
1219 entry.status(),
1220 FileStatus::Modified
1221 | FileStatus::Conflicted
1222 | FileStatus::TypeChanged
1223 | FileStatus::PermissionsChanged
1224 )
1225 }))
1226 }
1227
1228 /// Get only modified files.
1229 pub fn modified_files(

Callers 1

remove_filesMethod · 0.45

Calls 2

getMethod · 0.65
statusMethod · 0.45

Tested by

no test coverage detected