"Elijah Newren via GitGitGadget" [off-list ref] writes:
From: Elijah Newren <redacted>
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?