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

Re: clarifying two tree merge semantics

From
Junio C Hamano <junkio@cox.net>
Date
Jun 6, 2005, 19:59 UTC
Message-ID
<7voeajp875.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.58.0506061210490.1876@ppc970.osdl.org>

By the way, there is one case that you need to keep an eye on if you are making further fixes to "git-read-tree -m $H $M", especially now we are talking about keeping what we slurp from stage0 sometimes:

 (1) index has DF (file)
 (2) $H has DF (file); the index matches it.
 (3) $M has DF/DF (file), implicitly making DF a directory.
For path DF, this rule from the earlier matrix applies:
  exists          exists (index=$H)       no such path        *2*
  * path is removed.
For path DF/DF, this rule from the earlier matrix applies:
  no such path    no such path            exists
  * take $M without complaining.

Thanks to *2*, the current code gets it right and we do not end up with a cache that records both DF and DF/DF at the same time. I cannot tell if it is by design or by accident :-).

There is a safety valve at the end of write-tree to refuse to write out such a nonsensical tree but as Pasky argued back then (a similar problem was discussed and resolved when you were away, around the beginning of May, involving update-cache), when that safety valuve was added, the damage has already been done if we allow such a cache entry to be created in the first place.

Previous: Linus Torvalds
Message 3 of 3 in “new read-tree questions.”
  1. Junio C HamanoJun 6, 2005
  2. Linus TorvaldsJun 6, 2005
  3. Junio C HamanoJun 6, 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.