From f8b5557875513c5b0aff24bb7b8e28f8f680976f Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Mon, 13 Feb 2017 23:38:57 +0100 Subject: config: adding Config.Core.Worktree --- config/config.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'config/config.go') 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() { -- cgit