aboutsummaryrefslogtreecommitdiffstats
path: root/repository/gogit_testing.go
diff options
context:
space:
mode:
Diffstat (limited to 'repository/gogit_testing.go')
-rw-r--r--repository/gogit_testing.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/repository/gogit_testing.go b/repository/gogit_testing.go
index 1b39fe5c..01be54de 100644
--- a/repository/gogit_testing.go
+++ b/repository/gogit_testing.go
@@ -2,6 +2,8 @@ package repository
import (
"log"
+ "path/filepath"
+ "strings"
"testing"
"github.com/99designs/keyring"
@@ -73,3 +75,18 @@ func SetupGoGitReposAndRemote(t *testing.T) (repoA, repoB, remote TestedRepo) {
return repoA, repoB, remote
}
+
+func RepoDir(t *testing.T, repo TestedRepo) string {
+ t.Helper()
+
+ dir := repo.GetLocalRemote()
+ if strings.HasSuffix(dir, ".git") {
+ dir, _ = filepath.Split(dir)
+ }
+
+ if dir[len(dir)-1] == filepath.Separator {
+ dir = dir[:len(dir)-1]
+ }
+
+ return dir
+}