Skip to content

Commit c1ec21d

Browse files
Sanskar Jaiswallhchavez
Sanskar Jaiswal
andauthored
libgit2 v1.5.0 #major (#929)
Update libgit2 to v1.5.0. Replace `SmartProxyOptions()` with `SmartRemoteConnectOptions()`. Fixes: #899 Signed-off-by: Sanskar Jaiswal <[email protected]> Co-authored-by: lhchavez <[email protected]>
1 parent 9db5de1 commit c1ec21d

11 files changed

+39
-27
lines changed

.github/workflows/backport.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
branch: [ 'release-1.2', 'release-1.1', 'release-1.0', 'release-0.28', 'release-0.27' ]
15+
branch: [ 'release-1.3', 'release-1.2', 'release-1.1', 'release-1.0', 'release-0.28', 'release-0.27' ]
1616

1717
runs-on: ubuntu-20.04
1818

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
fail-fast: false
6363
matrix:
6464
libgit2:
65-
- 'v1.3.1'
65+
- 'v1.5.0'
6666
name: Go (system-wide, dynamic)
6767

6868
runs-on: ubuntu-20.04

Build_bundled_static.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ package git
1010
#cgo CFLAGS: -DLIBGIT2_STATIC
1111
#include <git2.h>
1212
13-
#if LIBGIT2_VER_MAJOR != 1 || LIBGIT2_VER_MINOR < 3 || LIBGIT2_VER_MINOR > 3
14-
# error "Invalid libgit2 version; this git2go supports libgit2 between v1.3.0 and v1.3.0"
13+
#if LIBGIT2_VER_MAJOR != 1 || LIBGIT2_VER_MINOR < 5 || LIBGIT2_VER_MINOR > 5
14+
# error "Invalid libgit2 version; this git2go supports libgit2 between v1.5.0 and v1.5.0"
1515
#endif
1616
*/
1717
import "C"

Build_system_dynamic.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ package git
88
#cgo CFLAGS: -DLIBGIT2_DYNAMIC
99
#include <git2.h>
1010
11-
#if LIBGIT2_VER_MAJOR != 1 || LIBGIT2_VER_MINOR < 3 || LIBGIT2_VER_MINOR > 3
12-
# error "Invalid libgit2 version; this git2go supports libgit2 between v1.3.0 and v1.3.0"
11+
#if LIBGIT2_VER_MAJOR != 1 || LIBGIT2_VER_MINOR < 5 || LIBGIT2_VER_MINOR > 5
12+
# error "Invalid libgit2 version; this git2go supports libgit2 between v1.5.0 and v1.5.0"
1313
#endif
1414
*/
1515
import "C"

Build_system_static.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ package git
88
#cgo CFLAGS: -DLIBGIT2_STATIC
99
#include <git2.h>
1010
11-
#if LIBGIT2_VER_MAJOR != 1 || LIBGIT2_VER_MINOR < 3 || LIBGIT2_VER_MINOR > 3
12-
# error "Invalid libgit2 version; this git2go supports libgit2 between v1.3.0 and v1.3.0"
11+
#if LIBGIT2_VER_MAJOR != 1 || LIBGIT2_VER_MINOR < 5 || LIBGIT2_VER_MINOR > 5
12+
# error "Invalid libgit2 version; this git2go supports libgit2 between v1.5.0 and v1.5.0"
1313
#endif
1414
*/
1515
import "C"

README.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
git2go
22
======
3-
[![GoDoc](https://godoc.org/github.com/libgit2/git2go?status.svg)](http://godoc.org/github.com/libgit2/git2go/v33) [![Build Status](https://travis-ci.org/libgit2/git2go.svg?branch=main)](https://travis-ci.org/libgit2/git2go)
3+
[![GoDoc](https://godoc.org/github.com/libgit2/git2go?status.svg)](http://godoc.org/github.com/libgit2/git2go/v34) [![Build Status](https://travis-ci.org/libgit2/git2go.svg?branch=main)](https://travis-ci.org/libgit2/git2go)
44

55
Go bindings for [libgit2](http://libgit2.github.com/).
66

@@ -10,7 +10,8 @@ Due to the fact that Go 1.11 module versions have semantic meaning and don't nec
1010

1111
| libgit2 | git2go |
1212
|---------|---------------|
13-
| main | (will be v34) |
13+
| main | (will be v35) |
14+
| 1.5 | v34 |
1415
| 1.3 | v33 |
1516
| 1.2 | v32 |
1617
| 1.1 | v31 |
@@ -19,13 +20,13 @@ Due to the fact that Go 1.11 module versions have semantic meaning and don't nec
1920
| 0.28 | v28 |
2021
| 0.27 | v27 |
2122

22-
You can import them in your project with the version's major number as a suffix. For example, if you have libgit2 v1.2 installed, you'd import git2go v33 with:
23+
You can import them in your project with the version's major number as a suffix. For example, if you have libgit2 v1.2 installed, you'd import git2go v34 with:
2324

2425
```sh
25-
go get github.com/libgit2/git2go/v33
26+
go get github.com/libgit2/git2go/v34
2627
```
2728
```go
28-
import "github.com/libgit2/git2go/v33"
29+
import "github.com/libgit2/git2go/v34"
2930
```
3031

3132
which will ensure there are no sudden changes to the API.
@@ -49,7 +50,7 @@ This project wraps the functionality provided by libgit2. If you're using a vers
4950
When linking dynamically against a released version of libgit2, install it via your system's package manager. CGo will take care of finding its pkg-config file and set up the linking. Import via Go modules, e.g. to work against libgit2 v1.2
5051

5152
```go
52-
import "github.com/libgit2/git2go/v33"
53+
import "github.com/libgit2/git2go/v34"
5354
```
5455

5556
### Versioned branch, static linking
@@ -79,7 +80,7 @@ In order to let Go pass the correct flags to `pkg-config`, `-tags static` needs
7980

8081
One thing to take into account is that since Go expects the `pkg-config` file to be within the same directory where `make install-static` was called, so the `go.mod` file may need to have a [`replace` directive](https://github.com/golang/go/wiki/Modules#when-should-i-use-the-replace-directive) so that the correct setup is achieved. So if `git2go` is checked out at `$GOPATH/src/github.com/libgit2/git2go` and your project at `$GOPATH/src/github.com/my/project`, the `go.mod` file of `github.com/my/project` might need to have a line like
8182

82-
replace github.com/libgit2/git2go/v33 => ../../libgit2/git2go
83+
replace github.com/libgit2/git2go/v34 => ../../libgit2/git2go
8384

8485
Parallelism and network operations
8586
----------------------------------

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/libgit2/git2go/v33
1+
module github.com/libgit2/git2go/v34
22

33
go 1.13
44

http.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ func registerManagedHTTP() error {
3838

3939
func httpSmartSubtransportFactory(remote *Remote, transport *Transport) (SmartSubtransport, error) {
4040
var proxyFn func(*http.Request) (*url.URL, error)
41-
proxyOpts, err := transport.SmartProxyOptions()
41+
remoteConnectOpts, err := transport.SmartRemoteConnectOptions()
4242
if err != nil {
4343
return nil, err
4444
}
45-
switch proxyOpts.Type {
45+
switch remoteConnectOpts.ProxyOptions.Type {
4646
case ProxyTypeNone:
4747
proxyFn = nil
4848
case ProxyTypeAuto:
4949
proxyFn = http.ProxyFromEnvironment
5050
case ProxyTypeSpecified:
51-
parsedUrl, err := url.Parse(proxyOpts.Url)
51+
parsedUrl, err := url.Parse(remoteConnectOpts.ProxyOptions.Url)
5252
if err != nil {
5353
return nil, err
5454
}

remote.go

+13-2
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,17 @@ type FetchOptions struct {
146146
ProxyOptions ProxyOptions
147147
}
148148

149+
type RemoteConnectOptions struct {
150+
// Proxy options to use for this fetch operation
151+
ProxyOptions ProxyOptions
152+
}
153+
154+
func remoteConnectOptionsFromC(copts *C.git_remote_connect_options) *RemoteConnectOptions {
155+
return &RemoteConnectOptions{
156+
ProxyOptions: proxyOptionsFromC(&copts.proxy_opts),
157+
}
158+
}
159+
149160
type ProxyType uint
150161

151162
const (
@@ -170,8 +181,8 @@ type ProxyOptions struct {
170181
Url string
171182
}
172183

173-
func proxyOptionsFromC(copts *C.git_proxy_options) *ProxyOptions {
174-
return &ProxyOptions{
184+
func proxyOptionsFromC(copts *C.git_proxy_options) ProxyOptions {
185+
return ProxyOptions{
175186
Type: ProxyType(copts._type),
176187
Url: C.GoString(copts.url),
177188
}

transport.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,17 @@ type Transport struct {
8484
ptr *C.git_transport
8585
}
8686

87-
// SmartProxyOptions gets a copy of the proxy options for this transport.
88-
func (t *Transport) SmartProxyOptions() (*ProxyOptions, error) {
87+
// SmartRemoteConnectOptions gets a copy of the proxy options for this transport.
88+
func (t *Transport) SmartRemoteConnectOptions() (*RemoteConnectOptions, error) {
8989
runtime.LockOSThread()
9090
defer runtime.UnlockOSThread()
9191

92-
var cpopts C.git_proxy_options
93-
if ret := C.git_transport_smart_proxy_options(&cpopts, t.ptr); ret < 0 {
92+
var copts C.git_remote_connect_options
93+
if ret := C.git_transport_remote_connect_options(&copts, t.ptr); ret < 0 {
9494
return nil, MakeGitError(ret)
9595
}
9696

97-
return proxyOptionsFromC(&cpopts), nil
97+
return remoteConnectOptionsFromC(&copts), nil
9898
}
9999

100100
// SmartCredentials calls the credentials callback for this transport.

vendor/libgit2

Submodule libgit2 updated 1098 files

0 commit comments

Comments
 (0)