isRemote reports whether name is a configured git remote.
(ctx context.Context, root, name string)
| 375 | |
| 376 | // isRemote reports whether name is a configured git remote. |
| 377 | func 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 | |
| 390 | func git(ctx context.Context, dir string, args ...string) error { |
| 391 | cmd := exec.CommandContext(ctx, "git", append([]string{"-C", dir}, args...)...) |