Example #1
0
func (odb *Odb) OpenRStream(oid *Oid) (*OdbStream, error) {
	stream := new(OdbStream)
	ecode := C.git_odb_open_rstream(&stream.git_odb_stream, odb.git_odb, oid.git_oid)
	if ecode != git_SUCCESS {
		return nil, gitError()
	}
	return stream, nil
}
Example #2
0
// NewReadStream opens a read stream from the ODB. Reading from it will give you the
// contents of the object.
func (v *Odb) NewReadStream(id *Oid) (*OdbReadStream, error) {
	stream := new(OdbReadStream)
	ret := C.git_odb_open_rstream(&stream.ptr, v.ptr, id.toC())
	if ret < 0 {
		return nil, MakeGitError(ret)
	}

	runtime.SetFinalizer(stream, (*OdbReadStream).Free)
	return stream, nil
}