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

Re: [PATCH] builtin/repack.c: prune unreachable objects with `--expire-to`

From
ZheNing Hu <adlternative@gmail.com>
Date
Jan 15, 2025, 08:08 UTC
Message-ID
<CAOLTT8R3UULA9xrv8FZcTsTE1qvsToU=WgOEWMfuO0vq5ztUAw@mail.gmail.com>
In-Reply-To
<20241201213439.GA145938@coredump.intra.peff.net>
Show 26 quoted lines
> OK, so we are adding the containing directory as an alternate. That
> gives me two concerns:
>
>   1. The expire-to string is something like "path/to/objects/pack/pack",
>      and we'll have created "path/to/objects/pack/pack-<hash>.pack"
>      Using dirname() strips that down to "path/to/objects/pack". OK. And
>      then we manually strip "pack/" off the end, which we have to do to
>      get the "base" objects/ directory.
>
>      But what if the path given by the user via --expire-to doesn't look
>      like an object directory? I.e., does not end in "pack/"? Then this
>      feature would not work at all.
>
>      Should we be mentioning this in the git-repack docs?
>
>      As an aside, I think the current --expire-to docs are misleading.
>      They say:
>
>        --expire-to=<dir>
>            Write a cruft pack containing pruned objects (if any) to the
>            directory <dir>. [...]
>
>      But that isn't right. It is not a <dir> but a <base-name> similar
>      to the one that pack-objects takes. If you do --expire-to=some/dir,
>      then you'll get some/dir-<hash>.pack.
>

I agree. The `--expire-to=<dir>` option can easily cause confusion for users. For example, using `--expire-to=xxx.git/objects/pack` will actually generate files like xxx.git/objects/pack-*.{mtimes,idx,pack} instead of placing them in xxx.git/objects/pack/pack-*.{mtimes,idx,pack}.

-- ZheNing Hu

Previous: Jeff King
Message 4 of 4 in “builtin/repack.c: prune unreachable objects with `--expire-to`”
  1. builtin/repack.c: prune unreachable objects with `--expire-to`Taylor Blau, Dec 1, 2024
  2. Taylor BlauDec 1, 2024
  3. Jeff KingDec 1, 2024
  4. ZheNing HuJan 15, 2025

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.