fix deletion of .git/objects sub-directories in git-prune/repack
Both git-prune and git-repack (and thus, git-gc) try to rmdir while holding a DIR* handle on the directory. This can leave dangling empty directories in the .git/objects on platforms where directory cannot be removed while they are open. First call closedir() and then rmdir(); that is more logical ordering. Reported-by: John Chen <john0312@gmail.com> Reported-by: Stefan Naewe <stefan.naewe@gmail.com> Signed-off-by: Karsten Blees <blees@dcon.de> Improved-and-Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
0dbe6592cc
commit
d34e70d6b8
@ -85,9 +85,9 @@ static int prune_dir(int i, char *path)
|
||||
}
|
||||
fprintf(stderr, "bad sha1 file: %s/%s\n", path, de->d_name);
|
||||
}
|
||||
closedir(dir);
|
||||
if (!show_only)
|
||||
rmdir(path);
|
||||
closedir(dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user