summaryrefslogtreecommitdiff
path: root/t/perf/p3904-stash-patch.sh
blob: 4cfce638bed6f4db0d8224daca633ba3e068edd6 (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
#!/bin/sh

test_description="Performance tests for git stash -p"

. ./perf-lib.sh

test_perf_fresh_repo

test_expect_success "setup" '
	mkdir files &&
	test_seq 1 100000 | while read i; do
		echo "content $i" >files/$i.txt || return 1
	done &&
	git add files/ &&
	git commit -q -m "add tracked files" &&
	echo modified >files/1.txt
'

test_perf "stash -p, no fsmonitor" \
	--setup 'echo modified >files/1.txt' '
	printf "q\n" | git stash -p >/dev/null 2>&1 || true
'

if test_have_prereq FSMONITOR_DAEMON
then
	test_expect_success "enable builtin fsmonitor" '
		git config core.fsmonitor true &&
		git fsmonitor--daemon start &&
		git update-index --fsmonitor &&
		git status >/dev/null 2>&1
	'

	test_perf "stash -p, builtin fsmonitor" \
		--setup 'echo modified >files/1.txt && git status >/dev/null 2>&1' '
		printf "q\n" | git stash -p >/dev/null 2>&1 || true
	'

	test_expect_success "stop builtin fsmonitor" '
		git fsmonitor--daemon stop
	'
fi

test_done