aboutsummaryrefslogtreecommitdiffstats
path: root/repository
diff options
context:
space:
mode:
Diffstat (limited to 'repository')
-rw-r--r--repository/git_testing.go18
-rw-r--r--repository/repo.go5
2 files changed, 17 insertions, 6 deletions
diff --git a/repository/git_testing.go b/repository/git_testing.go
index 5ae4ccc9..7d40bf1f 100644
--- a/repository/git_testing.go
+++ b/repository/git_testing.go
@@ -3,6 +3,8 @@ package repository
import (
"io/ioutil"
"log"
+
+ "github.com/99designs/keyring"
)
// This is intended for testing only
@@ -34,7 +36,11 @@ func CreateTestRepo(bare bool) TestedRepo {
log.Fatal("failed to set user.email for test repository: ", err)
}
- return repo
+ // make sure we use a mock keyring for testing to not interact with the global system
+ return &replaceKeyring{
+ TestedRepo: repo,
+ keyring: keyring.NewArrayKeyring(nil),
+ }
}
func SetupReposAndRemote() (repoA, repoB, remote TestedRepo) {
@@ -56,3 +62,13 @@ func SetupReposAndRemote() (repoA, repoB, remote TestedRepo) {
return repoA, repoB, remote
}
+
+// replaceKeyring allow to replace the Keyring of the underlying repo
+type replaceKeyring struct {
+ TestedRepo
+ keyring Keyring
+}
+
+func (rk replaceKeyring) Keyring() Keyring {
+ return rk.keyring
+}
diff --git a/repository/repo.go b/repository/repo.go
index 696b032e..7a69a14f 100644
--- a/repository/repo.go
+++ b/repository/repo.go
@@ -20,11 +20,6 @@ var (
type RepoConfig interface {
// LocalConfig give access to the repository scoped configuration
LocalConfig() Config
-
- // GlobalConfig give access to the git global configuration
- // Deprecated: to remove in favor of Keyring()
- // TODO: remove
- GlobalConfig() Config
}
// RepoKeyring give access to a user-wide storage for secrets