blob: 6b82665d7d27d46bdd21e0326900154a0d186ec6 (
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/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
}
|