summaryrefslogtreecommitdiff
path: root/t/perf/p7000-tag-contains.sh
blob: 846f10685569ab1ad846ac649281c821cbed7e05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh

test_description='speed of tag --contains lookups'
. ./perf-lib.sh

test_perf_default_repo

test_expect_success 'find reference points' '
	recent=$(git rev-parse HEAD~100) &&
	old=$(git rev-parse HEAD~5000) &&
	ancient=$(git rev-list | tail -n 1)
'

test_expect_success 'find most recent tag' '
	tag=$(git for-each-ref --sort=-taggerdate \
			       --format="%(refname:short)" \
			       refs/tags |
	      head -n 1)
'

for distance in recent old ancient; do
	contains=$(eval echo \$$distance)
	for match in "" "$tag"; do
		test_perf "contains $distance/${match:-all}" "
			git tag -l --contains $contains $match
		"
	done
done

test_done