Expand description
What git knows about a directory: where its work tree is, and whether anything under it is tracked.
§Why the index, and why by asking git for it
Tier two’s safety property is “contains no tracked file at any depth”, which is exactly the
guarantee git clean enforces and the only reason the tier can be on by default. The index
is the authority for it, and getting the index wrong means deleting somebody’s source — so
this module asks git ls-files rather than parsing .git/index itself. Split indexes,
version-4 path compression, sparse directory entries and linked work trees are all shapes a
hand-rolled reader gets wrong quietly, and quietly is the one failure mode a cleaner cannot
afford. One subprocess per work tree buys the exact answer.
If git cannot be run, or the repository will not answer, tier two goes inert for that work tree and says so. It never falls back to a guess.
Structs§
- Work
Tree - One git work tree, with the set of paths its index tracks.
Enums§
- Checkout
- What the
.gitat a work tree root actually is. - GitError
- Why a work tree could not be consulted.
Functions§
- checkout_
at - Which kind of checkout is rooted at
dir, orNoneif there is not one. - discover
- The nearest ancestor of
from,fromitself included, that is a git work tree root. - head_
on_ branch - Whether
HEADnames a branch rather than sitting detached. - is_
clean - Whether the work tree at
dirholds work that exists nowhere else. - is_
work_ tree_ root - Whether
diris the root of a git work tree.