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, 18:50 UTC
Message-ID
<853ayxiznp.fsf@lola.goethe.zz>
In-Reply-To
<alpine.LFD.0.999.0708051106020.5037@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
> On Sun, 5 Aug 2007, David Kastrup wrote:
[...]
Show 15 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.
>> 
>> Stupid question from someone without good background: why do we need
>> two passes in the first place?
>
> For example, a patch that removes a directory structure "x/..." and then 
> creates a file "x" in its place.
>
> In order for the patch ordering to not matter, you want to do the
> "remove old state" in an earlier phase.

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.

If you had bothered reading my mail to the end: I explained exactly that. So your three pass scheme actually breaks the case for which the two-pass scheme has been designed.

I propose you read my previous mail to its end: I explain a scheme that will work in this case, but it would, as far as I understand index processing, necessitate changing the index sort order, basically having -depth order for deletion entries.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Previous: Linus TorvaldsNext: Linus Torvalds
Message 11 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.