MCPcopy Index your code
hub / github.com/docker/docker-agent / git

Function git

pkg/worktree/worktree.go:390–401  ·  view source on GitHub ↗
(ctx context.Context, dir string, args ...string)

Source from the content-addressed store, hash-verified

388}
389
390func git(ctx context.Context, dir string, args ...string) error {
391 cmd := exec.CommandContext(ctx, "git", append([]string{"-C", dir}, args...)...)
392 var stderr bytes.Buffer
393 cmd.Stderr = &stderr
394 if err := cmd.Run(); err != nil {
395 if msg := strings.TrimSpace(stderr.String()); msg != "" {
396 return fmt.Errorf("%w: %s", err, msg)
397 }
398 return err
399 }
400 return nil
401}
402
403// gitOutput runs a git command in dir and returns its trimmed stdout.
404func gitOutput(ctx context.Context, dir string, args ...string) (string, error) {

Callers 4

CreateFunction · 0.85
CreatePRFunction · 0.85
RemoveMethod · 0.85
fetchBaseFunction · 0.85

Calls 2

StringMethod · 0.95
RunMethod · 0.65

Tested by

no test coverage detected