ValidateRemote checks that a named remote is valid for use given a list from RemoteList. This is completely identical to ValidateRemote, except that it allows caching the remote list.
(remotes []string, remote string)
| 578 | // RemoteList. This is completely identical to ValidateRemote, except that it |
| 579 | // allows caching the remote list. |
| 580 | func ValidateRemoteFromList(remotes []string, remote string) error { |
| 581 | for _, r := range remotes { |
| 582 | if r == remote { |
| 583 | return nil |
| 584 | } |
| 585 | } |
| 586 | |
| 587 | if err := ValidateRemoteURL(remote); err == nil { |
| 588 | return nil |
| 589 | } |
| 590 | |
| 591 | return errors.New(tr.Tr.Get("invalid remote name: %q", remote)) |
| 592 | } |
| 593 | |
| 594 | // ValidateRemoteURL checks that a string is a valid Git remote URL |
| 595 | func ValidateRemoteURL(remote string) error { |
no test coverage detected