From ec429ccdfc54141e30dd829020fc8fa2927e690c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Thu, 22 Feb 2018 09:07:57 +0100 Subject: [PATCH 1/4] vendor: bump libgit2 to 809b0ca6b (v0.27.0-rc1) --- vendor/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/libgit2 b/vendor/libgit2 index f1323d9..809b0ca 160000 --- a/vendor/libgit2 +++ b/vendor/libgit2 @@ -1 +1 @@ -Subproject commit f1323d9c161aeeada190fd9615a8b5a9fb8a7f3e +Subproject commit 809b0ca6b9b6a5648b8e802a9f0c6a0821257595 From b52e13f37dfb80a47b78ca6f95e06b4b27220767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Thu, 22 Feb 2018 09:28:49 +0100 Subject: [PATCH 2/4] Switch over the version contraints to v0.27 --- git_dynamic.go | 4 ++-- git_static.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/git_dynamic.go b/git_dynamic.go index 00828a5..0a977e8 100644 --- a/git_dynamic.go +++ b/git_dynamic.go @@ -6,8 +6,8 @@ package git #include #cgo pkg-config: libgit2 -#if LIBGIT2_VER_MAJOR != 0 || LIBGIT2_VER_MINOR != 26 -# error "Invalid libgit2 version; this git2go supports libgit2 v0.26" +#if LIBGIT2_VER_MAJOR != 0 || LIBGIT2_VER_MINOR != 27 +# error "Invalid libgit2 version; this git2go supports libgit2 v0.27" #endif */ diff --git a/git_static.go b/git_static.go index b42d49f..6303734 100644 --- a/git_static.go +++ b/git_static.go @@ -9,8 +9,8 @@ package git #cgo !windows pkg-config: --static ${SRCDIR}/vendor/libgit2/build/libgit2.pc #include -#if LIBGIT2_VER_MAJOR != 0 || LIBGIT2_VER_MINOR != 26 -# error "Invalid libgit2 version; this git2go supports libgit2 v0.26" +#if LIBGIT2_VER_MAJOR != 0 || LIBGIT2_VER_MINOR != 27 +# error "Invalid libgit2 version; this git2go supports libgit2 v0.27" #endif */ From cff71166ec65cee1a070f04ac5c4d10fe3b009d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Thu, 22 Feb 2018 09:28:58 +0100 Subject: [PATCH 3/4] Adjust to the change in the git_odb_open_rstream signature --- odb.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/odb.go b/odb.go index 64c5415..f236fc4 100644 --- a/odb.go +++ b/odb.go @@ -182,17 +182,21 @@ func (v *Odb) Hash(data []byte, otype ObjectType) (oid *Oid, err error) { // contents of the object. func (v *Odb) NewReadStream(id *Oid) (*OdbReadStream, error) { stream := new(OdbReadStream) + var ctype C.git_otype + var csize C.size_t runtime.LockOSThread() defer runtime.UnlockOSThread() - ret := C.git_odb_open_rstream(&stream.ptr, v.ptr, id.toC()) + ret := C.git_odb_open_rstream(&stream.ptr, &csize, &ctype, v.ptr, id.toC()) runtime.KeepAlive(v) runtime.KeepAlive(id) if ret < 0 { return nil, MakeGitError(ret) } + stream.Size = uint64(csize) + stream.Type = ObjectType(ctype) runtime.SetFinalizer(stream, (*OdbReadStream).Free) return stream, nil } @@ -264,7 +268,9 @@ func (object *OdbObject) Data() (data []byte) { } type OdbReadStream struct { - ptr *C.git_odb_stream + ptr *C.git_odb_stream + Size uint64 + Type ObjectType } // Read reads from the stream From 661e1a6f1b70a3f4837c4aec6a3006dcc5689bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Thu, 22 Feb 2018 09:46:42 +0100 Subject: [PATCH 4/4] merge: expose the conflict marker size option --- merge.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/merge.go b/merge.go index bfbf9a3..adc521a 100644 --- a/merge.go +++ b/merge.go @@ -355,6 +355,7 @@ type MergeFileOptions struct { TheirLabel string Favor MergeFileFavor Flags MergeFileFlags + MarkerSize uint16 } func mergeFileOptionsFromC(c C.git_merge_file_options) MergeFileOptions { @@ -364,6 +365,7 @@ func mergeFileOptionsFromC(c C.git_merge_file_options) MergeFileOptions { TheirLabel: C.GoString(c.their_label), Favor: MergeFileFavor(c.favor), Flags: MergeFileFlags(c.flags), + MarkerSize: uint16(c.marker_size), } } @@ -373,6 +375,7 @@ func populateCMergeFileOptions(c *C.git_merge_file_options, options MergeFileOpt 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.marker_size = C.ushort(options.MarkerSize) } func freeCMergeFileOptions(c *C.git_merge_file_options) {