501bb7b272fed1be997e0c357c18e1bb19895bca
   1# Helpers for dealing with large numbers of packs.
   2
   3# create $1 nonsense packs, each with a single blob
   4create_packs () {
   5        perl -le '
   6                my ($n) = @ARGV;
   7                for (1..$n) {
   8                        print "blob";
   9                        print "data <<EOF";
  10                        print "$_";
  11                        print "EOF";
  12                }
  13        ' "$@" |
  14        git fast-import &&
  15
  16        git cat-file --batch-all-objects --batch-check='%(objectname)' |
  17        while read sha1
  18        do
  19                echo $sha1 | git pack-objects .git/objects/pack/pack
  20        done
  21}
  22
  23# create a large number of packs, disabling any gc which might
  24# cause us to repack them
  25setup_many_packs () {
  26        git config gc.auto 0 &&
  27        git config gc.autopacklimit 0 &&
  28        create_packs 500
  29}