summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2018-02-22 09:28:58 +0100
committerCarlos Martín Nieto <[email protected]>2018-02-22 09:28:58 +0100
commitcff71166ec65cee1a070f04ac5c4d10fe3b009d9 (patch)
treeeae0122faa784e22d66db61538a241504926370e
parentb52e13f37dfb80a47b78ca6f95e06b4b27220767 (diff)
Adjust to the change in the git_odb_open_rstream signature
-rw-r--r--odb.go10
1 files 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