Skip to main content

is_clean

Function is_clean 

Source
pub fn is_clean(dir: &Path) -> bool
Expand description

Whether the work tree at dir holds work that exists nowhere else.

git status --porcelain is empty exactly when there is nothing uncommitted and nothing untracked — and it says nothing about ignored files, which is what makes this usable here at all: a work tree carrying 4 GiB of node_modules reads clean, because that is precisely the content this program exists to regenerate rather than preserve.

Errs toward “not clean” on every failure. The answer is the gate on an irreversible removal.