MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / FindGitRoot

Function FindGitRoot

agent/worktree.go:22–32  ·  view source on GitHub ↗
(cwd string)

Source from the content-addressed store, hash-verified

20}
21
22type WorktreeManager struct{}
23
24func FindGitRoot(cwd string) string {
25 ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
26 defer cancel()
27 cmd := exec.CommandContext(ctx, "git", "rev-parse", "--show-toplevel")
28 cmd.Dir = cwd
29 out, err := cmd.Output()
30 if err != nil {
31 return ""
32 }
33 return filepath.Clean(stringTrimSpace(out))
34}
35

Callers 3

RemoveWorktreeFunction · 0.85
ExecuteMethod · 0.85

Calls 1

stringTrimSpaceFunction · 0.85