git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: possible bug in git apply?

From
David Kastrup <dak@gnu.org>
Date
Aug 5, 2007, 19:37 UTC
Message-ID
<85odhlhiwq.fsf@lola.goethe.zz>
In-Reply-To
<alpine.LFD.0.999.0708051219440.5037@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 10 quoted lines
> On Sun, 5 Aug 2007, David Kastrup wrote:
>> 
>> 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
Previous: Linus TorvaldsNext: Junio C Hamano
Message 13 of 15 in “possible bug in git apply?”
  1. david@lang.hmAug 4, 2007
  2. Junio C HamanoAug 4, 2007
  3. David KastrupAug 4, 2007
  4. Linus TorvaldsAug 5, 2007
  5. Linus TorvaldsAug 5, 2007
  6. Junio C HamanoAug 5, 2007
  7. David KastrupAug 5, 2007
  8. Linus TorvaldsAug 5, 2007
  9. David KastrupAug 5, 2007
  10. Linus TorvaldsAug 5, 2007
  11. David KastrupAug 5, 2007
  12. Linus TorvaldsAug 5, 2007
  13. David KastrupAug 5, 2007
  14. Junio C HamanoAug 6, 2007
  15. Junio C HamanoAug 6, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.