summaryrefslogtreecommitdiff
path: root/odb.go
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2018-02-22 10:06:47 +0100
committerGitHub <[email protected]>2018-02-22 10:06:47 +0100
commite57025a372f882df8ee7dbc47dc7d4ec6eddcc55 (patch)
tree7bd3dc4990985590c7a910f09960df28cb0bad55 /odb.go
parent432a164805a43a5ee0df15f7939dc771fc8d4fbd (diff)
parent661e1a6f1b70a3f4837c4aec6a3006dcc5689bc6 (diff)
Merge pull request #434 from libgit2/cmn/bumping
Update vendored libgit2 to v0.27.0-rc1
Diffstat (limited to 'odb.go')
-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