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

Re: 3-way read-tree case matrix.

From
Junio C Hamano <junkio@cox.net>
Date
Jun 8, 2005, 05:32 UTC
Message-ID
<7v7jh5ct1b.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7vzmu1ec7w.fsf_-_@assigned-by-dhcp.cox.net>

I suspect my mailer dropped your response on the floor when it polled my ISP at around 21:27 my time. I found its log mentioning your address but no message in my mailbox.

Since the last message I sent you, I updated read-tree.c to match the proposed behaviour, and I found a couple of problems with it by running the 3-way merge test we already have. I am attaching a revised one. I have not finished a new test suite that runs on a populated index file yet, which is what I plan to do next.

There is one thing that the proposed table changes from the traditional 3-way merge semantics. I think this is a sensible change.

 - #2 and #3 (I botched #3 in the earlier one I sent you);
   traditionally we left <O,H,M>=<none,none,exists> and
   <O,H,M>=<none,exists,none> cases to the script policy; we
   could salvage a (potentially dirty) cache entry if we say we
   pick the one created in only one branch.

Earlier I botched <O,H,M>=<some,H!=O,M!=O> case in the table; we should collapse to H/M if H==M; this is now handled differently from H!=O,M!=O,H!=M case (case #10) as case #11 in the updated table.

------------
"git-diff-tree -m O H M"
    O       H       M         result      index requirements
------------------------------------------------------------------
  1 missing missing missing   -           must not exist.
 -----------------------------------------------------------------
  2 missing missing exists    take M      must match M, if exists.
 -----------------------------------------------------------------
  3 missing exists  missing   take H      must match H, if exists.
 -----------------------------------------------------------------
  4 missing exists  exists    no merge    must match H and be
					  up-to-date, if exists.
 -----------------------------------------------------------------
  5 exists  missing missing   no merge    must not exist.
 -----------------------------------------------------------------
  6 exists  missing O==M      remove      must not exist.
 -----------------------------------------------------------------
  7 exists  missing O!=M      no merge    must not exist.
 -----------------------------------------------------------------
  8 exists  O==H    missing   remove      must match H and be
					  up-to-date, if exists.
 -----------------------------------------------------------------
  9 exists  O!=H    missing   no merge    must match H and be
					  up-to-date, if exists.
 -----------------------------------------------------------------
 10 exists  O!=H    O!=M      no merge    must match H and be
		    M!=H		  up-to-date, if exists.
 -----------------------------------------------------------------
 11 exists  O!=H    O!=M      take H	  must match H, if exists.
		    M==H
 -----------------------------------------------------------------
 12 exists  O!=H    O==M      take H      must match H, if exists.
 -----------------------------------------------------------------
 13 exists  O==H    O!=M      take M      if exists, must either (1)
    					  match H and be up-to-date,
                                          or (2) match M.
 -----------------------------------------------------------------
 14 exists  O==H    O==M      take M      must match H if exists.
------------------------------------------------------------------

In all "take H" or "take M" cases, if the original index matches what is taken, I would reuse it, and keep it dirty if it is.

The goal is, "(a) do not clobber the current index; (b) arrive at the same result as in the case started with an empty index; (c) favor success over failure as long as (a) and (b) are satisfied."

Previous: Junio C HamanoNext: Junio C Hamano
Message 24 of 25 in “Documentation: describe git extended diff headers.”
  1. Documentation: describe git extended diff headers.Junio C Hamano, Jun 5, 2005
  2. Linus TorvaldsJun 5, 2005
  3. Fix diff.c to match rename extended header to the document.Junio C Hamano, Jun 5, 2005
  4. Fix apply.c to match rename extended header to the document.Junio C Hamano, Jun 5, 2005
  5. Linus TorvaldsJun 5, 2005
  6. Last mile for 1.0Junio C Hamano, Jun 5, 2005
  7. Junio C HamanoJun 5, 2005
  8. McMullan, JasonJun 6, 2005
  9. Linus TorvaldsJun 6, 2005
  10. git-whatchanged vs "cvs annotate"Junio C Hamano, Jun 6, 2005
  11. Thomas GlanzmannJun 6, 2005
  12. Linus TorvaldsJun 6, 2005
  13. Junio C HamanoJun 6, 2005
  14. Linus TorvaldsJun 6, 2005
  15. Thomas GlanzmannJun 6, 2005
  16. Linus TorvaldsJun 6, 2005
  17. Thomas GlanzmannJun 6, 2005
  18. Junio C HamanoJun 6, 2005
  19. Linus TorvaldsJun 6, 2005
  20. Junio C HamanoJun 6, 2005
  21. Linus TorvaldsJun 6, 2005
  22. Linus TorvaldsJun 6, 2005
  23. 3-way read-tree case matrix.Junio C Hamano, Jun 8, 2005
  24. Junio C HamanoJun 8, 2005
  25. Tests: read-tree -m test updates.Junio C Hamano, Jun 8, 2005

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.