Skip to main content

find_git_root

Function find_git_root 

Source
pub fn find_git_root(file_path: &Path) -> Option<PathBuf>
Expand description

Find the git root for a file path by walking ancestors.

Returns Some(git_root_path) if a .git directory is found in an ancestor, or None if no git root exists.

The path must already be canonicalized for consistent results.