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)
| 61 | // result in an inconsistent repository (the objects in the memory store won't |
| 62 | // be accessible). |
| 63 | func (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 | // |