summaryrefslogtreecommitdiff
path: root/t/perf/lib-pack.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-11-20 20:26:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-11-21 02:07:12 (GMT)
commitaa338d35087fdfc268d6f386a40464056acc6237 (patch)
treef370d1f1dc6f6b2bbbb5855108d9808bdff88cc8 /t/perf/lib-pack.sh
parentfc849d8d6b90e5c1e0c37bc0d60dd92b2fe7347f (diff)
downloadgit-aa338d35087fdfc268d6f386a40464056acc6237.zip
git-aa338d35087fdfc268d6f386a40464056acc6237.tar.gz
git-aa338d35087fdfc268d6f386a40464056acc6237.tar.bz2
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>
Diffstat (limited to 't/perf/lib-pack.sh')
-rw-r--r--t/perf/lib-pack.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/t/perf/lib-pack.sh b/t/perf/lib-pack.sh
new file mode 100644
index 0000000..501bb7b
--- /dev/null
+++ b/t/perf/lib-pack.sh
@@ -0,0 +1,29 @@
+# Helpers for dealing with large numbers of packs.
+
+# create $1 nonsense packs, each with a single blob
+create_packs () {
+ perl -le '
+ my ($n) = @ARGV;
+ for (1..$n) {
+ print "blob";
+ print "data <<EOF";
+ print "$_";
+ print "EOF";
+ }
+ ' "$@" |
+ git fast-import &&
+
+ git cat-file --batch-all-objects --batch-check='%(objectname)' |
+ while read sha1
+ do
+ echo $sha1 | git pack-objects .git/objects/pack/pack
+ done
+}
+
+# create a large number of packs, disabling any gc which might
+# cause us to repack them
+setup_many_packs () {
+ git config gc.auto 0 &&
+ git config gc.autopacklimit 0 &&
+ create_packs 500
+}