aboutsummaryrefslogtreecommitdiffstats
path: root/repository.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2020-05-24 14:33:12 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2020-05-24 14:33:12 +0200
commita107e18b9327e9a5da7a44b3a872b2f43598dfb4 (patch)
tree7b05772c3cb15451080769cee2deeabb3d31c398 /repository.go
parent86c0c010927fe59ae54563a9a86db200a18f4c2e (diff)
downloadgo-git-a107e18b9327e9a5da7a44b3a872b2f43598dfb4.tar.gz
Repository.SetConfig, shortcut to Repository.Storer.SetConfig
Diffstat (limited to 'repository.go')
-rw-r--r--repository.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/repository.go b/repository.go
index 60baf85..47318d1 100644
--- a/repository.go
+++ b/repository.go
@@ -435,11 +435,20 @@ func cleanUpDir(path string, all bool) error {
return err
}
-// Config return the repository config
+// Config return the repository config. In a filesystem backed repository this
+// means read the `.git/config`.
func (r *Repository) Config() (*config.Config, error) {
return r.Storer.Config()
}
+// SetConfig marshall and writes the repository config. In a filesystem backed
+// repository this means write the `.git/config`. This function should be called
+// with the result of `Repository.Config` and never with the output of
+// `Repository.ConfigScoped`.
+func (r *Repository) SetConfig(cfg *config.Config) error {
+ return r.Storer.SetConfig(cfg)
+}
+
// ConfigScoped returns the repository config, merged with requested scope and
// lower. For example if, config.GlobalScope is given the local and global config
// are returned merged in one config value.