Dump all the queued in-memory writes to a packfile.
The contents of the packfile will be stored in the given buffer. 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 the generated packfile is available to the repository,
call git_mempack_reset
to cleanup the memory store.
Calling git_mempack_reset
before the packfile has been
written to disk will result in an inconsistent repository
(the objects in the memory store won't be accessible).
0 on success; error code otherwise