Skip to main content

worktree_git_dir

Function worktree_git_dir 

Source
pub fn worktree_git_dir(context: &GitContext, cwd: &Path) -> Option<PathBuf>
Expand description

What: The real path of the Git directory of the worktree a command runs in, read from the file system when the layout is a plain one and from Git otherwise. Why: The Git directory names the service instance, so the route cannot be chosen without it; the preparation of the commit asks the same question later and shares the answer’s cost when the file system can give it.

In TS you’d write (pseudocode):

worktreeGitDir(context, cwd) // undefined outside a repository