diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 14e2c6131b1db10690a7ebe0a894651ea6195b7e..b54a9486d2703120ca98a176e4b52b3bf8f91aa6 100755 (executable)
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
}
commit() if $branch and $state != 11;
+# The heuristic of repacking every 1024 commits can leave a
+# lot of unpacked data. If there is more than 1MB worth of
+# not-packed objects, repack once more.
+my $line = `git-count-objects`;
+if ($line =~ /^(\d+) objects, (\d+) kilobytes$/) {
+ my ($n_objects, $kb) = ($1, $2);
+ 1024 < $kb
+ and system("git repack -a -d");
+}
+
foreach my $git_index (values %index) {
if ($git_index ne '.git/index') {
unlink($git_index);