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

Re: [PATCH v2] fetch: remove fetch_if_missing=0

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 8, 2019, 07:40 UTC
Message-ID
<xmqqmud6n7e5.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<xmqqr22inagr.fsf@gitster-ct.c.googlers.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 11 quoted lines
> An interesting thing is that c32ca691c2^2 that moved the assignment
> to this big red switch variable around causes 3-way merge to fail in
> a miserable way.  The "moving around" would involve removing from
> the same location as the rebased patch below removes, plus adding
> the assignment elsewhere, so "both sides removed the assignment from
> this hunk, so take that" would correctly leave the original assignment
> we see in the second hunk above removed, but fails to notice that
> the assignment made elsewhere (the result of "moving around" patch)
> is no longer needed, because "c32ca691c2^2 added one and this change
> does not do anything there, so take the addition" cleanly resolves
> to an incorrect merge result.

Total tangent. One frustrating thing is that we do this a bit better at the tree level merge. After read-tree does three-way merge at the tree level, what is passed to the merge-recursive machinery has "side A added" and "side A removed" left unresolved, so that the post-processing phase could try to match them up and say "aha, side A moved that path elsewhere while side B just removed, which is a conflict".

I wish if xdiff/xmerge.c could learn a similar trick, but the necessary change feels quite involved, error prone and too magical.

Previous: Junio C Hamano
Message 12 of 12 in “fetch: remove fetch_if_missing=0”
  1. fetch: remove fetch_if_missing=0Jonathan Tan, Nov 1, 2019
  2. Jonathan NiederNov 1, 2019
  3. Junio C HamanoNov 2, 2019
  4. Eric SunshineNov 2, 2019
  5. Junio C HamanoNov 2, 2019
  6. Jonathan TanNov 5, 2019
  7. Jonathan NiederNov 5, 2019
  8. fetch: remove fetch_if_missing=0Jonathan Tan, Nov 5, 2019
  9. Eric SunshineNov 5, 2019
  10. Junio C HamanoNov 6, 2019
  11. Junio C HamanoNov 8, 2019
  12. Junio C HamanoNov 8, 2019

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.