]> git.ipfire.org Git - thirdparty/git.git/blob - t/perf/p5550-fetch-tags.sh
l10n: fr.po v2.18 round 1
[thirdparty/git.git] / t / perf / p5550-fetch-tags.sh
1 #!/bin/sh
2
3 test_description='performance of tag-following with many tags
4
5 This tests a fairly pathological case, so rather than rely on a real-world
6 case, we will construct our own repository. The situation is roughly as
7 follows.
8
9 The parent repository has a large number of tags which are disconnected from
10 the rest of history. That makes them candidates for tag-following, but we never
11 actually grab them (and thus they will impact each subsequent fetch).
12
13 The child repository is a clone of parent, without the tags, and is at least
14 one commit behind the parent (meaning that we will fetch one object and then
15 examine the tags to see if they need followed). Furthermore, it has a large
16 number of packs.
17
18 The exact values of "large" here are somewhat arbitrary; I picked values that
19 start to show a noticeable performance problem on my machine, but without
20 taking too long to set up and run the tests.
21 '
22 . ./perf-lib.sh
23 . "$TEST_DIRECTORY/perf/lib-pack.sh"
24
25 # make a long nonsense history on branch $1, consisting of $2 commits, each
26 # with a unique file pointing to the blob at $2.
27 create_history () {
28 perl -le '
29 my ($branch, $n, $blob) = @ARGV;
30 for (1..$n) {
31 print "commit refs/heads/$branch";
32 print "committer nobody <nobody@example.com> now";
33 print "data 4";
34 print "foo";
35 print "M 100644 $blob $_";
36 }
37 ' "$@" |
38 git fast-import --date-format=now
39 }
40
41 # make a series of tags, one per commit in the revision range given by $@
42 create_tags () {
43 git rev-list "$@" |
44 perl -lne 'print "create refs/tags/$. $_"' |
45 git update-ref --stdin
46 }
47
48 test_expect_success 'create parent and child' '
49 git init parent &&
50 git -C parent commit --allow-empty -m base &&
51 git clone parent child &&
52 git -C parent commit --allow-empty -m trigger-fetch
53 '
54
55 test_expect_success 'populate parent tags' '
56 (
57 cd parent &&
58 blob=$(echo content | git hash-object -w --stdin) &&
59 create_history cruft 3000 $blob &&
60 create_tags cruft &&
61 git branch -D cruft
62 )
63 '
64
65 test_expect_success 'create child packs' '
66 (
67 cd child &&
68 setup_many_packs
69 )
70 '
71
72 test_perf 'fetch' '
73 # make sure there is something to fetch on each iteration
74 git -C child update-ref -d refs/remotes/origin/master &&
75 git -C child fetch
76 '
77
78 test_done