Let "git svn" run "git gc --auto" every 1000 imported commits to
reduce the number of loose objects.
To handle the common use case of frequent imports, where each
invocation typically fetches much less than 1000 commits, also run gc
unconditionally at the end of the import.
"1000" is the same number that was used by default when we called
git-repack. It isn't necessarily still the best choice.
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
git-svn.perl | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 988d8f6..be4105c 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1247,6 +1247,8 @@ use File::Path qw/mkpath/;
use File::Copy qw/copy/;
use IPC::Open3;
+my ($_gc_nr, $_gc_period);
+
# properties that we do not log:
my %SKIP_PROP;
BEGIN {
@@ -1407,6 +1409,7 @@ sub read_all_remotes {
}
sub init_vars {
+ $_gc_nr = $_gc_period = 1000;
if (defined $_repack || defined $_repack_flags) {
warn "Repack options are obsolete; they have no effect.\n";
}
@@ -2095,6 +2098,10 @@ sub restore_commit_header_env {
}
}
+sub gc {
+ command_noisy('gc', '--auto');
+};
+
sub do_git_commit {
my ($self, $log_entry) = @_;
my $lr = $self->last_rev;
@@ -2148,6 +2155,10 @@ sub do_git_commit {
0, $self->svm_uuid);
}
print " = $commit ($self->{ref_id})\n";
+ if (--$_gc_nr == 0) {
+ $_gc_nr = $_gc_period;
+ gc();
+ }
return $commit;
}
@@ -3975,6 +3986,7 @@ sub gs_fetch_loop_common {
$max += $inc;
$max = $head if ($max > $head);
}
+ Git::SVN::gc();
}
sub match_globs {
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html| Andrew Morton | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Rafael J. Wysocki | [Bug #11806] iwl3945 fails with microcode error |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Andrew Morton | -mm merge plans for 2.6.23 |
git: | |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| David Miller | Re: [GIT]: Networking |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Jeff Kirsher | [RESEND NET-NEXT PATCH 08/20] igb: Introduce multiple TX queues with infrastructure |
