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

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-05-23 08:38:15 +0300
committerJunio C Hamano <gitster@pobox.com>2018-05-23 08:38:15 +0300
commit41267e96972d5a158298f777caecd7433a1b1a94 (patch)
treec2203a195e741d750bfb5d65057f1fe06d140b00 /t
parent30b015bffe21a127d4f349f9e876562c3c94a1a2 (diff)
parent5e3548ef161d4d284e35cf5f5d6a181ba4fe707b (diff)
Merge branch 'bw/server-options'
The transport protocol v2 is getting updated further. * bw/server-options: fetch: send server options when using protocol v2 ls-remote: send server options when using protocol v2 serve: introduce the server-option capability
Diffstat (limited to 't')
-rwxr-xr-xt/t5701-git-serve.sh21
-rwxr-xr-xt/t5702-protocol-v2.sh32
2 files changed, 53 insertions, 0 deletions
diff --git a/t/t5701-git-serve.sh b/t/t5701-git-serve.sh
index 72d7bc5628..011a5796db 100755
--- a/t/t5701-git-serve.sh
+++ b/t/t5701-git-serve.sh
@@ -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,24 @@ 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_done
diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh
index 56f7c3c326..dbfd0691c0 100755
--- a/t/t5702-protocol-v2.sh
+++ b/t/t5702-protocol-v2.sh
@@ -154,6 +154,22 @@ test_expect_success 'ref advertisment is filtered with ls-remote using protocol
test_cmp actual expect
'
+test_expect_success 'server-options are sent when using ls-remote' '
+ test_when_finished "rm -f log" &&
+
+ GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \
+ ls-remote -o hello -o world "file://$(pwd)/file_parent" master >actual &&
+
+ cat >expect <<-EOF &&
+ $(git -C file_parent rev-parse refs/heads/master)$(printf "\t")refs/heads/master
+ EOF
+
+ test_cmp actual expect &&
+ grep "server-option=hello" log &&
+ grep "server-option=world" log
+'
+
+
test_expect_success 'clone with file:// using protocol v2' '
test_when_finished "rm -f log" &&
@@ -201,6 +217,22 @@ test_expect_success 'ref advertisment is filtered during fetch using protocol v2
! grep "refs/tags/three" log
'
+test_expect_success 'server-options are sent when fetching' '
+ test_when_finished "rm -f log" &&
+
+ test_commit -C file_parent four &&
+
+ GIT_TRACE_PACKET="$(pwd)/log" git -C file_child -c protocol.version=2 \
+ fetch -o hello -o world origin master &&
+
+ git -C file_child log -1 --format=%s origin/master >actual &&
+ git -C file_parent log -1 --format=%s >expect &&
+ test_cmp expect actual &&
+
+ grep "server-option=hello" log &&
+ grep "server-option=world" log
+'
+
# Test protocol v2 with 'http://' transport
#
. "$TEST_DIRECTORY"/lib-httpd.sh