Adjust to the change in the git_odb_open_rstream signature
This commit is contained in:
parent
b52e13f37d
commit
cff71166ec
8
odb.go
8
odb.go
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue