MCPcopy Create free account
hub / github.com/libgit2/git2go / ReadHeader

Method ReadHeader

odb.go:116–130  ·  view source on GitHub ↗
(oid *Oid)

Source from the content-addressed store, hash-verified

114}
115
116func (v *Odb) ReadHeader(oid *Oid) (uint64, ObjectType, error) {
117 runtime.LockOSThread()
118 defer runtime.UnlockOSThread()
119
120 var sz C.size_t
121 var cotype C.git_object_t
122
123 ret := C.git_odb_read_header(&sz, &cotype, v.ptr, oid.toC())
124 runtime.KeepAlive(v)
125 if ret < 0 {
126 return 0, ObjectInvalid, MakeGitError(ret)
127 }
128
129 return uint64(sz), ObjectType(cotype), nil
130}
131
132func (v *Odb) Exists(oid *Oid) bool {
133 ret := C.git_odb_exists(v.ptr, oid.toC())

Callers 1

TestOdbReadFunction · 0.80

Calls 3

MakeGitErrorFunction · 0.85
ObjectTypeTypeAlias · 0.85
toCMethod · 0.45

Tested by 1

TestOdbReadFunction · 0.64