MCPcopy Create free account
hub / github.com/docker/docker-agent / isRemote

Function isRemote

pkg/worktree/worktree.go:377–388  ·  view source on GitHub ↗

isRemote reports whether name is a configured git remote.

(ctx context.Context, root, name string)

Source from the content-addressed store, hash-verified

375
376// isRemote reports whether name is a configured git remote.
377func isRemote(ctx context.Context, root, name string) bool {
378 out, err := gitOutput(ctx, root, "remote")
379 if err != nil {
380 return false
381 }
382 for remote := range strings.SplitSeq(out, "\n") {
383 if strings.TrimSpace(remote) == name {
384 return true
385 }
386 }
387 return false
388}
389
390func git(ctx context.Context, dir string, args ...string) error {
391 cmd := exec.CommandContext(ctx, "git", append([]string{"-C", dir}, args...)...)

Callers 1

fetchBaseFunction · 0.85

Calls 1

gitOutputFunction · 0.70

Tested by

no test coverage detected