Search code examples
gitgit-svn

Avoiding "warning: There are too many unreachable loose objects" during git svn clone/fetch


When running a git svn clone or git svn fetch against a large Subversion repository (100k+ commits), the fetch regularly stops with:

Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
error: The last gc run reported the following. Please correct the root cause and remove .git/gc.log.
Automatic cleanup will not be performed until the file is removed.

warning: There are too many unreachable loose objects; run 'git prune' to remove them.

gc --auto: command returned error: 255

In order to recover I have to follow the instructions, run a more aggressive prune and gc, remove the log-file and continue, only to have it happen again after another batch of say 10k commits are read.

How can this problem be avoided?


Solution

  • I think if you set the config option gc.pruneExpire to now, at least temporarily during the import, it will avoid that message. With that option set, git gc will immediately delete all unreachable objects, instead of only ones that are at least two weeks old (the default). Coupled with a sensible value for gc.auto this should prevent them from accumulating to the point that you get that message.