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

Method Write

odb.go:480–495  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

478}
479
480func (writepack *OdbWritepack) Write(data []byte) (int, error) {
481 header := (*reflect.SliceHeader)(unsafe.Pointer(&data))
482 ptr := unsafe.Pointer(header.Data)
483 size := C.size_t(header.Len)
484
485 runtime.LockOSThread()
486 defer runtime.UnlockOSThread()
487
488 ret := C._go_git_odb_writepack_append(writepack.ptr, ptr, size, &writepack.stats)
489 runtime.KeepAlive(writepack)
490 if ret < 0 {
491 return 0, MakeGitError(ret)
492 }
493
494 return len(data), nil
495}
496
497func (writepack *OdbWritepack) Commit() error {
498 runtime.LockOSThread()

Callers

nothing calls this directly

Calls 1

MakeGitErrorFunction · 0.85

Tested by

no test coverage detected