t0010-racy-git.sh 611 Bytes
Newer Older
Junio C Hamano's avatar
Junio C Hamano committed
1 2 3 4 5 6 7 8 9
#!/bin/sh

test_description='racy GIT'

. ./test-lib.sh

# This test can give false success if your machine is sufficiently
# slow or your trial happened to happen on second boundary.

Junio C Hamano's avatar
Junio C Hamano committed
10
for trial in 0 1 2 3 4
Junio C Hamano's avatar
Junio C Hamano committed
11 12 13
do
	rm -f .git/index
	echo frotz >infocom
Junio C Hamano's avatar
Junio C Hamano committed
14
	git update-index --add infocom
Junio C Hamano's avatar
Junio C Hamano committed
15 16
	echo xyzzy >infocom

17
	files=$(git diff-files -p)
Junio C Hamano's avatar
Junio C Hamano committed
18
	test_expect_success \
Junio C Hamano's avatar
Junio C Hamano committed
19
	"Racy GIT trial #$trial part A" \
Junio C Hamano's avatar
Junio C Hamano committed
20
	'test "" != "$files"'
Junio C Hamano's avatar
Junio C Hamano committed
21 22 23 24 25

	sleep 1
	echo xyzzy >cornerstone
	git update-index --add cornerstone

26
	files=$(git diff-files -p)
Junio C Hamano's avatar
Junio C Hamano committed
27 28 29 30
	test_expect_success \
	"Racy GIT trial #$trial part B" \
	'test "" != "$files"'

Junio C Hamano's avatar
Junio C Hamano committed
31 32 33
done

test_done