在git svn clone/fetch期间避免"警告:有太多无法访问的松散对象"

jav*_*ett 11 git git-svn

当运行git svn clonegit svn fetch反对大型Subversion存储库(100k +提交)时,fetch会定期停止:

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
Run Code Online (Sandbox Code Playgroud)

为了恢复,我必须按照说明操作,运行更积极的修剪和gc,删除日志文件并继续,只是在读取另一批10k提交后再次发生.

如何避免这个问题?

hob*_*bbs 10

我认为如果你将配置选项设置gc.pruneExpirenow,至少在导入过程中暂时,它将避免该消息.使用该选项集,git gc将立即删除所有无法访问的对象,而不是仅删除至少两周的对象(默认值).加上明智的价值,gc.auto可以防止它们累积到你得到那条信息的程度.


jav*_*ett 7

自应答.

git svn其中包括开展背景gc --auto管理业务的业务.在这种情况下,我认为正在进行的进展git svn fetch可能导致gc操作中某个点的不可到达/松散对象的数量超过auth-threshold,从而导致此警告.不幸的是,这对于正在进行的获取来说是致命的.

我的解决方案是暂时禁用/怀疑这些gc操作,通过停用gc auto,如其手册页所述:

git config gc.auto 0
Run Code Online (Sandbox Code Playgroud)

一旦git svn fetch操作完成,您可以根据需要删除此配置,并运行手动完整的GC,修剪和重新包装操作,以优化最终处置库.


stu*_*ujo 7

开始在 git pull 上看到这个警告:

$ git pull
remote: Enumerating objects: 22, done.
remote: Counting objects: 100% (22/22), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 22 (delta 17), reused 22 (delta 17), pack-reused 0
Unpacking objects: 100% (22/22), done.
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.

Already up-to-date.
Run Code Online (Sandbox Code Playgroud)

查看警告文件,那里不多:

$ cat .git/gc.log
warning: There are too many unreachable loose objects; run 'git prune' to remove them.
Run Code Online (Sandbox Code Playgroud)

阅读帮助:

$ git help gc
Run Code Online (Sandbox Code Playgroud)

听起来我们应该定期做一些这样的事情

运行偶尔推荐的激进选项

$ git gc --aggressive
Counting objects: 41544, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (40544/40544), done.
Writing objects: 100% (41544/41544), done.
Total 41544 (delta 30536), reused 7801 (delta 0)
Removing duplicate objects: 100% (256/256), done.
Checking connectivity: 46959, done.
Run Code Online (Sandbox Code Playgroud)

删除日志警告:

$ rm .git/gc.log 
Run Code Online (Sandbox Code Playgroud)

微笑

:)
Run Code Online (Sandbox Code Playgroud)