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

Function currentBranchFor

cmd/watch/supervisor.go:102–114  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

100}
101
102func currentBranchFor(path string) string {
103 wts, err := git.ListWorktrees(path)
104 if err != nil {
105 return ""
106 }
107 pathResolved := resolveSymlinksOrSelf(path)
108 for _, w := range wts {
109 if resolveSymlinksOrSelf(w.Path) == pathResolved {
110 return w.Branch
111 }
112 }
113 return ""
114}
115
116func resolveSymlinksOrSelf(path string) string {
117 resolved, err := filepath.EvalSymlinks(path)

Callers 1

planInitialReposFunction · 0.85

Calls 2

ListWorktreesFunction · 0.92
resolveSymlinksOrSelfFunction · 0.85

Tested by

no test coverage detected