git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[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
Previous: Jonathan NiederNext: Jonathan Nieder
Message 3 of 6 in “git-gui: Don’t trigger garbage collection warning so easily”
  1. 0/3 git-gui: Don’t trigger garbage collection warning so easilyJonathan Nieder, Feb 18, 2010
  2. 1/3 git-gui: factor out too_many_loose_objects routine from hint_gcJonathan Nieder, Feb 18, 2010
  3. 2/3 git-gui: Do not hold the user hostage with a full gc at startupJonathan Nieder, Feb 18, 2010
  4. 3/3 git-gui: Do not suggest a gc if gc --auto would not do itJonathan Nieder, Feb 18, 2010
  5. Jonathan NiederFeb 18, 2010
  6. Johannes SixtFeb 18, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.