]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5701-git-serve.sh
serve: introduce git-serve
[thirdparty/git.git] / t / t5701-git-serve.sh
CommitLineData
ed10cb95
BW
1#!/bin/sh
2
3test_description='test git-serve and server commands'
4
5. ./test-lib.sh
6
7test_expect_success 'test capability advertisement' '
8 cat >expect <<-EOF &&
9 version 2
10 agent=git/$(git version | cut -d" " -f3)
11 0000
12 EOF
13
14 git serve --advertise-capabilities >out &&
15 test-pkt-line unpack <out >actual &&
16 test_cmp actual expect
17'
18
19test_expect_success 'stateless-rpc flag does not list capabilities' '
20 # Empty request
21 test-pkt-line pack >in <<-EOF &&
22 0000
23 EOF
24 git serve --stateless-rpc >out <in &&
25 test_must_be_empty out &&
26
27 # EOF
28 git serve --stateless-rpc >out &&
29 test_must_be_empty out
30'
31
32test_expect_success 'request invalid capability' '
33 test-pkt-line pack >in <<-EOF &&
34 foobar
35 0000
36 EOF
37 test_must_fail git serve --stateless-rpc 2>err <in &&
38 test_i18ngrep "unknown capability" err
39'
40
41test_expect_success 'request with no command' '
42 test-pkt-line pack >in <<-EOF &&
43 agent=git/test
44 0000
45 EOF
46 test_must_fail git serve --stateless-rpc 2>err <in &&
47 test_i18ngrep "no command requested" err
48'
49
50test_expect_success 'request invalid command' '
51 test-pkt-line pack >in <<-EOF &&
52 command=foo
53 agent=git/test
54 0000
55 EOF
56 test_must_fail git serve --stateless-rpc 2>err <in &&
57 test_i18ngrep "invalid command" err
58'
59
60test_done