forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
git.go
35 lines (29 loc) · 804 Bytes
/
git.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
package test
// FakeGit provides a fake GIT
type FakeGit struct {
ValidCloneSpecSource string
ValidCloneSpecResult bool
CloneSource string
CloneTarget string
CloneError error
CheckoutRepo string
CheckoutRef string
CheckoutError error
}
// ValidCloneSpec returns a valid GIT clone specification
func (f *FakeGit) ValidCloneSpec(source string) bool {
f.ValidCloneSpecSource = source
return f.ValidCloneSpecResult
}
// Clone clones the fake source GIT repository to target directory
func (f *FakeGit) Clone(source, target string) error {
f.CloneSource = source
f.CloneTarget = target
return f.CloneError
}
// Checkout checkouts a ref in the fake GIT repository
func (f *FakeGit) Checkout(repo, ref string) error {
f.CheckoutRepo = repo
f.CheckoutRef = ref
return f.CheckoutError
}