Skip to main content

is_git_worktree

Function is_git_worktree 

Source
pub fn is_git_worktree(root: &Path) -> bool
Expand description

Whether root is inside a git worktree.

Why: the ONE git-detection implementation in the crate. run_task::diff’s snapshot logic needs the identical answer this binding classifies on; two independent probes could disagree and produce a GitRepo binding whose diff silently took the non-git file-map path. What: shells out to git -C <root> rev-parse --is-inside-work-tree. Fail-open to false — no git binary, a non-repo, or any error means “no git affordances”, which is a fully supported bound state (§4.2), never an error. Test: binding::tests::resolve_git_repo_binds_as_git_repo, binding::tests::resolve_plain_dir_binds_as_directory.