odb: Expose git_odb_object_type() as OdbObject.Type()

It might be needed when one is writing `git cat-file --batch` equivalent
which has output format

    <sha1> SP <type> SP <size> LF
    <contents> LF
This commit is contained in:
Kirill Smelkov 2016-07-19 22:48:52 +03:00
parent 9163ca7d50
commit cf7553e72c
1 changed files with 4 additions and 0 deletions

4
odb.go
View File

@ -226,6 +226,10 @@ func (object *OdbObject) Len() (len uint64) {
return uint64(C.git_odb_object_size(object.ptr))
}
func (object *OdbObject) Type() ObjectType {
return ObjectType(C.git_odb_object_type(object.ptr))
}
func (object *OdbObject) Data() (data []byte) {
var c_blob unsafe.Pointer = C.git_odb_object_data(object.ptr)
var blob []byte