Write writes to the stream
(data []byte)
| 433 | |
| 434 | // Write writes to the stream |
| 435 | func (stream *OdbWriteStream) Write(data []byte) (int, error) { |
| 436 | header := (*reflect.SliceHeader)(unsafe.Pointer(&data)) |
| 437 | ptr := (*C.char)(unsafe.Pointer(header.Data)) |
| 438 | size := C.size_t(header.Len) |
| 439 | |
| 440 | runtime.LockOSThread() |
| 441 | defer runtime.UnlockOSThread() |
| 442 | |
| 443 | ret := C.git_odb_stream_write(stream.ptr, ptr, size) |
| 444 | runtime.KeepAlive(stream) |
| 445 | if ret < 0 { |
| 446 | return 0, MakeGitError(ret) |
| 447 | } |
| 448 | |
| 449 | return len(data), nil |
| 450 | } |
| 451 | |
| 452 | // Close signals that all the data has been written and stores the |
| 453 | // resulting object id in the stream's Id field. |
nothing calls this directly
no test coverage detected