Skip to content

Commit

Permalink
prune: close directory earlier during loose-object directory traversal
Browse files Browse the repository at this point in the history
27e1e22 (prune: factor out loose-object directory traversal, 2014-10-16)
introduced a new function for_each_loose_file_in_objdir() with a helper
for_each_file_in_obj_subdir(). The latter calls callbacks for each file
found during a directory traversal and finally also a callback for the
directory itself.

git-prune uses the function to clean up the object directory. In
particular, in the directory callback it calls rmdir(). On Windows XP,
this rmdir call fails, because the directory is still open while the
callback is called. Close the directory before calling the callback.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
j6t authored and dscho committed Nov 7, 2015
1 parent 4ded373 commit c1aa08f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sha1_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -3518,12 +3518,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;
}

Expand Down

0 comments on commit c1aa08f

Please sign in to comment.