From 93a1ee401f5b924a23a43d1499b0516ce455e59d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Tue, 10 Dec 2019 21:28:24 +0000 Subject: [PATCH 1/5] Bump libgit2 to 6777db8e83 --- vendor/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/libgit2 b/vendor/libgit2 index 08cfa43..6777db8 160000 --- a/vendor/libgit2 +++ b/vendor/libgit2 @@ -1 +1 @@ -Subproject commit 08cfa43d0e1a9214a2f1239593686078e75e5636 +Subproject commit 6777db8e8343014d57c41b335e0c60af44d4e9f2 -- 2.45.2 From 790b3d2ac014385a76e858bc21549be50c3ef7c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Tue, 10 Dec 2019 22:15:09 +0000 Subject: [PATCH 2/5] Makefile: disable test caching This does not work well when you're changing C stuff underneath. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index cf00cef..4dffce0 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ default: test test: build-libgit2 go run script/check-MakeGitError-thread-lock.go - go test ./... + go test --count=1 ./... install: build-libgit2 go install ./... @@ -15,4 +15,4 @@ install-static: build-libgit2 test-static: build-libgit2 go run script/check-MakeGitError-thread-lock.go - go test --tags "static" ./... + go test --count=1 --tags "static" ./... -- 2.45.2 From 97e6392d3ab67bbf3e3e59b86a0bc9ebf7430e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Tue, 10 Dec 2019 22:15:32 +0000 Subject: [PATCH 3/5] Adjust to libgit2 changes --- credentials.go | 1 + go.mod | 2 ++ merge.go | 4 ++-- odb.go | 2 +- stash.go | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/credentials.go b/credentials.go index 4e42b6e..766619c 100644 --- a/credentials.go +++ b/credentials.go @@ -2,6 +2,7 @@ package git /* #include +#include */ import "C" import "unsafe" diff --git a/go.mod b/go.mod index 688b8e3..7a68658 100644 --- a/go.mod +++ b/go.mod @@ -1 +1,3 @@ module github.com/libgit2/git2go + +go 1.13 diff --git a/merge.go b/merge.go index bc672ce..955289a 100644 --- a/merge.go +++ b/merge.go @@ -132,7 +132,7 @@ func (mo *MergeOptions) toC() *C.git_merge_options { } return &C.git_merge_options{ version: C.uint(mo.Version), - flags: C.git_merge_flag_t(mo.TreeFlags), + flags: C.uint32_t(mo.TreeFlags), rename_threshold: C.uint(mo.RenameThreshold), target_limit: C.uint(mo.TargetLimit), file_favor: C.git_merge_file_favor_t(mo.FileFavor), @@ -394,7 +394,7 @@ func populateCMergeFileOptions(c *C.git_merge_file_options, options MergeFileOpt c.our_label = C.CString(options.OurLabel) c.their_label = C.CString(options.TheirLabel) c.favor = C.git_merge_file_favor_t(options.Favor) - c.flags = C.git_merge_file_flag_t(options.Flags) + c.flags = C.uint32_t(options.Flags) c.marker_size = C.ushort(options.MarkerSize) } diff --git a/odb.go b/odb.go index fec0eb9..6489653 100644 --- a/odb.go +++ b/odb.go @@ -221,7 +221,7 @@ func (v *Odb) NewWriteStream(size int64, otype ObjectType) (*OdbWriteStream, err runtime.LockOSThread() defer runtime.UnlockOSThread() - ret := C.git_odb_open_wstream(&stream.ptr, v.ptr, C.git_off_t(size), C.git_object_t(otype)) + ret := C.git_odb_open_wstream(&stream.ptr, v.ptr, C.git_object_size_t(size), C.git_object_t(otype)) runtime.KeepAlive(v) if ret < 0 { return nil, MakeGitError(ret) diff --git a/stash.go b/stash.go index 8743da8..6624bce 100644 --- a/stash.go +++ b/stash.go @@ -171,7 +171,7 @@ func (opts *StashApplyOptions) toC() ( optsC = &C.git_stash_apply_options{ version: C.GIT_STASH_APPLY_OPTIONS_VERSION, - flags: C.git_stash_apply_flags(opts.Flags), + flags: C.uint32_t(opts.Flags), } populateCheckoutOpts(&optsC.checkout_options, &opts.CheckoutOptions) if opts.ProgressCallback != nil { -- 2.45.2 From ce19fa064f3cb3ef6c4b360076ffc17556b2cc3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Tue, 10 Dec 2019 22:20:20 +0000 Subject: [PATCH 4/5] travis: update versions of Go to be tested --- .travis.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index f611cc3..7d53122 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,9 @@ language: go go: - - 1.7 - - 1.8 - - 1.9 - - "1.10" + - "1.11" + - "1.12" + - "1.13" - tip script: make test-static -- 2.45.2 From c5159e624e55cb14c56a3e5f36200be409fba9d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Tue, 10 Dec 2019 22:33:00 +0000 Subject: [PATCH 5/5] credentials: unconfuse Go about the type For some reason cgo thinks the `credtype` field does not exist in `git_cred` so let's put it into the C code. --- credentials.go | 4 +++- wrapper.c | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/credentials.go b/credentials.go index 766619c..038313b 100644 --- a/credentials.go +++ b/credentials.go @@ -3,6 +3,8 @@ package git /* #include #include + +git_credtype_t _go_git_cred_credtype(git_cred *cred); */ import "C" import "unsafe" @@ -28,7 +30,7 @@ func (o *Cred) HasUsername() bool { } func (o *Cred) Type() CredType { - return (CredType)(o.ptr.credtype) + return (CredType)(C._go_git_cred_credtype(o.ptr)) } func credFromC(ptr *C.git_cred) *Cred { diff --git a/wrapper.c b/wrapper.c index 11c2f32..3656773 100644 --- a/wrapper.c +++ b/wrapper.c @@ -2,6 +2,7 @@ #include #include #include +#include typedef int (*gogit_submodule_cbk)(git_submodule *sm, const char *name, void *payload); @@ -180,4 +181,8 @@ void _go_git_writestream_free(git_writestream *stream) stream->free(stream); } +git_credtype_t _go_git_cred_credtype(git_cred *cred) { + return cred->credtype; +} + /* EOF */ -- 2.45.2