Write the new pack and corresponding index file to path.
to the directory where the packfile and index should be stored
function to call with progress information from the indexer (optional)
payload for the progress callback (optional)
0 or an error code