MCPcopy Create free account
hub / github.com/LegacyCodeHQ/clarity-cli / GetGitDir

Function GetGitDir

vcs/git/git_worktree.go:24–30  ·  view source on GitHub ↗

GetGitDir returns the absolute path to the git directory for `path`. For the primary worktree this equals GetCommonDir; for a linked worktree this is the per-worktree gitdir under ` /worktrees/ `.

(path string)

Source from the content-addressed store, hash-verified

22// For the primary worktree this equals GetCommonDir; for a linked worktree
23// this is the per-worktree gitdir under `<common>/worktrees/<name>`.
24func GetGitDir(path string) (string, error) {
25 stdout, stderr, err := runGitCommand(path, "rev-parse", "--absolute-git-dir")
26 if err != nil {
27 return "", gitCommandError(err, stderr)
28 }
29 return strings.TrimSpace(string(stdout)), nil
30}
31
32// GetCommonDir returns the absolute path to the common git directory — the
33// primary repository's `.git`. Identical for the primary and every linked

Calls 2

runGitCommandFunction · 0.85
gitCommandErrorFunction · 0.85