Welcome to mirror list, hosted at ThFree Co, Russian Federation.

remote.go « gittest « git « internal - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
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
}