diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2020-05-24 11:22:32 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2020-05-24 11:22:32 +0200 |
commit | 26d02b3fec4434d663445d580497204e79284db0 (patch) | |
tree | 979557eb9427829331fedcc80f9f8879b590b7cb /storage/filesystem/config.go | |
parent | 16207827862af21b6e822df9aafd0007ba19a36f (diff) | |
download | go-git-26d02b3fec4434d663445d580497204e79284db0.tar.gz |
config: ReadConfig and LoadConfig from scopes
Diffstat (limited to 'storage/filesystem/config.go')
-rw-r--r-- | storage/filesystem/config.go | 17 |
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) { |