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

Re: [PATCH 4/9] Discard "deleted" cache entries after using them to update the working tree

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Feb 5, 2008, 20:38 UTC
Message-ID
<alpine.LNX.1.00.0802042122400.13593@iabervon.org>
In-Reply-To
<alpine.LSU.1.00.0802050123330.8543@racer.site>
On Tue, 5 Feb 2008, Johannes Schindelin wrote:
Show 24 quoted lines
> Hi,
> 
> On Mon, 4 Feb 2008, Daniel Barkalow wrote:
> 
> > Way back in read-tree.c, we used a mode 0 cache entry to indicate that 
> > an entry had been deleted, so that the update code would remove the 
> > working tree file, and we would just skip it when writing out the index 
> > file afterward.
> > 
> > These days, unpack_trees is a library function, and it is still leaving 
> > these entries in the active cache. Furthermore, unpack_trees doesn't 
> > correctly ignore those entries, and who knows what other code wouldn't 
> > expect them to be there, but just isn't yet called after a call to 
> > unpack_trees. To avoid having other code trip over these entries, have 
> > check_updates() remove them after it removes the working tree files.
> > 
> > While we're at it, make the loop more obvious and skip passing in 
> > globals to a static function with only one caller.
> 
> After reading the code I understand what you mean.  How about
> 
> 	While at it, make the loop removing those entries more obvious, 
> 	and avoid passing global variables as parameters to 
> 	check_updates(): there is only one call site anyway.

It's the loop's flow control that I'm making more obvious (using a normal for loop instead of a while loop that counts down the number of entries while counting up the pointer to the entry under consideration). I'll clarify the message for the next version.

	-Daniel
*This .sig left intentionally blank*
Previous: Johannes Schindelin
Message 3 of 3 in “Discard "deleted" cache entries after using them to update the working tree”
  1. 4/9 Discard "deleted" cache entries after using them to update the working treeDaniel Barkalow, Feb 4, 2008
  2. Johannes SchindelinFeb 5, 2008
  3. Daniel BarkalowFeb 5, 2008

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.