Welcome to mirror list, hosted at ThFree Co, Russian Federation.

t5501-post-upload-pack.sh « t - git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 47ee7b5039a02d0bc5ca3a3ada305ac860d3aaa8 (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
#!/bin/sh

test_description='post upload-hook'

. ./test-lib.sh

LOGFILE=".git/post-upload-pack-log"

test_expect_success setup '
	test_commit A &&
	test_commit B &&
	git reset --hard A &&
	test_commit C &&
	git branch prev B &&
	mkdir -p .git/hooks &&
	{
		echo "#!$SHELL_PATH" &&
		echo "cat >post-upload-pack-log"
	} >".git/hooks/post-upload-pack" &&
	chmod +x .git/hooks/post-upload-pack
'

test_expect_success initial '
	rm -fr sub &&
	git init sub &&
	(
		cd sub &&
		git fetch --no-tags .. prev
	) &&
	want=$(sed -n "s/^want //p" "$LOGFILE") &&
	test "$want" = "$(git rev-parse --verify B)" &&
	! grep "^have " "$LOGFILE"
'

test_expect_success second '
	rm -fr sub &&
	git init sub &&
	(
		cd sub &&
		git fetch --no-tags .. prev:refs/remotes/prev &&
		git fetch --no-tags .. master
	) &&
	want=$(sed -n "s/^want //p" "$LOGFILE") &&
	test "$want" = "$(git rev-parse --verify C)" &&
	have=$(sed -n "s/^have //p" "$LOGFILE") &&
	test "$have" = "$(git rev-parse --verify B)"
'

test_done