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

Re: [PATCH] apply: when -R, also reverse list of sections

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 28, 2020, 22:07 UTC
Message-ID
<xmqqy2ktk11t.fsf@gitster.c.googlers.com>
In-Reply-To
<20200928212038.1625698-1-jonathantanmy@google.com>
Jonathan Tan <jonathantanmy@google.com> writes:
Show 7 quoted lines
> A patch changing a symlink into a file is written with 2 sections (in
> the code, represented as "struct patch"): firstly, the deletion of the
> symlink, and secondly, the creation of the file. When applying that
> patch with -R, the sections are reversed, so we get:
>
>  (1) creation of a symlink, then
>  (2) deletion of a file.
Good observation.

But I have to wonder if it breaks the support for (arguably outside the Git usecase) input that has more than one patch that touches the same path to blindly reverse the order of all patches (instead of the obvious implementation of the fix for the above stated problem --- i.e. make sure the first patch is a deletion of a symlink and what immediately follows is a creation of a regular file, and swap them only in such a case).

Previous: Jonathan TanNext: Jonathan Tan
Message 2 of 8 in “apply: when -R, also reverse list of sections”
  1. apply: when -R, also reverse list of sectionsJonathan Tan, Sep 28, 2020
  2. Junio C HamanoSep 28, 2020
  3. Jonathan TanOct 20, 2020
  4. Junio C HamanoOct 20, 2020
  5. Junio C HamanoOct 20, 2020
  6. Jonathan TanOct 20, 2020
  7. Junio C HamanoOct 20, 2020
  8. apply: when -R, also reverse list of sectionsJonathan Tan, Oct 20, 2020

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.