Win32: fix detection of empty directories in is_dir_empty
commit94948aa6dc2633a4b73604b0100a0f726e139ad1
authorKarsten Blees <blees@dcon.de>
Thu, 15 Mar 2012 19:37:26 +0000 (15 20:37 +0100)
committerStepan Kasal <kasal@ucw.cz>
Thu, 29 May 2014 08:40:27 +0000 (29 10:40 +0200)
tree61f9b7707b44fca9a5f8e09664f79f9e9acfdf19
parent80e6f0f8be9e30c98d3487574bcc06e14d581357
Win32: fix detection of empty directories in is_dir_empty

On Windows XP (not Win7), directories cannot be deleted while a find handle
is open, causing "Deletion of directory '...' failed. Should I try again?"
prompts.

Prior to 19d1e75d "Win32: Unicode file name support (except dirent)",
these failures were silently ignored due to strbuf_free in is_dir_empty
resetting GetLastError to ERROR_SUCCESS.

Close the find handle in is_dir_empty so that git doesn't block deletion
of the directory even after all other applications have released it.

Reported-by: John Chen <john0312@gmail.com>
Signed-off-by: Karsten Blees <blees@dcon.de>
compat/mingw.c