Skip to main content

discover_repo_root

Function discover_repo_root 

Source
pub fn discover_repo_root(start: &Path) -> Option<PathBuf>
Expand description

Walk up from start and return the first directory containing a .git entry, or None if there is no repository above it.

.git is matched as either a directory (an ordinary clone) or a file (a linked worktree or a submodule, where it holds a gitdir: pointer), so a worktree checkout reports its own root rather than the main one.