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

Re: [PATCH] sha1_name: support sha1^{note} to return note sha-1

From
Jeff King <peff@peff.net>
Date
May 9, 2012, 17:26 UTC
Message-ID
<20120509172647.GA30487@sigill.intra.peff.net>
In-Reply-To
<CALKQrgdGCoKooM7KayNMQ_+Fg9=-1YnwNE_9NHzpX0jfoRjT_A@mail.gmail.com>
On Wed, May 09, 2012 at 04:09:35PM +0200, Johan Herland wrote:
Show 9 quoted lines
> > No idea. I have never worked/used notes until yesterday (and these
> > patches were the result). I will look into it.
> 
> IIRC, the initialization loads the top-level notes tree object into
> memory. Subtrees (if any) are loaded on demand. FTR, if you have less
> then ~256 notes in the notes tree, there will be no subtrees. As the
> number of notes grows, the number of subtree levels grow roughly
> logarithmically with the total number of notes (see determine_fanout()
> for more details).

Ah, right. I was thinking back to my original crappy implementation that didn't do fanout. So I don't think an init is that bad. It does look up the ref each time, but it will only load the top-level tree object (which you would need to do a lookup anyway).

So it is probably OK to just do an init/lookup/free each time if it makes the code simpler (and I think it does). We probably won't be looking up sha1^{note} in a tight loop, anyway, since sha1 expressions like that generally come from the command line.

-Peff
Previous: Johan Herland
Message 5 of 5 in “sha1_name: support sha1^{note} to return note sha-1”
  1. sha1_name: support sha1^{note} to return note sha-1Nguyễn Thái Ngọc Duy, May 8, 2012
  2. Jeff KingMay 8, 2012
  3. Nguyen Thai Ngoc DuyMay 9, 2012
  4. Johan HerlandMay 9, 2012
  5. Jeff KingMay 9, 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.