如何跳过“松散物体”运行'git gui'时弹出 [英] How to skip "Loose Object" popup when running 'git gui'
问题描述
当我运行'git gui'时,出现一个弹出窗口,提示
这个存储库目前有大约1500个松散对象。
然后建议压缩数据库。我之前做过这件事,它将松散物体减少到大约250个,但这并不能抑制弹出。再次压缩不会改变松散物体的数量。
我们目前的工作流程需要在从Perforce转换时大量使用'rebase',而Perforce仍然是规范的SCM。一旦Git是规范的SCM,我们会定期进行合并,松散对象问题应该大大减轻。同时,我真的希望让这个'有用的'弹出窗口消失。
由于没有人有答案,我查看了代码,看看如何删除显示该对话框的代码。我找到了 hint_gc
这个过程,它是它的名字和地方。同时,我注意到,2011年末,禁用对话框的配置选项 。这个变化(git-gui 0.16.0的一部分)被合并到Git的主线上: 2011-12-14 。
因此,如果您使用Git v1.7.9或更高版本,您可以使用以下命令禁用警告对话框:
git config --global gui.gcwarning false
如果您使用的是旧版本,那么您可以编辑 / lib / git-core / git-gui
code> 1000 hint_gc 行后,或者编辑 /usr/share/git-gui/lib/database.tcl
,然后移除主体 hint_gc
过程。 (这些文件路径在Cygwin上 - 在其他环境中,这些文件可能位于不同的位置。对于Windows,它是 c:\ Program Files \Git\mingw64\libexec\git-core \git-gui.tcl
)
When I run 'git gui' I get a popup that says
This repository currently has approximately 1500 loose objects.
It then suggests compressing the database. I've done this before, and it reduces the loose objects to about 250, but that doesn't suppress the popup. Compressing again doesn't change the number of loose objects.
Our current workflow requires significant use of 'rebase' as we are transitioning from Perforce, and Perforce is still the canonical SCM. Once Git is the canonical SCM, we will do regular merges, and the loose objects problem should be greatly mitigated.
In the mean time, I'd really like to make this 'helpful' popup go away.
Since nobody had yet an answer, I looked into the code to see how to remove the code which shows up that dialog. I found the hint_gc
procedure which does it and the place where it is called. At the same time I noticed that late 2011 there was added a configuration option for disabling the dialog. This change (part of git-gui 0.16.0) was merged to Git's mainline on 2011-12-14.
So if you use Git v1.7.9 or newer, you can disable the warning dialog with the following command:
git config --global gui.gcwarning false
If you are using an older version, then you can edit /lib/git-core/git-gui
and remove the after 1000 hint_gc
line, or edit /usr/share/git-gui/lib/database.tcl
and remove the body of the hint_gc
procedure. (These file paths are on Cygwin - on other environments the files might be in a different locations. For Windows it is c:\Program Files\Git\mingw64\libexec\git-core\git-gui.tcl
)
这篇关于如何跳过“松散物体”运行'git gui'时弹出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!