summaryrefslogtreecommitdiff
path: root/t/perf/p5313-pack-objects.sh
blob: 46a6cd32d24343434975565c1a9fcddfdc78cfb1 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/sh

test_description='Tests pack performance using bitmaps'
. ./perf-lib.sh

test_perf_large_repo

test_expect_success 'create rev input' '
	cat >in-thin <<-EOF &&
	$(git rev-parse HEAD)
	^$(git rev-parse HEAD~1)
	EOF

	cat >in-big <<-EOF &&
	$(git rev-parse HEAD)
	^$(git rev-parse HEAD~1000)
	EOF

	cat >in-shallow <<-EOF
	$(git rev-parse HEAD)
	--shallow $(git rev-parse HEAD)
	EOF
'

test_all_with_args () {
	parameter=$1
	export parameter

	test_perf "thin pack with $parameter" '
		git pack-objects --thin --stdout --revs --sparse \
			$parameter <in-thin >out
	'

	test_size "thin pack size with $parameter" '
		test_file_size out
	'

	test_perf "big pack with $parameter" '
		git pack-objects --stdout --revs --sparse \
			$parameter <in-big >out
	'

	test_size "big pack size with $parameter" '
		test_file_size out
	'

	test_perf "shallow fetch pack with $parameter" '
		git pack-objects --stdout --revs --sparse --shallow \
			$parameter <in-shallow >out
	'

	test_size "shallow pack size with $parameter" '
		test_file_size out
	'

	test_perf "repack with $parameter" '
		git repack -adf $parameter
	'

	test_size "repack size with $parameter" '
		gitdir=$(git rev-parse --git-dir) &&
		pack=$(ls $gitdir/objects/pack/pack-*.pack) &&
		test_file_size "$pack"
	'
}

for version in 1 2
do
	test_all_with_args --name-hash-version=$version
done

test_all_with_args --path-walk

test_done