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

Method Command

git/client.go:75–93  ·  view source on GitHub ↗
(ctx context.Context, args ...string)

Source from the content-addressed store, hash-verified

73}
74
75func (c *Client) Command(ctx context.Context, args ...string) (*Command, error) {
76 if c.RepoDir != "" {
77 args = append([]string{"-C", c.RepoDir}, args...)
78 }
79 var err error
80 c.mu.Lock()
81 if c.GitPath == "" {
82 c.GitPath, err = resolveGitPath()
83 }
84 c.mu.Unlock()
85 if err != nil {
86 return nil, err
87 }
88 cmd := exec.CommandContext(ctx, c.GitPath, args...)
89 cmd.Stderr = c.Stderr
90 cmd.Stdin = c.Stdin
91 cmd.Stdout = c.Stdout
92 return &Command{cmd}, nil
93}
94
95// CredentialPattern is used to inform AuthenticatedCommand which patterns Git should match
96// against when trying to find credentials. It is a little over-engineered as a type because we

Calls 1

resolveGitPathFunction · 0.85