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

Re: [PATCH 2/3] diff: fix filtering of additional headers under --remerge-diff

From
Elijah Newren <newren@gmail.com>
Date
Sep 1, 2022, 03:38 UTC
Message-ID
<CABPp-BGo6JST9uO-dUEXw1sx6oxCWjBzq9MftLqjcoiFhATMuQ@mail.gmail.com>
In-Reply-To
<xmqq7d2odp8m.fsf@gitster.g>
On Wed, Aug 31, 2022 at 3:26 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 24 quoted lines
>
> "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > From: Elijah Newren <newren@gmail.com>
> >
> > Commit 95433eeed9 ("diff: add ability to insert additional headers for
> > paths", 2022-02-02) introduced the possibility of additional headers.
> > Because there could be conflicts with no content differences (e.g. a
> > modify/delete conflict resolved in favor of taking the modified file
> > as-is), that commit also modified the diff_queue_is_empty() and
> > diff_flush_patch() logic to ensure these headers were included even if
> > there was no associated content diff.
>
> In the longer term, I think we may have to redo the way additional
> headers are inserted to the diff_queue.  All the diff code I am
> familiar with (read: written before this hack was introduced) trusts
> that diff_queue.nr is the number of paths that are returned by the
> diff frontend, and unless there is diffcore_break involved, there
> will be at most one diff_filepair that is about a path.
>
> Why do these need to be separate entries in the queue, not a new
> attribute added to an existing filepair?  Are we inserting pieces of
> information that are not about any paths that are involved in the
> diff?

They usually are added to an existing filepair, but as your last question alludes to, there isn't always one that exists.

One example where this can happen is with a modify/delete conflict. If someone got one of those and decided to keep the modified file as-is when resolving the conflict, then there'd be no content diff to show for that file when investigating the resulting merge commit with --remerge-diff. But since the point of --remerge-diff is to show whatever work the user did to resolve conflicts, and that file was conflicted, we want to show _something_ for that path. Thus the reason for creating a new "phoney" filepair just for attaching the "remerge CONFLICT (modify/delete) ..." notice.

Previous: Junio C HamanoNext: Elijah Newren via GitGitGadget
Message 7 of 23 in “Output fixes for --remerge-diff”
  1. 0/3 Output fixes for --remerge-diffElijah Newren via GitGitGadget, Aug 31, 2022
  2. 1/3 diff: have submodule_format logic avoid additional diff headersElijah Newren via GitGitGadget, Aug 31, 2022
  3. Junio C HamanoAug 31, 2022
  4. Elijah NewrenSep 1, 2022
  5. 2/3 diff: fix filtering of additional headers under --remerge-diffElijah Newren via GitGitGadget, Aug 31, 2022
  6. Junio C HamanoAug 31, 2022
  7. Elijah NewrenSep 1, 2022
  8. 3/3 diff: fix filtering of merge commits under --remerge-diffElijah Newren via GitGitGadget, Aug 31, 2022
  9. Junio C HamanoSep 1, 2022
  10. Elijah NewrenSep 1, 2022
  11. Elijah NewrenSep 1, 2022
  12. Junio C HamanoSep 1, 2022
  13. Ævar Arnfjörð BjarmasonSep 1, 2022
  14. Junio C HamanoSep 1, 2022
  15. 0/3 Output fixes for --remerge-diffElijah Newren via GitGitGadget, Sep 1, 2022
  16. 1/3 diff: have submodule_format logic avoid additional diff headersElijah Newren via GitGitGadget, Sep 1, 2022
  17. Junio C HamanoSep 1, 2022
  18. 2/3 diff: fix filtering of additional headers under --remerge-diffElijah Newren via GitGitGadget, Sep 1, 2022
  19. 3/3 diff: fix filtering of merge commits under --remerge-diffElijah Newren via GitGitGadget, Sep 1, 2022
  20. 0/3 Output fixes for --remerge-diffElijah Newren via GitGitGadget, Sep 2, 2022
  21. 1/3 diff: have submodule_format logic avoid additional diff headersElijah Newren via GitGitGadget, Sep 2, 2022
  22. 3/3 diff: fix filtering of merge commits under --remerge-diffElijah Newren via GitGitGadget, Sep 2, 2022
  23. 2/3 diff: fix filtering of additional headers under --remerge-diffElijah Newren via GitGitGadget, Sep 2, 2022

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.