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

Re: [PATCH] read-tree A B C: do not create a bogus index and do not segfault

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 14, 2009, 06:41 UTC
Message-ID
<7v7i2sehcb.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<alpine.LFD.2.00.0903120929250.32478@localhost.localdomain>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 14 quoted lines
> On Thu, 12 Mar 2009, Daniel Barkalow wrote:
>
>> I think it might be a good idea to take this as evidence that nobody is 
>> using read-tree with multiple trees without merge, and just disallow it. 
>
> Hmm. It _has_ been used. It's been useful for really odd things 
> historically, namely trying to merge different trees by hand. So while I 
> agree that we could probably remove it, it _is_ a very interesting 
> feature in theory, and since we have the code.. 
>
> So I'd say "add a few tests for the known horrible cases" should be the 
> first approach. If it ever actually breaks again and becomes a big 
> maintenance headache, maybe _then_ remove the feature as not being worth 
> the pain?

I've added trivial tests and will start cooking it by letting it go through the usual pu/next/master/maint cycle.

I think you are thinking about something like the "gitk" merge (aka "The coolest merge EVER!" [*1*]), but you can do the same thing more safely with -m option, giving an empty tree as the common ancestor. Especially if you run it in the aggressive mode, "addition" from our tree and their tree, when it is an overlay, will not overlap, and will all cleanly resolve to stage #0.

I suspect you can also use a single tree "read-tree", immediately followed by another "read-tree --prefix=''" to read in two trees into the index and write the results out.

[Footnote]
*1* http://article.gmane.org/gmane.comp.version-control.git/5126
Previous: Linus Torvalds
Message 11 of 11 in “[BUG] - git-read-tree segfaults”
  1. Jiri OlsaMar 10, 2009
  2. Johannes SchindelinMar 10, 2009
  3. Johannes SchindelinMar 10, 2009
  4. Jiri OlsaMar 11, 2009
  5. Johannes SchindelinMar 11, 2009
  6. Junio C HamanoMar 12, 2009
  7. Junio C HamanoMar 12, 2009
  8. read-tree A B C: do not create a bogus index and do not segfaultJunio C Hamano, Mar 12, 2009
  9. Daniel BarkalowMar 12, 2009
  10. Linus TorvaldsMar 12, 2009
  11. Junio C HamanoMar 14, 2009

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.