From a107e18b9327e9a5da7a44b3a872b2f43598dfb4 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Sun, 24 May 2020 14:33:12 +0200 Subject: Repository.SetConfig, shortcut to Repository.Storer.SetConfig --- repository.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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. -- cgit