How to skip "Loose Object" popup when running 'git gui'

Michael Donohue picture Michael Donohue · Jul 9, 2009 · Viewed 22.6k times · Source

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.

Answer

Esko Luontola picture Esko Luontola · Apr 12, 2012

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)