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

Re: [Possible Bug] --cruft option not work with git gc --prune=now

From
Taylor Blau <me@ttaylorr.com>
Date
Dec 24, 2024, 15:43 UTC
Message-ID
<CABvF+3Z5kWAAbLz_P=oL1o90-u5Mo=DCyi5sEv-a_bJABB=pKw@mail.gmail.com>
In-Reply-To
<CAOLTT8Q0cH3Q=yPnTYKAwn8bC+iDW7onibsLF=bzVr8tGw5J0Q@mail.gmail.com>
On Tue, Dec 24, 2024 at 08:07:16PM +0800, ZheNing Hu wrote:
Show 10 quoted lines
> I am trying to use the --cruft feature of git gc, and everything works
> well, but when I combine it with --prune=now, I notice that no cruft
> package is generated, which is very strange. So I turned on trace and
> checked: instead of executing `git repack --cruft`, it executed `git
> repack -d -l -a`. Is this normal? If `git gc --cruft --prune=now`
> doesn't work as expected, it won't be safe to further execute `git gc
> --cruft --expire-to=<dir> --prune=now`(in my another patch).
>
> I checked the code, and it appears that add_repack_all_option() first
> processes `--prune=now` before handling `--cruft` option.

That's right, since --prune=now will cause your repository to purge any unreachable objects immediately, regardless of their mtimes.

So after a 'git gc --prune=now', your repository will only consist of reachable objects, meaning that there will be nothing to put into a cruft pack.

Note that 'git gc' does not support the '--expire-to' option, but you can use it via 'git repack'.

Thanks, Taylor

Previous: ZheNing HuNext: ZheNing Hu
Message 2 of 5 in “[Possible Bug] --cruft option not work with git gc --prune=now”
  1. ZheNing HuDec 24, 2024
  2. Taylor BlauDec 24, 2024
  3. ZheNing HuDec 26, 2024
  4. Jeff KingDec 26, 2024
  5. ZheNing HuDec 30, 2024

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.