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

Method stash_drop

atomic-repository/src/repository/stash.rs:554–563  ·  view source on GitHub ↗

Drop one stash (sidecar + view). Returns the dropped entry.

(&mut self, reference: Option<&str>)

Source from the content-addressed store, hash-verified

552
553 /// Drop one stash (sidecar + view). Returns the dropped entry.
554 pub fn stash_drop(&mut self, reference: Option<&str>) -> Result<StashEntry, String> {
555 let stash = self.stash_resolve(reference)?;
556 let stash_dir = self.dot_dir().join("stashes").join(&stash.view_name);
557 if stash_dir.exists() {
558 let _ = std::fs::remove_dir_all(&stash_dir);
559 }
560 self.delete_view(&stash.view_name)
561 .map_err(|e| e.to_string())?;
562 Ok(stash)
563 }
564
565 /// Drop every stash. Returns the dropped count.
566 pub fn stash_clear(&mut self) -> Result<usize, String> {

Callers 2

run_dropMethod · 0.80
drop_stashMethod · 0.80

Calls 4

stash_resolveMethod · 0.80
dot_dirMethod · 0.45
existsMethod · 0.45
delete_viewMethod · 0.45

Tested by

no test coverage detected