Merge pull request #434 from libgit2/cmn/bumping

Update vendored libgit2 to v0.27.0-rc1
This commit is contained in:
Carlos Martín Nieto 2018-02-22 10:06:47 +01:00 committed by GitHub
commit e57025a372
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 7 deletions

View File

@ -6,8 +6,8 @@ package git
#include <git2.h> #include <git2.h>
#cgo pkg-config: libgit2 #cgo pkg-config: libgit2
#if LIBGIT2_VER_MAJOR != 0 || LIBGIT2_VER_MINOR != 26 #if LIBGIT2_VER_MAJOR != 0 || LIBGIT2_VER_MINOR != 27
# error "Invalid libgit2 version; this git2go supports libgit2 v0.26" # error "Invalid libgit2 version; this git2go supports libgit2 v0.27"
#endif #endif
*/ */

View File

@ -9,8 +9,8 @@ package git
#cgo !windows pkg-config: --static ${SRCDIR}/vendor/libgit2/build/libgit2.pc #cgo !windows pkg-config: --static ${SRCDIR}/vendor/libgit2/build/libgit2.pc
#include <git2.h> #include <git2.h>
#if LIBGIT2_VER_MAJOR != 0 || LIBGIT2_VER_MINOR != 26 #if LIBGIT2_VER_MAJOR != 0 || LIBGIT2_VER_MINOR != 27
# error "Invalid libgit2 version; this git2go supports libgit2 v0.26" # error "Invalid libgit2 version; this git2go supports libgit2 v0.27"
#endif #endif
*/ */

View File

@ -355,6 +355,7 @@ type MergeFileOptions struct {
TheirLabel string TheirLabel string
Favor MergeFileFavor Favor MergeFileFavor
Flags MergeFileFlags Flags MergeFileFlags
MarkerSize uint16
} }
func mergeFileOptionsFromC(c C.git_merge_file_options) MergeFileOptions { 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), TheirLabel: C.GoString(c.their_label),
Favor: MergeFileFavor(c.favor), Favor: MergeFileFavor(c.favor),
Flags: MergeFileFlags(c.flags), 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.their_label = C.CString(options.TheirLabel)
c.favor = C.git_merge_file_favor_t(options.Favor) c.favor = C.git_merge_file_favor_t(options.Favor)
c.flags = C.git_merge_file_flag_t(options.Flags) 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) { func freeCMergeFileOptions(c *C.git_merge_file_options) {

8
odb.go
View File

@ -182,17 +182,21 @@ func (v *Odb) Hash(data []byte, otype ObjectType) (oid *Oid, err error) {
// contents of the object. // contents of the object.
func (v *Odb) NewReadStream(id *Oid) (*OdbReadStream, error) { func (v *Odb) NewReadStream(id *Oid) (*OdbReadStream, error) {
stream := new(OdbReadStream) stream := new(OdbReadStream)
var ctype C.git_otype
var csize C.size_t
runtime.LockOSThread() runtime.LockOSThread()
defer runtime.UnlockOSThread() 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(v)
runtime.KeepAlive(id) runtime.KeepAlive(id)
if ret < 0 { if ret < 0 {
return nil, MakeGitError(ret) return nil, MakeGitError(ret)
} }
stream.Size = uint64(csize)
stream.Type = ObjectType(ctype)
runtime.SetFinalizer(stream, (*OdbReadStream).Free) runtime.SetFinalizer(stream, (*OdbReadStream).Free)
return stream, nil return stream, nil
} }
@ -265,6 +269,8 @@ func (object *OdbObject) Data() (data []byte) {
type OdbReadStream struct { type OdbReadStream struct {
ptr *C.git_odb_stream ptr *C.git_odb_stream
Size uint64
Type ObjectType
} }
// Read reads from the stream // Read reads from the stream

2
vendor/libgit2 vendored

@ -1 +1 @@
Subproject commit f1323d9c161aeeada190fd9615a8b5a9fb8a7f3e Subproject commit 809b0ca6b9b6a5648b8e802a9f0c6a0821257595