diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-02-12 23:03:47 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2017-02-12 23:04:00 +0100 |
commit | b3b6e51565dcdbf81546f1d8f0121874a4e4fce9 (patch) | |
tree | 5ad244f4b9c350367ed65d57d8881078aefe0753 /submodule.go | |
parent | 498dbf7dc92e288641f1af1acc52704150e8a6c0 (diff) | |
download | go-git-b3b6e51565dcdbf81546f1d8f0121874a4e4fce9.tar.gz |
submodule init implementation
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 +} |