[−][src]Function devx_pre_commit::locate_project_root
pub fn locate_project_root() -> Result<PathBuf>
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_DIR
env 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
.