Пример #1
0
func (odb *Odb) ReadHeader(oid *Oid) (int, ObjectType, error) {
	var clen C.size_t
	var ctype C.git_otype
	ecode := C.git_odb_read_header(&clen, &ctype, odb.git_odb, oid.git_oid)
	if ecode != git_SUCCESS {
		return int(clen), ObjectType(ctype), gitError()
	}
	return int(clen), ObjectType(ctype), nil
}
Пример #2
0
func (v *Odb) ReadHeader(oid *Oid) (uint64, ObjectType, error) {
	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	var sz C.size_t
	var cotype C.git_otype

	ret := C.git_odb_read_header(&sz, &cotype, v.ptr, oid.toC())
	if ret < 0 {
		return 0, C.GIT_OBJ_BAD, MakeGitError(ret)
	}

	return uint64(sz), ObjectType(cotype), nil
}