@ -1,6 +1,6 @@
#!/bin/sh
#!/bin/sh
test_description='test git-serve and server commands'
test_description='test protocol v2 server commands'
. ./test-lib.sh
. ./test-lib.sh
@ -14,7 +14,8 @@ test_expect_success 'test capability advertisement' '
0000
0000
EOF
EOF
GIT_TEST_SIDEBAND_ALL=0 git serve --advertise-capabilities >out &&
GIT_TEST_SIDEBAND_ALL=0 test-tool serve-v2 \
--advertise-capabilities >out &&
test-tool pkt-line unpack <out >actual &&
test-tool pkt-line unpack <out >actual &&
test_cmp expect actual
test_cmp expect actual
'
'
@ -24,11 +25,11 @@ test_expect_success 'stateless-rpc flag does not list capabilities' '
test-tool pkt-line pack >in <<-EOF &&
test-tool pkt-line pack >in <<-EOF &&
0000
0000
EOF
EOF
git serve --stateless-rpc >out <in &&
test-tool serve-v2 --stateless-rpc >out <in &&
test_must_be_empty out &&
test_must_be_empty out &&
# EOF
# EOF
git serve --stateless-rpc >out &&
test-tool serve-v2 --stateless-rpc >out &&
test_must_be_empty out
test_must_be_empty out
'
'
@ -37,7 +38,7 @@ test_expect_success 'request invalid capability' '
foobar
foobar
0000
0000
EOF
EOF
test_must_fail git serve --stateless-rpc 2>err <in &&
test_must_fail test-tool serve-v2 --stateless-rpc 2>err <in &&
test_i18ngrep "unknown capability" err
test_i18ngrep "unknown capability" err
'
'
@ -46,7 +47,7 @@ test_expect_success 'request with no command' '
agent=git/test
agent=git/test
0000
0000
EOF
EOF
test_must_fail git serve --stateless-rpc 2>err <in &&
test_must_fail test-tool serve-v2 --stateless-rpc 2>err <in &&
test_i18ngrep "no command requested" err
test_i18ngrep "no command requested" err
'
'
@ -56,7 +57,7 @@ test_expect_success 'request invalid command' '
agent=git/test
agent=git/test
0000
0000
EOF
EOF
test_must_fail git serve --stateless-rpc 2>err <in &&
test_must_fail test-tool serve-v2 --stateless-rpc 2>err <in &&
test_i18ngrep "invalid command" err
test_i18ngrep "invalid command" err
'
'
@ -87,7 +88,7 @@ test_expect_success 'basics of ls-refs' '
0000
0000
EOF
EOF
git serve --stateless-rpc <in >out &&
test-tool serve-v2 --stateless-rpc <in >out &&
test-tool pkt-line unpack <out >actual &&
test-tool pkt-line unpack <out >actual &&
test_cmp expect actual
test_cmp expect actual
'
'
@ -107,7 +108,7 @@ test_expect_success 'basic ref-prefixes' '
0000
0000
EOF
EOF
git serve --stateless-rpc <in >out &&
test-tool serve-v2 --stateless-rpc <in >out &&
test-tool pkt-line unpack <out >actual &&
test-tool pkt-line unpack <out >actual &&
test_cmp expect actual
test_cmp expect actual
'
'
@ -127,7 +128,7 @@ test_expect_success 'refs/heads prefix' '
0000
0000
EOF
EOF
git serve --stateless-rpc <in >out &&
test-tool serve-v2 --stateless-rpc <in >out &&
test-tool pkt-line unpack <out >actual &&
test-tool pkt-line unpack <out >actual &&
test_cmp expect actual
test_cmp expect actual
'
'
@ -148,7 +149,7 @@ test_expect_success 'peel parameter' '
0000
0000
EOF
EOF
git serve --stateless-rpc <in >out &&
test-tool serve-v2 --stateless-rpc <in >out &&
test-tool pkt-line unpack <out >actual &&
test-tool pkt-line unpack <out >actual &&
test_cmp expect actual
test_cmp expect actual
'
'
@ -169,7 +170,7 @@ test_expect_success 'symrefs parameter' '
0000
0000
EOF
EOF
git serve --stateless-rpc <in >out &&
test-tool serve-v2 --stateless-rpc <in >out &&
test-tool pkt-line unpack <out >actual &&
test-tool pkt-line unpack <out >actual &&
test_cmp expect actual
test_cmp expect actual
'
'
@ -189,7 +190,7 @@ test_expect_success 'sending server-options' '
0000
0000
EOF
EOF
git serve --stateless-rpc <in >out &&
test-tool serve-v2 --stateless-rpc <in >out &&
test-tool pkt-line unpack <out >actual &&
test-tool pkt-line unpack <out >actual &&
test_cmp expect actual
test_cmp expect actual
'
'
@ -204,7 +205,10 @@ test_expect_success 'unexpected lines are not allowed in fetch request' '
0000
0000
EOF
EOF
test_must_fail git -C server serve --stateless-rpc <in >/dev/null 2>err &&
(
cd server &&
test_must_fail test-tool serve-v2 --stateless-rpc
) <in >/dev/null 2>err &&
grep "unexpected line: .this-is-not-a-command." err
grep "unexpected line: .this-is-not-a-command." err
'
'