Browse Source

Rename go-git import

Brendan Abolivier 6 years ago
parent
commit
a97f834ae8
Signed by: Brendan Abolivier <contact@brendanabolivier.com> GPG key ID: 8EF1500759F70623
1 changed files with 13 additions and 13 deletions
  1. 13
    13
      src/git/git.go

+ 13
- 13
src/git/git.go View File

6
 	"strings"
6
 	"strings"
7
 	"time"
7
 	"time"
8
 
8
 
9
-	"gopkg.in/src-d/go-git.v4"
9
+	gogit "gopkg.in/src-d/go-git.v4"
10
 	"gopkg.in/src-d/go-git.v4/plumbing"
10
 	"gopkg.in/src-d/go-git.v4/plumbing"
11
 	"gopkg.in/src-d/go-git.v4/plumbing/object"
11
 	"gopkg.in/src-d/go-git.v4/plumbing/object"
12
 
12
 
14
 	gitssh "gopkg.in/src-d/go-git.v4/plumbing/transport/ssh"
14
 	gitssh "gopkg.in/src-d/go-git.v4/plumbing/transport/ssh"
15
 )
15
 )
16
 
16
 
17
-func Sync(repo string, clonePath string, privateKeyPath string) (r *git.Repository, err error) {
17
+func Sync(repo string, clonePath string, privateKeyPath string) (r *gogit.Repository, err error) {
18
 	auth, err := getAuth(privateKeyPath)
18
 	auth, err := getAuth(privateKeyPath)
19
 	if err != nil {
19
 	if err != nil {
20
 		return
20
 		return
48
 	return &gitssh.PublicKeys{User: "git", Signer: signer}, nil
48
 	return &gitssh.PublicKeys{User: "git", Signer: signer}, nil
49
 }
49
 }
50
 
50
 
51
-func clone(repo string, clonePath string, auth *gitssh.PublicKeys) (*git.Repository, error) {
52
-	return git.PlainClone(clonePath, false, &git.CloneOptions{
51
+func clone(repo string, clonePath string, auth *gitssh.PublicKeys) (*gogit.Repository, error) {
52
+	return gogit.PlainClone(clonePath, false, &gogit.CloneOptions{
53
 		URL:  repo,
53
 		URL:  repo,
54
 		Auth: auth,
54
 		Auth: auth,
55
 	})
55
 	})
56
 }
56
 }
57
 
57
 
58
-func pull(clonePath string, auth *gitssh.PublicKeys) (*git.Repository, error) {
59
-	r, err := git.PlainOpen(clonePath)
58
+func pull(clonePath string, auth *gitssh.PublicKeys) (*gogit.Repository, error) {
59
+	r, err := gogit.PlainOpen(clonePath)
60
 	if err != nil {
60
 	if err != nil {
61
 		return nil, err
61
 		return nil, err
62
 	}
62
 	}
66
 		return nil, err
66
 		return nil, err
67
 	}
67
 	}
68
 
68
 
69
-	err = w.Pull(&git.PullOptions{
69
+	err = w.Pull(&gogit.PullOptions{
70
 		RemoteName: "origin",
70
 		RemoteName: "origin",
71
 		Auth:       auth,
71
 		Auth:       auth,
72
 	})
72
 	})
73
 
73
 
74
-	if err == git.NoErrAlreadyUpToDate {
74
+	if err == gogit.NoErrAlreadyUpToDate {
75
 		return r, nil
75
 		return r, nil
76
 	}
76
 	}
77
 
77
 
94
 	return true, err
94
 	return true, err
95
 }
95
 }
96
 
96
 
97
-func Commit(message string, w *git.Worktree) (plumbing.Hash, error) {
98
-	return w.Commit(message, &git.CommitOptions{
97
+func Commit(message string, w *gogit.Worktree) (plumbing.Hash, error) {
98
+	return w.Commit(message, &gogit.CommitOptions{
99
 		Author: &object.Signature{
99
 		Author: &object.Signature{
100
 			Name:  "Grafana Dashboard Manager",
100
 			Name:  "Grafana Dashboard Manager",
101
 			Email: "grafana@cozycloud.cc",
101
 			Email: "grafana@cozycloud.cc",
104
 	})
104
 	})
105
 }
105
 }
106
 
106
 
107
-func Push(r *git.Repository, keyPath string) error {
107
+func Push(r *gogit.Repository, keyPath string) error {
108
 	auth, err := getAuth(keyPath)
108
 	auth, err := getAuth(keyPath)
109
 	if err != nil {
109
 	if err != nil {
110
 		return err
110
 		return err
111
 	}
111
 	}
112
 
112
 
113
-	err = r.Push(&git.PushOptions{
113
+	err = r.Push(&gogit.PushOptions{
114
 		Auth: auth,
114
 		Auth: auth,
115
 	})
115
 	})
116
 
116
 
117
-	if err == git.NoErrAlreadyUpToDate {
117
+	if err == gogit.NoErrAlreadyUpToDate {
118
 		return nil
118
 		return nil
119
 	}
119
 	}
120
 
120