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

Re: [PATCH] repack: only repack .packs that exist

From
Taylor Blau <me@ttaylorr.com>
Date
Jul 10, 2023, 19:39 UTC
Message-ID
<ZKxejN7JQDWpNTAz@nand.local>
In-Reply-To
<20230702131117.GB1036686@coredump.intra.peff.net>
On Sun, Jul 02, 2023 at 09:11:17AM -0400, Jeff King wrote:
Show 15 quoted lines
> On Thu, Jun 29, 2023 at 05:24:40AM -0400, Taylor Blau wrote:
>
> > > I also kind of wonder if this repack code should simply be loading and
> > > iterating the packed_git list, but that is a much bigger change.
> >
> > I have wanted to do this for a while ;-). The minimal patch is less
> > invasive than I had thought:
>
> Yeah, I agree it's not too bad. If we want to go that route, though, I
> think we should do it on top of Stolee's patch, though (which makes it a
> pure cleanup once the behaviors are aligned).
>
> I'm also not sure if you'd need to do anything tricky with alternate
> object dirs (it looks like the existing code ignores them entirely, so I
> guess we'd want to skip entries without pack_local set).

Yep, we definitely want a `if (!p->is_local) continue` in there to be consistent with the existing behavior.

Show 15 quoted lines
> > [...]
> > I think you could probably go further than this, since having to store
> > the suffix-less pack names in the fname_kept and fname_nonkept lists is
> > kind of weird.
> >
> > It would be nice if we could store pointers to the actual packed_git
> > structs themselves in place of those lists instead, but I'm not
> > immediately sure how feasible it would be to do since we re-prepare the
> > object store between enumerating and then removing these packs.
>
> I think that would work, because we do not ever drop packed_git entries
> from the list (even if the files were deleted between prepare/reprepare).
> But it also creates a subtle memory ownership dependency/assumption
> between the two bits of code. It seems clearer to me to just copy the
> names out to our own lists here (i.e., the patch you showed).

Yeah, I agree. I thought that it might clean things up further, and to an extent it does:

    https://github.com/ttaylorr/git/compare/tb/collect-packs-readdir

, but I think that the memory ownership issue is sufficiently subtle that the clean-up isn't really worth it.

I put the above patch together with Stolee's, and sent the result back to the list here:

    https://lore.kernel.org/git/cover.1689017830.git.me@ttaylorr.com/T/#t

Thanks, Taylor

Previous: Jeff King
Message 6 of 6 in “repack: only repack .packs that exist”
  1. repack: only repack .packs that existDerrick Stolee via GitGitGadget, Jun 20, 2023
  2. Taylor BlauJun 21, 2023
  3. Jeff KingJun 27, 2023
  4. Taylor BlauJun 29, 2023
  5. Jeff KingJul 2, 2023
  6. Taylor BlauJul 10, 2023

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.