From 09110d8e6d1ddb6f6a22867dcedeebd8f2262780 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Tue, 14 Feb 2017 15:56:32 +0100 Subject: config: added Config.Submodules --- config/modules.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'config/modules.go') diff --git a/config/modules.go b/config/modules.go index 4d98b16..a17cc27 100644 --- a/config/modules.go +++ b/config/modules.go @@ -30,9 +30,8 @@ func NewModules() *Modules { } const ( - submoduleSection = "submodule" - pathKey = "path" - branchKey = "branch" + pathKey = "path" + branchKey = "branch" ) // Unmarshal parses a git-config file and stores it -- cgit From ed288b30de1ac3dcb3ce675c4b9af89eb4e6fcba Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Tue, 21 Feb 2017 16:03:39 +0100 Subject: documentation and API improvements --- config/modules.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'config/modules.go') diff --git a/config/modules.go b/config/modules.go index a17cc27..3d01117 100644 --- a/config/modules.go +++ b/config/modules.go @@ -15,7 +15,7 @@ var ( // Modules defines the submodules properties, represents a .gitmodules file // https://www.kernel.org/pub/software/scm/git/docs/gitmodules.html type Modules struct { - // Submodules is a map of submodules being the key the name of the submodule + // Submodules is a map of submodules being the key the name of the submodule. Submodules map[string]*Submodule raw *format.Config @@ -34,7 +34,7 @@ const ( branchKey = "branch" ) -// Unmarshal parses a git-config file and stores it +// Unmarshal parses a git-config file and stores it. func (m *Modules) Unmarshal(b []byte) error { r := bytes.NewBuffer(b) d := format.NewDecoder(r) @@ -55,7 +55,7 @@ func (m *Modules) Unmarshal(b []byte) error { return nil } -// Marshal returns Modules encoded as a git-config file +// Marshal returns Modules encoded as a git-config file. func (m *Modules) Marshal() ([]byte, error) { s := m.raw.Section(submoduleSection) s.Subsections = make(format.Subsections, len(m.Submodules)) @@ -74,12 +74,12 @@ func (m *Modules) Marshal() ([]byte, error) { return buf.Bytes(), nil } -// Submodule defines a submodule +// Submodule defines a submodule. type Submodule struct { // Name module name Name string // Path defines the path, relative to the top-level directory of the Git - // working tree, + // working tree. Path string // URL defines a URL from which the submodule repository can be cloned. URL string @@ -88,11 +88,11 @@ type Submodule struct { Branch string // raw representation of the subsection, filled by marshal or unmarshal are - // called + // called. raw *format.Subsection } -// Validate validates the fields and sets the default values +// Validate validates the fields and sets the default values. func (m *Submodule) Validate() error { if m.Path == "" { return ErrModuleEmptyPath -- cgit