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

Re: [PATCH] mru: Replace mru.[ch] with list.h implementation

From
Jeff King <peff@peff.net>
Date
Nov 12, 2017, 16:16 UTC
Message-ID
<20171112161617.fhysws3idztguu23@sigill.intra.peff.net>
In-Reply-To
<CAOCi2DGYQr4jFf5ObY2buyhNJeaAPQKF8tbojn2W0b18Eo+Wgw@mail.gmail.com>
On Sun, Nov 12, 2017 at 12:49:17PM +0000, Gargi Sharma wrote:
Show 21 quoted lines
> > Sort of a side note, but seeing these two list pointers together makes
> > me wonder what we should do with the list created by the "next" pointer.
> > It seems like there are three options:
> >
> >   1. Convert it to "struct list_head", too, for consistency.
> >
> >   2. Leave it as-is. We never delete from the list nor do any fancy
> >      manipulation, so it doesn't benefit from the reusable code.
> >
> >   3. I wonder if we could drop it entirely, and just keep a single list
> >      of packs, ordered by mru. I'm not sure if anybody actually cares
> >      about accessing them in the "original" order. That order is
> >      reverse-chronological (by prepare_packed_git()), but I think that
> >      was mostly out of a sense that recent packs would be accessed more
> >      than older ones (but having a real mru strategy replaces that
> >      anyway).
> >
> > What do you think?
> I think in the long run, it'll be easier if there is only a single
> list of packs given
> that no one needs to access the list in order.

Yeah, it's that "given..." that makes me just a little nervous that I'm missing something.

> If we go down road 1/3, would it be better if I sent an entirely
> different patch or
> a patch series with patch 1 as removing mru[.ch] and patch 2 as removing
> next pointer from the struct?

I think you could do it as a 2-patch series like that, or you could send the first patch now (since I think it stands on its own merits) and do the other one later on top.

Show 7 quoted lines
> > This matches the original code, which did the clear/re-create, resetting
> > the mru to the "original" pack order. But I do wonder if that's actually
> > necessary. Could we skip that and just add any new packs to the list?
> 
> But if we do not clear the older entries from the list, wouldn't there be a
> problem when you access packed_git_mru->next, since that will be populated
> instead of being empty? Or am I misunderstanding something here?

What I mean is that instead of clearing and re-adding all of the packs (including any new ones we picked up by rescanning the directory), we would _just_ add new ones to the list.

So I think we'd scrap this whole "set up the mru" preparation here and just teach install_packed_git() to add the new pack to the MRU list.

-Peff
Previous: Gargi SharmaNext: Оля Тележная
Message 5 of 6 in “mru: Replace mru.[ch] with list.h implementation”
  1. mru: Replace mru.[ch] with list.h implementationGargi Sharma, Nov 11, 2017
  2. Jeff KingNov 12, 2017
  3. Jeff KingNov 12, 2017
  4. Gargi SharmaNov 12, 2017
  5. Jeff KingNov 12, 2017
  6. Оля ТележнаяDec 12, 2017

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.