Re: possible bug in git apply?
From: David Kastrup <hidden>
Date: 2016-06-15 22:43:27
Linus Torvalds [off-list ref] writes:
On Sun, 5 Aug 2007, David Kastrup wrote:quoted
But your proposed three passes won't work with a patch removing "x/..." and creating "x" in its place, since "x/" gets only removed in pass 3, and "x" needs to created in pass 2 already.Yes, I was wrong. The current two passes are the right thing to do, and we should just always remove empty directories (and my patch was fine: we can leave them alone if it's a pure "modify file in place", but that's really the only case).
The consequence will be that renaming all files in one directory (and "all" can even be a single file) will temporarily delete and recreate that directory. My proposed change of index sort and processing order would take care of that without requiring multiple passes, at the cost of changing the index format and processing. I think that it would be a sound long-term solution. Anyway, once directories can be tracked (again necessitating a change of index format), surprising directory deletion and recreation should become less of an issue, but it won't help with projects that continue not tracking directories (presumably most patch-based workflows). -- David Kastrup, Kriemhildstr. 15, 44793 Bochum