diff options
Diffstat (limited to 'submodule.go')
-rw-r--r-- | submodule.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/submodule.go b/submodule.go new file mode 100644 index 0000000..32f730b --- /dev/null +++ b/submodule.go @@ -0,0 +1,30 @@ +package git + +import "srcd.works/go-git.v4/plumbing" + +type Submodule struct { + Name string + Branch string + URL string + + r *Repository +} + +func (s *Submodule) Init() error { + return s.r.clone(&CloneOptions{ + URL: s.URL, + ReferenceName: plumbing.ReferenceName(s.Branch), + }) +} + +type Submodules []*Submodule + +func (s Submodules) Init() error { + for _, sub := range s { + if err := sub.Init(); err != nil { + return err + } + } + + return nil +} |