Skip to main content

main_checkout_root

Function main_checkout_root 

Source
pub fn main_checkout_root(start: &Path) -> Result<PathBuf, String>
Expand description

What: The main checkout of the repository that contains start, found without starting Git. Why: Walk up to the first .git. A directory there marks the main checkout. A file there is a linked worktree’s gitfile (gitdir: <admin directory>); the administrative directory’s commondir names the common directory, whose parent is the main checkout when the common directory is called .git. Anything else (a bare repository, a submodule, an unreadable gitfile) is reported, because converting the wrong directory would be harmful.

In TS you’d write (pseudocode):

function mainCheckoutRoot(start: string): string; // throws with the reason