diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-02-13 23:38:57 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2017-02-13 23:38:57 +0100 |
commit | f8b5557875513c5b0aff24bb7b8e28f8f680976f (patch) | |
tree | 56ae4d1b2cde8644216c594e6913b9c6f763cd8b /config/config.go | |
parent | 940a16ca68457beded1eff551f23febeffb32f3e (diff) | |
download | go-git-f8b5557875513c5b0aff24bb7b8e28f8f680976f.tar.gz |
config: adding Config.Core.Worktree
Diffstat (limited to 'config/config.go')
-rw-r--r-- | config/config.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/config/config.go b/config/config.go index 866ae8e..b3a3fcc 100644 --- a/config/config.go +++ b/config/config.go @@ -37,6 +37,8 @@ type Config struct { // IsBare if true this repository is assumed to be bare and has no // working directory associated with it IsBare bool + // Worktree is the path to the root of the working tree + Worktree string } // Remote list of repository remotes Remotes map[string]*RemoteConfig @@ -76,6 +78,7 @@ const ( fetchKey = "fetch" urlKey = "url" bareKey = "bare" + worktreeKey = "worktree" ) // Unmarshal parses a git-config file and stores it @@ -97,6 +100,8 @@ func (c *Config) unmarshalCore() { if s.Options.Get(bareKey) == "true" { c.Core.IsBare = true } + + c.Core.Worktree = s.Options.Get(worktreeKey) } func (c *Config) unmarshalRemotes() error { @@ -129,6 +134,10 @@ func (c *Config) Marshal() ([]byte, error) { func (c *Config) marshalCore() { s := c.raw.Section(coreSection) s.SetOption(bareKey, fmt.Sprintf("%t", c.Core.IsBare)) + + if c.Core.Worktree != "" { + s.SetOption(worktreeKey, c.Core.Worktree) + } } func (c *Config) marshalRemotes() { |