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

Re: Git gc removes all packs

From
Jeff King <peff@peff.net>
Date
Feb 27, 2015, 13:14 UTC
Message-ID
<20150227131425.GA13005@peff.net>
In-Reply-To
<CAC+L6n3OFYsjm+5PMW3DBzJo7LnUsxRq1TRE4PMvFvWVG6DQ+A@mail.gmail.com>
On Fri, Feb 27, 2015 at 11:16:09AM +0100, Dmitry Neverov wrote:
> I followed your advice and removed a symlink ref from my repository.
> But didn't help.. automatic GC has just removed all packs again. May
> alternates cause such a behavior? Are any ways to make gc log
> somewhere why it removes packs?

If you have two repositories, A and B, and A points to B via alternates, then you cannot safely run "git gc" in B unless it knows about all of the refs in A. As we discussed before, symlinking the refs is not enough, because those symlinks get stale. But nor is removing the symlinks and just not knowing about the refs. :)

The only safe thing to do is to fetch all of the refs from A into B just before running the gc (and consequently, you probably want to disable gc.auto in B).

-Peff
Previous: Dmitry Neverov
Message 10 of 10 in “Git gc removes all packs”
  1. Dmitry NeverovFeb 5, 2015
  2. Jeff KingFeb 5, 2015
  3. Michael HaggertyFeb 17, 2015
  4. Jeff KingFeb 17, 2015
  5. Michael HaggertyFeb 17, 2015
  6. Junio C HamanoFeb 17, 2015
  7. Michael HaggertyFeb 17, 2015
  8. Junio C HamanoFeb 18, 2015
  9. Dmitry NeverovFeb 27, 2015
  10. Jeff KingFeb 27, 2015

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.