New returns a new git client with the same config as the current one, but with the given options applied on top.
(opts ...Option)
| 191 | // New returns a new git client with the same config as the current one, but |
| 192 | // with the given options applied on top. |
| 193 | func (cli *GitCLI) New(opts ...Option) *GitCLI { |
| 194 | clone := *cli |
| 195 | clone.args = slices.Clone(cli.args) |
| 196 | |
| 197 | for _, opt := range opts { |
| 198 | opt(&clone) |
| 199 | } |
| 200 | return &clone |
| 201 | } |
| 202 | |
| 203 | // Run executes a git command with the given args. |
| 204 | func (cli *GitCLI) Run(ctx context.Context, args ...string) (_ []byte, rerr error) { |