Skip to main content

git_common_dir

Function git_common_dir 

Source
pub fn git_common_dir(cwd: &Path) -> Result<PathBuf, Error>
Expand description

Path to the shared .git directory of the repository containing cwd. Equivalent to git_dir in repos without linked worktrees; in worktree-having repos it always returns the main .git/ rather than the per-worktree subtree.

Use this for anything stored once per repo: object database, objects/info/alternates, default hooks, and the LFS object cache at .git/lfs/. Mirrors upstream’s git.GitCommonDir() / Configuration.LocalGitStorageDir().