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

Re: `git prune` doc or implementation defect, or user misunderstanding

From
Johannes Sixt <j.sixt@viscovery.net>
Date
May 8, 2013, 14:41 UTC
Message-ID
<518A6434.20300@viscovery.net>
In-Reply-To
<CAJELnLFpOT=V4f-pthDHkGqVWR7zSS=QYgMz35LWTUB9KvKNUQ@mail.gmail.com>
Am 5/8/2013 16:19, schrieb Matt McClure:
Show 6 quoted lines
> My interpretation of that is that `git prune` will not prune packed objects
> by default. The following behavior seems inconsistent with that
> interpretation.
> 
> [git@438587-beefcake01 panama.git]$ git prune -n | wc -l
> 9210
You have 9210 unreachable, loose objects.
> [git@438587-beefcake01 panama.git]$ git fsck --unreachable | wc -l
> 9468
You have 9468 unreachable objects in total.
Show 6 quoted lines
> [git@438587-beefcake01 panama.git]$ git gc --no-prune
> Counting objects: 531223, done.
> Delta compression using up to 24 threads.
> Compressing objects: 100% (109848/109848), done.
> Writing objects: 100% (531223/531223), done.
> Total 531223 (delta 405288), reused 530894 (delta 404961)

Only reachable objects go into the new pack. Unreachable objects that were in the pack before, are evicted and are now loose.

> [git@438587-beefcake01 panama.git]$ git prune -n | wc -l
> 9468
> [git@438587-beefcake01 panama.git]$ git fsck --unreachable | wc -l
> 9468
Now all 9468 unreachable objects are loose and eligible for being pruned.
> It looks like `git prune -n` is telling me that it would prune the objects
> that I just packed. What am I misunderstanding?

git gc moves unreachable objects that were packed before to the loose object store, from where they can be pruned.

-- Hannes
Previous: Matt McClureNext: Matt McClure
Message 2 of 3 in “`git prune` doc or implementation defect, or user misunderstanding”
  1. Matt McClureMay 8, 2013
  2. Johannes SixtMay 8, 2013
  3. Matt McClureMay 8, 2013

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.