blob: 3f095fad1c801270cc9d1664d44a6e71d2c72751 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
package config
import "errors"
var (
ErrModuleEmptyURL = errors.New("module config: empty URL")
ErrModuleEmptyPath = errors.New("module config: empty path")
)
const DefaultModuleBranch = "master"
// Modules defines the submodules properties
type Modules map[string]*Module
// Module defines a submodule
// https://www.kernel.org/pub/software/scm/git/docs/gitmodules.html
type Module struct {
// Path defines the path, relative to the top-level directory of the Git
// working tree,
Path string
// URL defines a URL from which the submodule repository can be cloned.
URL string
// Branch is a remote branch name for tracking updates in the upstream
// submodule.
Branch string
}
// Validate validate the fields and set the default values
func (m *Module) Validate() error {
if m.Path == "" {
return ErrModuleEmptyPath
}
if m.URL == "" {
return ErrModuleEmptyURL
}
if m.Branch == "" {
m.Branch = DefaultModuleBranch
}
return nil
}
|