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

[PATCH] git-gui: suggest gc only when counting at least 2 objects

From
Clemens Buchacher <drizzd@aon.at>
Date
Sep 13, 2009, 16:06 UTC
Message-ID
<20090913160637.GA15256@localhost>
In-Reply-To
<20090909195158.GA12968@localhost>

On Windows, git-gui suggests running the garbage collector if it finds 1 or more files in .git/objects/42 (as opposed to 8 files on other platforms). The probability of that happening if the repo contains only about 100 loose objects is 32%. The probability for the same to happen with at least 2 files is only 6%, which is bit more reasonable.

The following octave script shows the probability for m or more objects to be in .git/objects/42 for a total of n objects.

m = [1 2 8]; n = 100:100:3000;

P = zeros(length(n), length(m));
for k = 1:length(n)
        P(k, :) = 1-binocdf(m-1, n(k), 1/255);
end
plot(n, P);

n \ m 1 2 8 100 32% 6% 0% 500 86% 58% 0% 1000 98% 90% 5% 2000 100% 100% 55%

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
---

So here is the patch for my other complaint. Note that I fixed a bug in the octave script above, in case someone wants to check the numbers.

I even tested it on a windows VM (as if it wasn't slow enough already).
Clemens
 git-gui/lib/database.tcl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-gui/lib/database.tcl b/git-gui/lib/database.tcl
index a18ac8b..44099e5 100644
--- a/git-gui/lib/database.tcl
+++ b/git-gui/lib/database.tcl
@@ -91,7 +91,7 @@ proc do_fsck_objects {} {
 proc hint_gc {} {
 	set object_limit 8
 	if {[is_Windows]} {
-		set object_limit 1
+		set object_limit 2
 	}
 
 	set objects_current [llength [glob \
-- 
1.6.5.rc0.164.g5f6b0
Previous: Clemens BuchacherNext: Junio C Hamano
Message 7 of 13 in “preserve mtime of local clone”
  1. preserve mtime of local cloneClemens Buchacher, Sep 9, 2009
  2. Junio C HamanoSep 12, 2009
  3. Clemens BuchacherSep 12, 2009
  4. preserve mtime of local cloneClemens Buchacher, Sep 12, 2009
  5. Junio C HamanoSep 13, 2009
  6. preserve mtime of local cloneClemens Buchacher, Sep 13, 2009
  7. git-gui: suggest gc only when counting at least 2 objectsClemens Buchacher, Sep 13, 2009
  8. Junio C HamanoSep 13, 2009
  9. Clemens BuchacherSep 13, 2009
  10. Jeff KingSep 13, 2009
  11. Clemens BuchacherSep 13, 2009
  12. git-gui: search 4 directories to improve statistic of gc hintClemens Buchacher, Sep 13, 2009
  13. Shawn O. PearceSep 14, 2009

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.