X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=git-cvsimport.perl;h=b54a9486d2703120ca98a176e4b52b3bf8f91aa6;hb=6534141151f7fd4334f62827d9234acf3974ca4d;hp=14e2c6131b1db10690a7ebe0a894651ea6195b7e;hpb=019298015bb7c826b72f2573047b7221b0921fd3;p=git.git diff --git a/git-cvsimport.perl b/git-cvsimport.perl index 14e2c6131..b54a9486d 100755 --- a/git-cvsimport.perl +++ b/git-cvsimport.perl @@ -876,6 +876,16 @@ while() { } 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);