From: Jonathan Nieder <jrnieder@gmail.com>
To: git@vger.kernel.org
Cc: "Shawn O. Pearce" <spearce@spearce.org>,
Mark Brown <broonie@sirena.org.uk>
Subject: [PATCH/RFC 3/3] git-gui: Do not suggest a gc if gc --auto would not do it
Date: Thu, 18 Feb 2010 08:41:22 -0600 [thread overview]
Message-ID: <20100218144122.GC30520@progeny.tock> (raw)
In-Reply-To: <20100218143431.GA30486@progeny.tock>
In particular, if the user has set gc.auto to 0 or some other value,
respect that setting.
The gui-specific heuristic of assuming Windows filesystems will
tolerate fewer loose objects has been carried over.
This patch vastly increases the loose object count threshold for a
sort of compatibility with the console-based git programs. The ideal
threshold may be different since the user can easily turn down an
offer to gc. But for now, let us assume that a number of loose
objects that is tolerable when working from the command line will also
be tolerable in the gui.
Unfortunately, this duplicates code from builtin-gc.c. A proper fix
would be involve teaching gc to cooperate with the gui more closely.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
That’s the end of the series. Thoughts?
lib/database.tcl | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/lib/database.tcl b/lib/database.tcl
index c8184de..4b07865 100644
--- a/lib/database.tcl
+++ b/lib/database.tcl
@@ -100,15 +100,22 @@ proc too_many_loose_objects {} {
# distributed, we can check only one and get a reasonable
# estimate.
#
- # Roughly based on the function of the same name in builtin-gc.c
+ # Based on the function of the same name in builtin-gc.c
#
# 'git gc' should learn a new --porcelain option
# so it can take care of this.
+
+ set gc_auto_threshold [get_config gc.auto]
+ if {$gc_auto_threshold eq {}} {
+ set gc_auto_threshold 6700
+ }
+ if {$gc_auto_threshold <= 0} {
+ return 0
+ }
set ndirs 1
- set limit 8
+ set limit [expr {($gc_auto_threshold + 255) / 256}]
if {[is_Windows]} {
set ndirs 4
- set limit 1
}
set count [llength [glob \
--
1.7.0
next prev parent reply other threads:[~2010-02-18 14:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-18 14:34 [RFC/PATCH 0/3] git-gui: Don’t trigger garbage collection warning so easily Jonathan Nieder
2010-02-18 14:35 ` [PATCH 1/3] git-gui: factor out too_many_loose_objects routine from hint_gc Jonathan Nieder
2010-02-18 14:39 ` [PATCH/RFC 2/3] git-gui: Do not hold the user hostage with a full gc at startup Jonathan Nieder
2010-02-18 14:41 ` Jonathan Nieder [this message]
2010-02-18 15:49 ` [PATCH/RFC 3/3] git-gui: Do not suggest a gc if gc --auto would not do it Jonathan Nieder
2010-02-18 20:40 ` [RFC/PATCH 0/3] git-gui: Don’t trigger garbage collection warning so easily Johannes Sixt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100218144122.GC30520@progeny.tock \
--to=jrnieder@gmail.com \
--cc=broonie@sirena.org.uk \
--cc=git@vger.kernel.org \
--cc=spearce@spearce.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).