Skip to content

Commit 43644eb

Browse files
author
Tyler Phelan
committed
Upgrade git2go to v33 and libgit2 to 1.3
- run goimports
1 parent 36096fc commit 43644eb

File tree

11 files changed

+26
-20
lines changed

11 files changed

+26
-20
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ require (
1515
github.com/google/go-containerregistry v0.6.0
1616
github.com/google/go-containerregistry/pkg/authn/k8schain v0.0.0-20210610160139-c086c7f16d4e
1717
github.com/jinzhu/gorm v1.9.12 // indirect
18-
github.com/libgit2/git2go/v31 v31.4.14
18+
github.com/libgit2/git2go/v33 v33.0.4
1919
github.com/matthewmcnew/archtest v0.0.0-20191014222827-a111193b50ad
2020
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b
2121
github.com/pkg/errors v0.9.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,8 +1187,8 @@ github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
11871187
github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
11881188
github.com/lib/pq v1.10.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
11891189
github.com/lib/pq v1.10.1/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
1190-
github.com/libgit2/git2go/v31 v31.4.14 h1:6GOd3965D9e/+gjxCwZF4eQ+vB9kKB4yKFqdQr6XZ2E=
1191-
github.com/libgit2/git2go/v31 v31.4.14/go.mod h1:c/rkJcBcUFx6wHaT++UwNpKvIsmPNqCeQ/vzO4DrEec=
1190+
github.com/libgit2/git2go/v33 v33.0.4 h1:37xovFBzibhDEdQRLbfWwx3a44JhOIY06UICn2teenc=
1191+
github.com/libgit2/git2go/v33 v33.0.4/go.mod h1:KdpqkU+6+++4oHna/MIOgx4GCQ92IPCdpVRMRI80J+4=
11921192
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
11931193
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
11941194
github.com/lunixbochs/vtclean v0.0.0-20180621232353-2d01aacdc34a/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI=

pkg/apis/build/v1alpha2/builder_conversion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package v1alpha2
33
import (
44
"context"
55
"fmt"
6+
67
"knative.dev/pkg/apis"
78

89
"github.com/pivotal/kpack/pkg/apis/build/v1alpha1"

pkg/apis/build/v1alpha2/source_resolver_conversion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package v1alpha2
33
import (
44
"context"
55
"fmt"
6+
67
"knative.dev/pkg/apis"
78

89
"github.com/pivotal/kpack/pkg/apis/build/v1alpha1"

pkg/git/certificate_check_callback.go

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,44 @@
11
package git
22

33
import (
4-
git2go "github.com/libgit2/git2go/v31"
5-
64
"log"
5+
6+
git2go "github.com/libgit2/git2go/v33"
7+
"github.com/pkg/errors"
78
)
89

910
func certificateCheckCallback(logger *log.Logger) git2go.CertificateCheckCallback {
10-
return func(cert *git2go.Certificate, valid bool, hostname string) git2go.ErrorCode {
11+
return func(cert *git2go.Certificate, valid bool, hostname string) error {
1112
if valid {
12-
return git2go.ErrOk
13+
return nil
1314
}
1415

1516
if cert.Kind == git2go.CertificateX509 {
1617
if cert.X509 != nil {
1718
err := cert.X509.VerifyHostname(hostname)
1819
if err != nil {
19-
logger.Println("host name could not be verified")
20-
return git2go.ErrAuth
20+
msg := "host name could not be verified"
21+
logger.Println(msg)
22+
return errors.Wrap(err, msg)
2123
}
2224
}
2325
} else if cert.Kind == git2go.CertificateHostkey {
2426
if cert.Hostkey.Kind == git2go.HostkeyMD5 {
2527
if !isByteArrayEmpty(cert.Hostkey.HashMD5[:]) {
26-
logger.Println("invalid host key MD5")
27-
return git2go.ErrAuth
28+
msg := "invalid host key MD5"
29+
logger.Println(msg)
30+
return errors.New(msg)
2831
}
2932
} else if cert.Hostkey.Kind == git2go.HostkeySHA1 {
3033
if !isByteArrayEmpty(cert.Hostkey.HashSHA1[:]) {
31-
logger.Println("invalid host key SHA1")
32-
return git2go.ErrAuth
34+
msg := "invalid host key SHA1"
35+
logger.Println(msg)
36+
return errors.New(msg)
3337
}
3438
}
3539
}
3640

37-
return git2go.ErrorCodeOK
41+
return nil
3842
}
3943

4044
}

pkg/git/fetch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"path"
77

88
"github.com/BurntSushi/toml"
9-
git2go "github.com/libgit2/git2go/v31"
9+
git2go "github.com/libgit2/git2go/v33"
1010
"github.com/pkg/errors"
1111
)
1212

pkg/git/fetch_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"testing"
1111

1212
"github.com/BurntSushi/toml"
13-
git2go "github.com/libgit2/git2go/v31"
13+
git2go "github.com/libgit2/git2go/v33"
1414
"github.com/pkg/errors"
1515
"github.com/sclevine/spec"
1616
"github.com/stretchr/testify/require"

pkg/git/git_keychain.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"sort"
55
"strings"
66

7-
git2go "github.com/libgit2/git2go/v31"
7+
git2go "github.com/libgit2/git2go/v33"
88
"github.com/pkg/errors"
99
giturls "github.com/whilp/git-urls"
1010
"golang.org/x/crypto/ssh"

pkg/git/git_keychain_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"path"
77
"testing"
88

9-
git2go "github.com/libgit2/git2go/v31"
9+
git2go "github.com/libgit2/git2go/v33"
1010
"github.com/sclevine/spec"
1111
"github.com/stretchr/testify/require"
1212
corev1 "k8s.io/api/core/v1"

pkg/git/k8s_git_keychain_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"encoding/pem"
99
"testing"
1010

11-
git2go "github.com/libgit2/git2go/v31"
11+
git2go "github.com/libgit2/git2go/v33"
1212
"github.com/sclevine/spec"
1313
"github.com/stretchr/testify/require"
1414
v1 "k8s.io/api/core/v1"

0 commit comments

Comments
 (0)