aboutsummaryrefslogtreecommitdiffstats
path: root/repository/mock_repo.go
diff options
context:
space:
mode:
Diffstat (limited to 'repository/mock_repo.go')
-rw-r--r--repository/mock_repo.go51
1 files changed, 2 insertions, 49 deletions
diff --git a/repository/mock_repo.go b/repository/mock_repo.go
index bdf36ac2..26c02ede 100644
--- a/repository/mock_repo.go
+++ b/repository/mock_repo.go
@@ -3,8 +3,6 @@ package repository
import (
"crypto/sha1"
"fmt"
- "strconv"
- "strings"
"github.com/MichaelMure/git-bug/util/git"
"github.com/MichaelMure/git-bug/util/lamport"
@@ -41,10 +39,12 @@ func NewMockRepoForTest() *mockRepoForTest {
}
}
+// LocalConfig give access to the repository scoped configuration
func (r *mockRepoForTest) LocalConfig() Config {
return newMemConfig(r.config)
}
+// GlobalConfig give access to the git global configuration
func (r *mockRepoForTest) GlobalConfig() Config {
return newMemConfig(r.globalConfig)
}
@@ -75,53 +75,6 @@ func (r *mockRepoForTest) GetRemotes() (map[string]string, error) {
}, nil
}
-func (r *mockRepoForTest) StoreConfig(key string, value string) error {
- r.config[key] = value
- return nil
-}
-
-func (r *mockRepoForTest) ReadConfigs(keyPrefix string) (map[string]string, error) {
- result := make(map[string]string)
-
- for key, val := range r.config {
- if strings.HasPrefix(key, keyPrefix) {
- result[key] = val
- }
- }
-
- return result, nil
-}
-
-func (r *mockRepoForTest) ReadConfigBool(key string) (bool, error) {
- // unlike git, the mock can only store one value for the same key
- val, ok := r.config[key]
- if !ok {
- return false, ErrNoConfigEntry
- }
-
- return strconv.ParseBool(val)
-}
-
-func (r *mockRepoForTest) ReadConfigString(key string) (string, error) {
- // unlike git, the mock can only store one value for the same key
- val, ok := r.config[key]
- if !ok {
- return "", ErrNoConfigEntry
- }
-
- return val, nil
-}
-
-// RmConfigs remove all key/value pair matching the key prefix
-func (r *mockRepoForTest) RmConfigs(keyPrefix string) error {
- for key := range r.config {
- if strings.HasPrefix(key, keyPrefix) {
- delete(r.config, key)
- }
- }
- return nil
-}
-
// PushRefs push git refs to a remote
func (r *mockRepoForTest) PushRefs(remote string, refSpec string) (string, error) {
return "", nil