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

Re: [PATCH 3/3] builtin/repack.c: don't move existing packs out of the way

From
Taylor Blau <me@ttaylorr.com>
Date
Nov 17, 2020, 00:26 UTC
Message-ID
<X7MYtjLQmmhfyHA5@nand.local>
In-Reply-To
<20201117000252.GB12322@coredump.intra.peff.net>
On Mon, Nov 16, 2020 at 07:02:52PM -0500, Jeff King wrote:
Show 12 quoted lines
> I think you could make an argument either way:
>
>   - we have an existing bitmap for free, and bitmaps make things faster,
>     so why not keep it?
>
>   - the user did not ask for bitmaps, so we should make the outcome
>     consistent whether a pack of the exact name existed before or not
>
> The second one seems less surprising to me. But I think if we did the
> first, the code would be shorter (it would not need any of this "keep
> track of what pack-objects generated" stuff at all, but would just copy
> whatever files we see into place).

I think that the second one is _far_ less surprising to me, so I'd prefer that we did that instead of keeping the .bitmap from the last run regardless of whether or not the user asked for it.

Show 19 quoted lines
> > >  				if (rename(fname_old, fname))
> > >  					die_errno(_("renaming '%s' failed"), fname_old);
> >
> > OK, so this is where the previous step matters.  We do the same as
> > before (i.e. stat+chmod and rename) only for paths we have created.
> >
> > We don't reuse the old one because we have already written a new
> > file so we won't save anything by doing so, and checking if the
> > target of rename exists already before deciding not to rename cannot
> > be made atomic, so just relying on rename() to do the right thing is
> > a good idea anyway.
>
> Even though the pack is byte-for-byte identical, the new .idx, etc,
> might not be. And those could be affected by options. E.g.:
>
>   git -c pack.writeBitmapHashCache=false repack -adb
>   git -c pack.writeBitmapHashCache=true  repack -adb
>
> should probably end up with a bitmap file that contains a hash cache.
Agreed completely.
> -Peff

Thanks, Taylor

Previous: Jeff KingNext: Taylor Blau
Message 7 of 11 in “repack: don't move existing packs out of the way”
  1. 0/3 repack: don't move existing packs out of the wayTaylor Blau, Nov 16, 2020
  2. 1/3 repack: make "exts" array available outside cmd_repack()Taylor Blau, Nov 16, 2020
  3. 2/3 builtin/repack.c: keep track of what pack-objects wroteTaylor Blau, Nov 16, 2020
  4. 3/3 builtin/repack.c: don't move existing packs out of the wayTaylor Blau, Nov 16, 2020
  5. Junio C HamanoNov 16, 2020
  6. Jeff KingNov 17, 2020
  7. Taylor BlauNov 17, 2020
  8. Taylor BlauNov 17, 2020
  9. Junio C HamanoNov 17, 2020
  10. Taylor BlauNov 17, 2020
  11. Junio C HamanoNov 17, 2020

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.