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

Re: [RFH] unpack-trees: cache_entry lifetime issue?

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 2, 2012, 19:17 UTC
Message-ID
<7vk432dd89.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4F5102A2.70303@lsrfire.ath.cx>
René Scharfe <rene.scharfe@lsrfire.ath.cx> writes:
Show 11 quoted lines
> which shows some parts of unpack-trees.c that I use as context to
> ask: Should we check for o->merge in line 775, before using src[0]?
>
> If o->merge is 0, the src[0] will be NULL right up to the call of
> unpack_nondirectories() in line 772.  There it may be set (in line
> 582).  In that case we'll end up at line 779, where mark_ce_used()
> is applied to it.
>
> I suspect that this is unintended and that line 775 should rather
> read "if (o->merge && src[0]) {".  Can someone with a better
> understanding of unpack-trees confirm or refute that suspicion?

Yeah, src[0] is meant to hold the entry from the current index to take it as well as our tree into account during o->merge, and I do not think it should affect when we are only reading tree(s) into the index.

I think da165f4 (unpack-trees.c: prepare for looking ahead in the index, 2010-01-07) simply forgot that the codepath also has to work when it is not merging.

Having said that, I do not know offhand if we just should nothing in no-merge case, or we should be doing something else instead, without thinking a bit more.

Previous: René ScharfeNext: René Scharfe
Message 2 of 5 in “[RFH] unpack-trees: cache_entry lifetime issue?”
  1. René ScharfeMar 2, 2012
  2. Junio C HamanoMar 2, 2012
  3. René ScharfeMar 3, 2012
  4. Junio C HamanoMar 5, 2012
  5. René ScharfeMar 6, 2012

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.