MCPcopy Create free account
hub / github.com/cli/cli / Worktrees

Method Worktrees

git/client.go:262–272  ·  view source on GitHub ↗

Worktrees lists the repository's worktrees by parsing the output of `git worktree list --porcelain`.

(ctx context.Context)

Source from the content-addressed store, hash-verified

260// Worktrees lists the repository's worktrees by parsing the output of
261// `git worktree list --porcelain`.
262func (c *Client) Worktrees(ctx context.Context) ([]Worktree, error) {
263 cmd, err := c.Command(ctx, "worktree", "list", "--porcelain")
264 if err != nil {
265 return nil, err
266 }
267 out, err := cmd.Output()
268 if err != nil {
269 return nil, err
270 }
271 return parseWorktrees(out), nil
272}
273
274// WorktreeRemove removes the worktree at the given path via
275// `git worktree remove <path>`.

Callers

nothing calls this directly

Calls 3

CommandMethod · 0.95
parseWorktreesFunction · 0.85
OutputMethod · 0.65

Tested by

no test coverage detected