blob: 771315f13e1c3cf78bfae95bd57eb84fe99fa481 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package gittest
import (
"strings"
"testing"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/config"
)
// RemoteExists tests if the repository at repoPath has a Git remote named remoteName.
func RemoteExists(t testing.TB, cfg config.Cfg, repoPath string, remoteName string) bool {
if remoteName == "" {
t.Fatal("empty remote name")
}
remotes := Exec(t, cfg, "-C", repoPath, "remote")
for _, r := range strings.Split(string(remotes), "\n") {
if r == remoteName {
return true
}
}
return false
}
|