Git fork

p5550: factor out nonsense-pack creation

We have a function to create a bunch of irrelevant packs to
measure the expense of reprepare_packed_git(). Let's make
that available to other perf scripts.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Jeff King and committed by
Junio C Hamano
aa338d35 fc849d8d

+31 -23
+29
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 + } 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 25 + setup_many_packs () { 26 + git config gc.auto 0 && 27 + git config gc.autopacklimit 0 && 28 + create_packs 500 29 + }
+2 -23
t/perf/p5550-fetch-tags.sh
··· 20 20 taking too long to set up and run the tests. 21 21 ' 22 22 . ./perf-lib.sh 23 + . "$TEST_DIRECTORY/perf/lib-pack.sh" 23 24 24 25 # make a long nonsense history on branch $1, consisting of $2 commits, each 25 26 # with a unique file pointing to the blob at $2. ··· 44 45 git update-ref --stdin 45 46 } 46 47 47 - # create $1 nonsense packs, each with a single blob 48 - create_packs () { 49 - perl -le ' 50 - my ($n) = @ARGV; 51 - for (1..$n) { 52 - print "blob"; 53 - print "data <<EOF"; 54 - print "$_"; 55 - print "EOF"; 56 - } 57 - ' "$@" | 58 - git fast-import && 59 - 60 - git cat-file --batch-all-objects --batch-check='%(objectname)' | 61 - while read sha1 62 - do 63 - echo $sha1 | git pack-objects .git/objects/pack/pack 64 - done 65 - } 66 - 67 48 test_expect_success 'create parent and child' ' 68 49 git init parent && 69 50 git -C parent commit --allow-empty -m base && ··· 84 65 test_expect_success 'create child packs' ' 85 66 ( 86 67 cd child && 87 - git config gc.auto 0 && 88 - git config gc.autopacklimit 0 && 89 - create_packs 500 68 + setup_many_packs 90 69 ) 91 70 ' 92 71