Commit 96df833b by lhchavez

Close the file before unlinking

I forgot that Windows chokes while trying to delete open files.
parent a7ff6e5e
...@@ -1091,6 +1091,12 @@ void git_indexer_free(git_indexer *idx) ...@@ -1091,6 +1091,12 @@ void git_indexer_free(git_indexer *idx)
git_vector_free_deep(&idx->deltas); git_vector_free_deep(&idx->deltas);
/* Try to delete the temporary file in case it was not committed. */ /* Try to delete the temporary file in case it was not committed. */
git_mwindow_free_all(&idx->pack->mwf);
/* We need to close the descriptor here so Windows doesn't choke on unlink */
if (idx->pack->mwf.fd != -1) {
(void)p_close(idx->pack->mwf.fd);
idx->pack->mwf.fd = -1;
}
(void)p_unlink(idx->pack->pack_name); (void)p_unlink(idx->pack->pack_name);
if (!git_mutex_lock(&git__mwindow_mutex)) { if (!git_mutex_lock(&git__mwindow_mutex)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment