Merge branch 'jk/prune-mtime' into maint
authorJunio C Hamano <gitster@pobox.com>
Tue, 15 Dec 2015 17:27:11 +0000 (09:27 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 15 Dec 2015 17:27:12 +0000 (09:27 -0800)
The helper used to iterate over loose object directories to prune
stale objects did not closedir() immediately when it is done with a
directory--a callback such as the one used for "git prune" may want
to do rmdir(), but it would fail on open directory on platforms
such as WinXP.

* jk/prune-mtime:
prune: close directory earlier during loose-object directory traversal

sha1_file.c
index 4160e6882de40b2e032727616084a08c94a1e565..72289696d9f50d823cf20c5cfaf1847eba3b2708 100644 (file)
@@ -3507,12 +3507,12 @@ static int for_each_file_in_obj_subdir(int subdir_nr,
                                break;
                }
        }
-       strbuf_setlen(path, baselen);
+       closedir(dir);
 
+       strbuf_setlen(path, baselen);
        if (!r && subdir_cb)
                r = subdir_cb(subdir_nr, path->buf, data);
 
-       closedir(dir);
        return r;
 }