File: p0100-globbing.sh

package info (click to toggle)
cgit 1.2.1%2Bgit2.18.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 37,580 kB
  • sloc: ansic: 207,716; sh: 172,917; perl: 28,960; tcl: 21,663; python: 6,441; makefile: 3,642; php: 120; asm: 98; csh: 45; ruby: 24; lisp: 12
file content (43 lines) | stat: -rwxr-xr-x 868 bytes parent folder | download | duplicates (4)
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
#!/bin/sh

test_description="Tests pathological globbing performance

Shows how Git's globbing performance performs when given the sort of
pathological patterns described in at https://research.swtch.com/glob
"

. ./perf-lib.sh

test_globs_big='10 25 50 75 100'
test_globs_small='1 2 3 4 5 6'

test_perf_fresh_repo

test_expect_success 'setup' '
	for i in $(test_seq 1 100)
	do
		printf "a" >>refname &&
		for j in $(test_seq 1 $i)
		do
			printf "a*" >>refglob.$i
		done &&
		echo b >>refglob.$i
	done &&
	test_commit test $(cat refname).t "" $(cat refname).t
'

for i in $test_globs_small
do
	test_perf "refglob((a*)^nb) against tag (a^100).t; n = $i" '
		git for-each-ref "refs/tags/$(cat refglob.'$i')b"
	'
done

for i in $test_globs_small
do
	test_perf "fileglob((a*)^nb) against file (a^100).t; n = $i" '
		git ls-files "$(cat refglob.'$i')b"
	'
done

test_done