|
@@ -12,6 +12,7 @@ import (
|
12
|
12
|
gitssh "gopkg.in/src-d/go-git.v4/plumbing/transport/ssh"
|
13
|
13
|
)
|
14
|
14
|
|
|
15
|
+// Sync
|
15
|
16
|
func Sync(cfg config.GitSettings) (r *gogit.Repository, err error) {
|
16
|
17
|
auth, err := getAuth(cfg.User, cfg.PrivateKeyPath)
|
17
|
18
|
if err != nil {
|
|
@@ -69,14 +70,16 @@ func pull(clonePath string, auth *gitssh.PublicKeys) (*gogit.Repository, error)
|
69
|
70
|
Auth: auth,
|
70
|
71
|
})
|
71
|
72
|
|
72
|
|
- if err == gogit.NoErrAlreadyUpToDate {
|
73
|
|
- return r, nil
|
74
|
|
- }
|
75
|
|
-
|
76
|
|
- // go-git doesn't have an error variable for "non-fast-forward update", so
|
77
|
|
- // this is the only way to detect it
|
78
|
|
- if strings.HasPrefix(err.Error(), "non-fast-forward update") {
|
79
|
|
- return r, nil
|
|
73
|
+ if err != nil {
|
|
74
|
+ if err == gogit.NoErrAlreadyUpToDate {
|
|
75
|
+ return r, nil
|
|
76
|
+ }
|
|
77
|
+
|
|
78
|
+ // go-git doesn't have an error variable for "non-fast-forward update",
|
|
79
|
+ // so this is the only way to detect it
|
|
80
|
+ if strings.HasPrefix(err.Error(), "non-fast-forward update") {
|
|
81
|
+ return r, nil
|
|
82
|
+ }
|
80
|
83
|
}
|
81
|
84
|
|
82
|
85
|
return r, err
|