X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-cvsimport.perl;h=b54a9486d2703120ca98a176e4b52b3bf8f91aa6;hb=f73da29fa2be2f4bbda86e006b743b8121bdbf19;hp=14e2c6131b1db10690a7ebe0a894651ea6195b7e;hpb=bd45fec8397f1f0804db1d18af7193be323b0326;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);