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

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

test_description='test git-serve and server commands'

. ./test-lib.sh

test_expect_success 'test capability advertisement' '
	cat >expect <<-EOF &&
	version 2
	agent=git/$(git version | cut -d" " -f3)
	0000
	EOF

	git serve --advertise-capabilities >out &&
	test-pkt-line unpack <out >actual &&
	test_cmp actual expect
'

test_expect_success 'stateless-rpc flag does not list capabilities' '
	# Empty request
	test-pkt-line pack >in <<-EOF &&
	0000
	EOF
	git serve --stateless-rpc >out <in &&
	test_must_be_empty out &&

	# EOF
	git serve --stateless-rpc >out &&
	test_must_be_empty out
'

test_expect_success 'request invalid capability' '
	test-pkt-line pack >in <<-EOF &&
	foobar
	0000
	EOF
	test_must_fail git serve --stateless-rpc 2>err <in &&
	test_i18ngrep "unknown capability" err
'

test_expect_success 'request with no command' '
	test-pkt-line pack >in <<-EOF &&
	agent=git/test
	0000
	EOF
	test_must_fail git serve --stateless-rpc 2>err <in &&
	test_i18ngrep "no command requested" err
'

test_expect_success 'request invalid command' '
	test-pkt-line pack >in <<-EOF &&
	command=foo
	agent=git/test
	0000
	EOF
	test_must_fail git serve --stateless-rpc 2>err <in &&
	test_i18ngrep "invalid command" err
'

test_done