summaryrefslogtreecommitdiff
path: root/t/perf/p1401-ref-operations.sh
blob: 0b88a2f531a310e0cb61eb86d0e6a77e7e35a77c (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh

test_description="Tests performance of ref operations"

. ./perf-lib.sh

test_perf_large_repo

test_perf 'git pack-refs (v1)' '
	git commit --allow-empty -m "change one ref" &&
	git pack-refs --all
'

test_perf 'git for-each-ref (v1)' '
	git for-each-ref --format="%(refname)" >/dev/null
'

test_perf 'git for-each-ref prefix (v1)' '
	git for-each-ref --format="%(refname)" refs/tags/ >/dev/null
'

test_expect_success 'configure packed-refs v2' '
	git config core.repositoryFormatVersion 1 &&
	git config --add extensions.refFormat files &&
	git config --add extensions.refFormat packed &&
	git config --add extensions.refFormat packed-v2 &&
	git config refs.packedRefsVersion 2 &&
	git commit --allow-empty -m "change one ref" &&
	git pack-refs --all &&
	test_copy_bytes 16 .git/packed-refs | xxd >actual &&
	grep PREF actual
'

test_perf 'git pack-refs (v2)' '
	git commit --allow-empty -m "change one ref" &&
	git pack-refs --all
'

test_perf 'git pack-refs (v2;hashing)' '
	git commit --allow-empty -m "change one ref" &&
	git -c refs.hashPackedRefs=true pack-refs --all
'

test_perf 'git for-each-ref (v2)' '
	git for-each-ref --format="%(refname)" >/dev/null
'

test_perf 'git for-each-ref prefix (v2)' '
	git for-each-ref --format="%(refname)" refs/tags/ >/dev/null
'

test_done