NewWritePack opens a stream for writing a pack file to the ODB. If the ODB layer understands pack files, then the given packfile will likely be streamed directly to disk (and a corresponding index created). If the ODB layer does not understand pack files, the objects will be stored in whatever forma
(callback TransferProgressCallback)
| 319 | // layer does not understand pack files, the objects will be stored in whatever |
| 320 | // format the ODB layer uses. |
| 321 | func (v *Odb) NewWritePack(callback TransferProgressCallback) (*OdbWritepack, error) { |
| 322 | runtime.LockOSThread() |
| 323 | defer runtime.UnlockOSThread() |
| 324 | |
| 325 | writepack := new(OdbWritepack) |
| 326 | populateRemoteCallbacks(&writepack.ccallbacks, &RemoteCallbacks{TransferProgressCallback: callback}, nil) |
| 327 | |
| 328 | ret := C._go_git_odb_write_pack(&writepack.ptr, v.ptr, writepack.ccallbacks.payload) |
| 329 | runtime.KeepAlive(v) |
| 330 | if ret < 0 { |
| 331 | untrackCallbacksPayload(&writepack.ccallbacks) |
| 332 | return nil, MakeGitError(ret) |
| 333 | } |
| 334 | |
| 335 | runtime.SetFinalizer(writepack, (*OdbWritepack).Free) |
| 336 | return writepack, nil |
| 337 | } |
| 338 | |
| 339 | func (v *OdbBackend) Free() { |
| 340 | C._go_git_odb_backend_free(v.ptr) |