Re: possible bug in git apply?
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:27
Linus Torvalds [off-list ref] writes:
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.
Actually that will break the case of removing foo/bar, which is the only file in directory foo, and creating a new file foo. So if we really want to do all the corner cases, we would need to do something like: * scan the list of files that will remain (i.e., renamed-to, modifed-in-place and created-anew) to note which directories should remain in the result; * remove old files, and remove its empty parent directories that are not in the above list; * create new files. But in the meantime for 1.5.3, I think your patch is better than what we currently have.