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

Method NewWritePack

odb.go:321–337  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

319// layer does not understand pack files, the objects will be stored in whatever
320// format the ODB layer uses.
321func (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
339func (v *OdbBackend) Free() {
340 C._go_git_odb_backend_free(v.ptr)

Callers 1

TestOdbWritepackFunction · 0.80

Calls 3

populateRemoteCallbacksFunction · 0.85
untrackCallbacksPayloadFunction · 0.85
MakeGitErrorFunction · 0.85

Tested by 1

TestOdbWritepackFunction · 0.64