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

Function remove_from_working_copy

libatomic/src/daemon/services.rs:42–50  ·  view source on GitHub ↗

Delete one already-resolved working-copy path, as `atomic remove` does when a path has to leave the working copy. Directories leave recursively: a recorded directory's untrack reports its contents before the directory itself, so a non-recursive removal would fail on the still-occupied parents and leave the tree half-untracked. A path that is already absent needs no deletion and is a success — it

(path: &std::path::Path)

Source from the content-addressed store, hash-verified

40/// swallowed: reporting a removal whose bytes are still on disk is the failure
41/// this exists to prevent.
42fn remove_from_working_copy(path: &std::path::Path) -> std::io::Result<()> {
43 if path.is_dir() {
44 std::fs::remove_dir_all(path)
45 } else if path.exists() {
46 std::fs::remove_file(path)
47 } else {
48 Ok(())
49 }
50}
51
52// ---------------------------------------------------------------------------
53// DaemonService

Callers 1

remove_filesMethod · 0.85

Calls 2

is_dirMethod · 0.80
existsMethod · 0.45

Tested by

no test coverage detected