Skip to main content

orphan_workspaces

Function orphan_workspaces 

Source
pub fn orphan_workspaces(
    workspace_root: &Utf8Path,
    branches: &[BranchInstance],
) -> Result<(Vec<Utf8PathBuf>, Vec<String>)>
Expand description

Workspace directories under workspace_root that no binding record claims. A workspace is a cache, so an unclaimed one is just garbage — but only the records can say which ones are claimed.

Deletion is deliberately narrower than “unclaimed”: a directory is removed only if newgit can prove it made it (it carries a workspace marker) or there is nothing to lose (it is empty). [workspace] root is user-configurable and might point somewhere shared, and “newgit deleted a directory it did not create” is not a failure mode worth risking to reclaim disk. Anything else is reported as unrecognized and left alone.