Merge branch 'sb/submodule-core-worktree'
[gitweb.git] / t / t5701-git-serve.sh
index 72d7bc56280b13c68b930ea41690788ad87c9853..75ec79e6cb839e71f6830d9301d1982d0fc68925 100755 (executable)
@@ -10,6 +10,7 @@ test_expect_success 'test capability advertisement' '
        agent=git/$(git version | cut -d" " -f3)
        ls-refs
        fetch=shallow
+       server-option
        0000
        EOF
 
@@ -173,4 +174,38 @@ test_expect_success 'symrefs parameter' '
        test_cmp actual expect
 '
 
+test_expect_success 'sending server-options' '
+       test-pkt-line pack >in <<-EOF &&
+       command=ls-refs
+       server-option=hello
+       server-option=world
+       0001
+       ref-prefix HEAD
+       0000
+       EOF
+
+       cat >expect <<-EOF &&
+       $(git rev-parse HEAD) HEAD
+       0000
+       EOF
+
+       git serve --stateless-rpc <in >out &&
+       test-pkt-line unpack <out >actual &&
+       test_cmp actual expect
+'
+
+test_expect_success 'unexpected lines are not allowed in fetch request' '
+       git init server &&
+
+       test-pkt-line pack >in <<-EOF &&
+       command=fetch
+       0001
+       this-is-not-a-command
+       0000
+       EOF
+
+       test_must_fail git -C server serve --stateless-rpc <in >/dev/null 2>err &&
+       grep "unexpected line: .this-is-not-a-command." err
+'
+
 test_done