interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / t / perf / p1500-graph-walks.sh

107 lines · 2721 bytes Raw Blame History
1#!/bin/sh
2
3test_description='Commit walk performance tests'
4. ./perf-lib.sh
5
6test_perf_large_repo
7
8test_expect_success 'setup' '
9 git for-each-ref --format="%(refname)" "refs/heads/*" "refs/tags/*" >allrefs &&
10 sort -r allrefs | head -n 50 >refs &&
11 for ref in $(cat refs)
12 do
13 git branch -f ref-$ref $ref &&
14 echo ref-$ref ||
15 return 1
16 done >branches &&
17 for ref in $(cat refs)
18 do
19 git tag -f tag-$ref $ref &&
20 echo tag-$ref ||
21 return 1
22 done >tags &&
23
24 echo "A:HEAD" >test-tool-refs &&
25 for line in $(cat refs)
26 do
27 echo "X:$line" >>test-tool-refs || return 1
28 done &&
29 echo "A:HEAD" >test-tool-tags &&
30 for line in $(cat tags)
31 do
32 echo "X:$line" >>test-tool-tags || return 1
33 done &&
34
35 git rev-list --first-parent --max-count=8192 HEAD >contains-commits &&
36 test_file_not_empty contains-commits &&
37 git update-ref refs/contains-perf-base "$(tail -n 1 contains-commits)" &&
38 awk "{
39 printf \"update refs/contains-perf/%04d %s\\n\", NR, \$1
40 }" contains-commits |
41 git update-ref --stdin &&
42 git pack-refs --include "refs/contains-perf/*" &&
43
44 commit=$(git commit-tree HEAD^{tree}) &&
45 git update-ref refs/heads/disjoint-base $commit &&
46
47 git commit-graph write --reachable
48'
49
50test_perf 'ahead-behind counts: git for-each-ref' '
51 git for-each-ref --format="%(ahead-behind:HEAD)" --stdin <refs
52'
53
54test_perf 'ahead-behind counts: git branch' '
55 xargs git branch -l --format="%(ahead-behind:HEAD)" <branches
56'
57
58test_perf 'ahead-behind counts: git tag' '
59 xargs git tag -l --format="%(ahead-behind:HEAD)" <tags
60'
61
62test_perf 'contains: git for-each-ref --merged' '
63 git for-each-ref --merged=HEAD --stdin <refs
64'
65
66test_perf 'contains: git branch --merged' '
67 xargs git branch --merged=HEAD <branches
68'
69
70test_perf 'contains: git tag --merged' '
71 xargs git tag --merged=HEAD <tags
72'
73
74test_perf 'contains: git for-each-ref' '
75 git for-each-ref --contains=refs/contains-perf-base --stdin <refs
76'
77
78test_perf 'contains: git branch' '
79 xargs git branch --contains=refs/contains-perf-base <branches
80'
81
82test_perf 'contains: git tag' '
83 xargs git tag --contains=refs/contains-perf-base <tags
84'
85
86test_perf 'contains: synthetic shared history' '
87 git for-each-ref --contains=refs/contains-perf-base \
88 refs/contains-perf/ >/dev/null
89'
90
91test_perf 'is-base check: test-tool reach (refs)' '
92 test-tool reach get_branch_base_for_tip <test-tool-refs
93'
94
95test_perf 'is-base check: test-tool reach (tags)' '
96 test-tool reach get_branch_base_for_tip <test-tool-tags
97'
98
99test_perf 'is-base check: git for-each-ref' '
100 git for-each-ref --format="%(is-base:HEAD)" --stdin <refs
101'
102
103test_perf 'is-base check: git for-each-ref (disjoint-base)' '
104 git for-each-ref --format="%(is-base:refs/heads/disjoint-base)" --stdin <refs
105'
106
107test_done