Przeglądaj źródła

Rename go-git import

Brendan Abolivier 7 lat temu
rodzic
commit
a97f834ae8
Podpisane przez: Brendan Abolivier <contact@brendanabolivier.com> ID klucza GPG: 8EF1500759F70623
1 zmienionych plików z 13 dodań i 13 usunięć
  1. 13
    13
      src/git/git.go

+ 13
- 13
src/git/git.go Wyświetl plik

@@ -6,7 +6,7 @@ import (
6 6
 	"strings"
7 7
 	"time"
8 8
 
9
-	"gopkg.in/src-d/go-git.v4"
9
+	gogit "gopkg.in/src-d/go-git.v4"
10 10
 	"gopkg.in/src-d/go-git.v4/plumbing"
11 11
 	"gopkg.in/src-d/go-git.v4/plumbing/object"
12 12
 
@@ -14,7 +14,7 @@ import (
14 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 18
 	auth, err := getAuth(privateKeyPath)
19 19
 	if err != nil {
20 20
 		return
@@ -48,15 +48,15 @@ func getAuth(privateKeyPath string) (*gitssh.PublicKeys, error) {
48 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 53
 		URL:  repo,
54 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 60
 	if err != nil {
61 61
 		return nil, err
62 62
 	}
@@ -66,12 +66,12 @@ func pull(clonePath string, auth *gitssh.PublicKeys) (*git.Repository, error) {
66 66
 		return nil, err
67 67
 	}
68 68
 
69
-	err = w.Pull(&git.PullOptions{
69
+	err = w.Pull(&gogit.PullOptions{
70 70
 		RemoteName: "origin",
71 71
 		Auth:       auth,
72 72
 	})
73 73
 
74
-	if err == git.NoErrAlreadyUpToDate {
74
+	if err == gogit.NoErrAlreadyUpToDate {
75 75
 		return r, nil
76 76
 	}
77 77
 
@@ -94,8 +94,8 @@ func dirExists(path string) (bool, error) {
94 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 99
 		Author: &object.Signature{
100 100
 			Name:  "Grafana Dashboard Manager",
101 101
 			Email: "grafana@cozycloud.cc",
@@ -104,17 +104,17 @@ func Commit(message string, w *git.Worktree) (plumbing.Hash, error) {
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 108
 	auth, err := getAuth(keyPath)
109 109
 	if err != nil {
110 110
 		return err
111 111
 	}
112 112
 
113
-	err = r.Push(&git.PushOptions{
113
+	err = r.Push(&gogit.PushOptions{
114 114
 		Auth: auth,
115 115
 	})
116 116
 
117
-	if err == git.NoErrAlreadyUpToDate {
117
+	if err == gogit.NoErrAlreadyUpToDate {
118 118
 		return nil
119 119
 	}
120 120