On Sat, 4 Aug 2007, Junio C Hamano wrote: > > > > Does this fix it? Totally untested, but it _looks_ obvious enough.. > > That would regress the fix made in aea19457, I am afraid. The fix in aea19457 is broken anyway. Why? That whole "do it in two phases" thing breaks it. What can happen is that you have a directory with 100 files, and: - a patch modifies 99 of them - and removes one What happens is that during phase 0, we'll remove all the files (and *not* write new ones), and then beause the last patch entry is a removal, we'll also remove the directory (which succeeds, because all the files that got modified are all long gone). Then, in phase 1, we'll re-create the files that we modified, and create a whole new directory. IOW, as far as I can see we _already_ delete and then recreate the directory structure under some circumstances. I just extended it to also do it for "rename" and not just delete, since a rename may be renaming it to another directory. So I'd say that my patch is a clear improvement on the current situation. That said, if we really wanted to get it right, we should do this as a three-phase thing: (1) remove old files (2) create new files (3) for all removals and renames, try to remove source directories that might have become empty. That would fix it properly and for all cases. Linus - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html