aboutsummaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2020-05-24 11:22:32 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2020-05-24 11:22:32 +0200
commit26d02b3fec4434d663445d580497204e79284db0 (patch)
tree979557eb9427829331fedcc80f9f8879b590b7cb /storage
parent16207827862af21b6e822df9aafd0007ba19a36f (diff)
downloadgo-git-26d02b3fec4434d663445d580497204e79284db0.tar.gz
config: ReadConfig and LoadConfig from scopes
Diffstat (limited to 'storage')
-rw-r--r--storage/filesystem/config.go17
1 files changed, 2 insertions, 15 deletions
diff --git a/storage/filesystem/config.go b/storage/filesystem/config.go
index 01b35b4..78a6464 100644
--- a/storage/filesystem/config.go
+++ b/storage/filesystem/config.go
@@ -1,7 +1,6 @@
package filesystem
import (
- stdioutil "io/ioutil"
"os"
"github.com/go-git/go-git/v5/config"
@@ -14,29 +13,17 @@ type ConfigStorage struct {
}
func (c *ConfigStorage) Config() (conf *config.Config, err error) {
- cfg := config.NewConfig()
-
f, err := c.dir.Config()
if err != nil {
if os.IsNotExist(err) {
- return cfg, nil
+ return config.NewConfig(), nil
}
return nil, err
}
defer ioutil.CheckClose(f, &err)
-
- b, err := stdioutil.ReadAll(f)
- if err != nil {
- return nil, err
- }
-
- if err = cfg.Unmarshal(b); err != nil {
- return nil, err
- }
-
- return cfg, err
+ return config.ReadConfig(f)
}
func (c *ConfigStorage) SetConfig(cfg *config.Config) (err error) {