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

Method Worktrees

git/client.go:269–279  ·  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

267// Worktrees lists the repository's worktrees by parsing the output of
268// `git worktree list --porcelain`.
269func (c *Client) Worktrees(ctx context.Context) ([]Worktree, error) {
270 cmd, err := c.Command(ctx, "worktree", "list", "--porcelain")
271 if err != nil {
272 return nil, err
273 }
274 out, err := cmd.Output()
275 if err != nil {
276 return nil, err
277 }
278 return parseWorktrees(out), nil
279}
280
281// WorktreeRemove removes the worktree at the given path via
282// `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