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

Method Data

odb.go:373–385  ·  view source on GitHub ↗

Data returns a slice pointing to the unmanaged object memory. You must make sure the object is referenced for at least as long as the slice is used.

()

Source from the content-addressed store, hash-verified

371// Data returns a slice pointing to the unmanaged object memory. You must make
372// sure the object is referenced for at least as long as the slice is used.
373func (object *OdbObject) Data() (data []byte) {
374 var c_blob unsafe.Pointer = C.git_odb_object_data(object.ptr)
375 var blob []byte
376
377 len := int(C.git_odb_object_size(object.ptr))
378
379 sliceHeader := (*reflect.SliceHeader)((unsafe.Pointer(&blob)))
380 sliceHeader.Cap = len
381 sliceHeader.Len = len
382 sliceHeader.Data = uintptr(c_blob)
383
384 return blob
385}
386
387type OdbReadStream struct {
388 doNotCompare

Callers 2

TestIndexerOutOfOrderFunction · 0.80
TestOdbReadFunction · 0.80

Calls

no outgoing calls

Tested by 2

TestIndexerOutOfOrderFunction · 0.64
TestOdbReadFunction · 0.64