Skip to main content

work_tree_root

Function work_tree_root 

Source
pub fn work_tree_root(cwd: &Path) -> Result<PathBuf, Error>
Expand description

Path to the working-tree root of the repository containing cwd. Honors GIT_WORK_TREE, so this returns the right thing even when cwd is outside the work tree (e.g. tests that set both GIT_DIR and GIT_WORK_TREE as relative paths from a parent dir). Errors for bare repos (no work tree) and outside-any-repo callers.