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

Git gc removes all packs

From
DNDmitry Neverov <dmitry.neverov@gmail.com>
Date
Feb 5, 2015, 15:13 UTC
Message-ID
<CAC+L6n1M7LtGaJy94fnhXm94zJ32HXLNVGMguWSqHm=qqLLDxA@mail.gmail.com>
Hi,

I'm experiencing a strange behavior of automatic git gc which corrupts a local repository. Git version 2.2.2 on Mac OS X 10.10.1.

I'm using git p4 for synchronization with perforce. Sometimes after 'git p4 rebase' git starts a garbage collection. When gc finishes a local repository contains no pack files only loose objects, so I have to re-import repository from perforce. It also doesn't contain a temporary pack git gc was creating.

Command line history looks like this:
> git p4 rebase

Performing incremental import into refs/remotes/p4/master git branch Depot paths: //XXX/YYY/ Import destination: refs/remotes/p4/master Importing revision 352157 (100%) Rebasing the current branch onto remotes/p4/master First, rewinding head to replay your work on top of it... Fast-forwarded master to remotes/p4/master. Auto packing the repository in background for optimum performance. See "git help gc" for manual housekeeping.

> ps aux | grep git

nd 14335 95.0 1.4 4643292 114788 ?? R 8:52PM 0:05.79 git pack-objects --keep-true-parents --honor-pack-keep --non-empty --all --reflog --indexed-objects --unpack-unreachable=2.weeks.ago --local --delta-base-offset /path/to/repo/.git/objects/pack/.tmp-14333-pack nd 14333 0.0 0.0 2452420 920 ?? S 8:52PM 0:00.00 git repack -d -l -A --unpack-unreachable=2.weeks.ago nd 14331 0.0 0.0 2436036 744 ?? Ss 8:52PM 0:00.00 git gc --auto

After the 14331 process termination all packs are gone.

One more thing about my setup: since git p4 promotes a use of a linear history I use a separate repository for another branch in perforce. In order to be able to cherry-pick between repositories I added this another repo objects dir as an alternate and also added a ref which is a symbolic link to a branch in another repo (so I don't have to do any fetches).

How do I troubleshoot the problem? Is there any way to enable a some kind of logging for automatic git gc? Can use of alternates or symbolic links in refs cause such a behavior?

-- Dmitry

Next: Jeff King
Message 1 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.