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

Function ListWorktrees

vcs/git/git_worktree.go:59–65  ·  view source on GitHub ↗

ListWorktrees enumerates all worktrees registered with the repository containing `path`. The primary worktree is always the first entry.

(path string)

Source from the content-addressed store, hash-verified

57// ListWorktrees enumerates all worktrees registered with the repository
58// containing `path`. The primary worktree is always the first entry.
59func ListWorktrees(path string) ([]Worktree, error) {
60 stdout, stderr, err := runGitCommand(path, "worktree", "list", "--porcelain")
61 if err != nil {
62 return nil, gitCommandError(err, stderr)
63 }
64 return parseWorktreePorcelain(string(stdout)), nil
65}
66
67// parseWorktreePorcelain parses the output of `git worktree list --porcelain`.
68// Stanzas are separated by blank lines. Each stanza begins with `worktree <path>`,

Callers 7

planInitialReposFunction · 0.92
currentBranchForFunction · 0.92
reconcileWorktreesMethod · 0.92

Calls 3

runGitCommandFunction · 0.85
gitCommandErrorFunction · 0.85
parseWorktreePorcelainFunction · 0.85