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

Method Dump

mempack.go:63–77  ·  view source on GitHub ↗

Dump dumps all the queued in-memory writes to a packfile. It is the caller's responsibility to ensure that the generated packfile is available to the repository (e.g. by writing it to disk, or doing something crazy like distributing it across several copies of the repository over a network). Once

(repository *Repository)

Source from the content-addressed store, hash-verified

61// result in an inconsistent repository (the objects in the memory store won't
62// be accessible).
63func (mempack *Mempack) Dump(repository *Repository) ([]byte, error) {
64 buf := C.git_buf{}
65
66 runtime.LockOSThread()
67 defer runtime.UnlockOSThread()
68
69 ret := C.git_mempack_dump(&buf, repository.ptr, mempack.ptr)
70 runtime.KeepAlive(repository)
71 if ret < 0 {
72 return nil, MakeGitError(ret)
73 }
74 defer C.git_buf_dispose(&buf)
75
76 return C.GoBytes(unsafe.Pointer(buf.ptr), C.int(buf.size)), nil
77}
78
79// Reset resets the memory packer by clearing all the queued objects.
80//

Callers 1

TestMempackFunction · 0.95

Calls 1

MakeGitErrorFunction · 0.85

Tested by 1

TestMempackFunction · 0.76