Imported Upstream version 2.16.0
[platform/upstream/git.git] / t / perf / lib-pack.sh
1 # Helpers for dealing with large numbers of packs.
2
3 # create $1 nonsense packs, each with a single blob
4 create_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                         print "checkpoint"
13                 }
14         ' "$@" |
15         git fast-import
16 }
17
18 # create a large number of packs, disabling any gc which might
19 # cause us to repack them
20 setup_many_packs () {
21         git config gc.auto 0 &&
22         git config gc.autopacklimit 0 &&
23         git config fastimport.unpacklimit 0 &&
24         create_packs 500
25 }