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