-
Notifications
You must be signed in to change notification settings - Fork 153
/
wrapper.go
36 lines (26 loc) · 936 Bytes
/
wrapper.go
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
package wrapper
import (
"context"
gogit "github.com/go-git/go-git/v5"
)
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
//counterfeiter:generate . Git
type Git interface {
PlainCloneContext(ctx context.Context, path string, isBare bool, o *gogit.CloneOptions) (*gogit.Repository, error)
PlainOpen(path string) (*gogit.Repository, error)
PlainInit(path string, isBare bool) (*gogit.Repository, error)
}
type goGit struct{}
var _ Git = new(goGit)
func (g *goGit) PlainCloneContext(ctx context.Context, path string, isBare bool, o *gogit.CloneOptions) (*gogit.Repository, error) {
return gogit.PlainCloneContext(ctx, path, isBare, o)
}
func (g *goGit) PlainOpen(path string) (*gogit.Repository, error) {
return gogit.PlainOpen(path)
}
func (g *goGit) PlainInit(path string, isBare bool) (*gogit.Repository, error) {
return gogit.PlainInit(path, isBare)
}
func NewGoGit() Git {
return &goGit{}
}