pub fn nearest_git_root(path: &Path) -> Option<PathBuf>Expand description
Find the closest folder, starting with path itself, that has a .git folder or file.
A git submodule has a .git file instead of a folder.
A relative path is resolved against the working directory.
The returned path is absolute, with any . and .. components removed,
but symbolic links are not resolved.
Returns None if no such folder is found.
This does not invoke the git CLI.
use git_bot_feedback::client::nearest_git_root;
use std::path::Path;
let root = nearest_git_root(Path::new("src")).unwrap();
assert!(root.join(".git").exists());