Win32: fix detection of empty directories in is_dir_empty
commit5bb47de1ac26ee8ee57c8b330c01cd2af2a5f4de
authorKarsten Blees <blees@dcon.de>
Thu, 15 Mar 2012 19:37:26 +0000 (15 20:37 +0100)
committerJohannes Schindelin <johannes.schindelin@gmx.de>
Tue, 29 May 2012 02:48:16 +0000 (28 21:48 -0500)
treed3aa1efb6e88358190620949ec5e0f605ea4dcf6
parent14e4b77ad06ef95a2a0df14dbf5c3c666271642e
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