forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fakegit.go
89 lines (69 loc) · 1.77 KB
/
fakegit.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package test
import (
"io"
"github.com/openshift/origin/pkg/generate/git"
)
type FakeGit struct {
RootDir string
GitURL string
Ref string
CloneCalled bool
CheckoutCalled bool
SubmoduleUpdateCalled bool
}
func (g *FakeGit) GetRootDir(dir string) (string, error) {
return g.RootDir, nil
}
func (g *FakeGit) GetOriginURL(dir string) (string, bool, error) {
return g.GitURL, true, nil
}
func (g *FakeGit) GetRef(dir string) string {
return g.Ref
}
func (g *FakeGit) Clone(dir string, url string) error {
g.CloneCalled = true
return nil
}
func (g *FakeGit) CloneWithOptions(dir string, url string, opts git.CloneOptions) error {
g.CloneCalled = true
return nil
}
func (g *FakeGit) CloneBare(dir string, url string) error {
g.CloneCalled = true
return nil
}
func (g *FakeGit) CloneMirror(source, target string) error {
return nil
}
func (g *FakeGit) Checkout(dir string, ref string) error {
g.CheckoutCalled = true
return nil
}
func (g *FakeGit) SubmoduleUpdate(dir string, init, recurse bool) error {
g.SubmoduleUpdateCalled = true
return nil
}
func (f *FakeGit) Fetch(source string) error {
return nil
}
func (f *FakeGit) Init(source string, _ bool) error {
return nil
}
func (f *FakeGit) AddLocalConfig(source, key, value string) error {
return nil
}
func (f *FakeGit) Archive(source, ref, format string, w io.Writer) error {
return nil
}
func (f *FakeGit) AddRemote(source, remote, url string) error {
return nil
}
func (f *FakeGit) ShowFormat(source, ref, format string) (string, error) {
return "", nil
}
func (f *FakeGit) ListRemote(url string, args ...string) (string, string, error) {
return "", "", nil
}
func (f *FakeGit) GetInfo(location string) (*git.SourceInfo, []error) {
return nil, nil
}