diff options
author | Steve Moyer <smoyer1@selesy.com> | 2022-06-16 19:45:51 -0400 |
---|---|---|
committer | Steve Moyer <smoyer1@selesy.com> | 2022-06-16 19:45:51 -0400 |
commit | f3d316d16cc9fadd90faaaf77becbb82f1e09367 (patch) | |
tree | c2774988393712b45c5e886bad01e67d61914ad0 /repository/gogit_testing.go | |
parent | 97ae5448781ec57fcd41b0c3296c781054a036cb (diff) | |
download | git-bug-f3d316d16cc9fadd90faaaf77becbb82f1e09367.tar.gz |
test(809): remove remaining calls to InitGoRepo in tests
Note that examples still need to shown how a developer would use the library.
Diffstat (limited to 'repository/gogit_testing.go')
-rw-r--r-- | repository/gogit_testing.go | 17 |
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 +} |