pub fn locate_project_root() -> Result<PathBuf>Expand description
Searches for a project root dir, which is a directory that contains
a .git dir as its direct child (it should also be the root of
the project’s Rust crate or cargo workspace).
It uses the following steps:
- Use the value of
$GIT_DIRenv variable if it is present. (This variable is set by git when it invokes current process as a hook). - Fallback to the output of
git rev-parse --show-toplevel.