[PATCH/RFC 2/3] git-gui: Do not hold the user hostage with a full gc at startup
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Feb 18, 2010, 14:39 UTC
- Message-ID
- <20100218143903.GB30520@progeny.tock>
- In-Reply-To
- <20100218143431.GA30486@progeny.tock>
The 'git gc --auto' command is meant to perform an incremental gc, avoiding problems from an unpacked repository without forcing the user wait for intense I/O and computation before getting anything done.
The output is not really ideal for a GUI:
Auto packing the repository for optimum performance. You may also run "git gc" manually. See "git help gc" for more information. Nothing new to pack. Removing duplicate objects: 100% (256/256), done.
git gc should pass the relevant information in machine-readable form to fix this.
The gui does not already use gc --auto because it was not implemented until git commit 2c3c439 (2007-09-05), a while after git gui gained its gc functionality. Moreover, the gui does not use git gc at all ever since commit bc7452f (git-gui: Use builtin version of 'git gc', 2007-01-26) for reasons I don’t understand.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> --- lib/database.tcl | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/lib/database.tcl b/lib/database.tcl index 25a0509..c8184de 100644 --- a/lib/database.tcl +++ b/lib/database.tcl @@ -78,6 +78,12 @@ proc do_gc {} { } } +proc do_auto_gc {} { + set w [console::new {gc} [mc "Compressing the object database"]] + set cmd [list git gc --auto] + console::exec $w $cmd +} + proc do_fsck_objects {} { set w [console::new {fsck-objects} \ [mc "Verifying the object database with fsck-objects"]] @@ -126,7 +132,7 @@ proc hint_gc {} { To maintain optimal performance it is strongly recommended that you compress the database. Compress the database now?" $objects_current]] eq yes} { - do_gc + do_auto_gc } } }
-- 1.7.0