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

Method Worktrees

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

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