Re: possible bug in git apply?
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 6, 2007, 08:29 UTC
- Message-ID
- <7vabt5dq11.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <alpine.LFD.0.999.0708050949220.5037@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 6 quoted lines
> 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.