Skip to content

Commit 3c88ebd

Browse files
bmwillgitster
authored andcommittedOct 17, 2017
i5700: add interop test for protocol transition
Signed-off-by: Brandon Williams <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 19113a2 commit 3c88ebd

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed
 
+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/bin/sh
2+
3+
VERSION_A=.
4+
VERSION_B=v2.0.0
5+
6+
: ${LIB_GIT_DAEMON_PORT:=5700}
7+
LIB_GIT_DAEMON_COMMAND='git.b daemon'
8+
9+
test_description='clone and fetch by client who is trying to use a new protocol'
10+
. ./interop-lib.sh
11+
. "$TEST_DIRECTORY"/lib-git-daemon.sh
12+
13+
start_git_daemon --export-all
14+
15+
repo=$GIT_DAEMON_DOCUMENT_ROOT_PATH/repo
16+
17+
test_expect_success "create repo served by $VERSION_B" '
18+
git.b init "$repo" &&
19+
git.b -C "$repo" commit --allow-empty -m one
20+
'
21+
22+
test_expect_success "git:// clone with $VERSION_A and protocol v1" '
23+
GIT_TRACE_PACKET=1 git.a -c protocol.version=1 clone "$GIT_DAEMON_URL/repo" child 2>log &&
24+
git.a -C child log -1 --format=%s >actual &&
25+
git.b -C "$repo" log -1 --format=%s >expect &&
26+
test_cmp expect actual &&
27+
grep "version=1" log
28+
'
29+
30+
test_expect_success "git:// fetch with $VERSION_A and protocol v1" '
31+
git.b -C "$repo" commit --allow-empty -m two &&
32+
git.b -C "$repo" log -1 --format=%s >expect &&
33+
34+
GIT_TRACE_PACKET=1 git.a -C child -c protocol.version=1 fetch 2>log &&
35+
git.a -C child log -1 --format=%s FETCH_HEAD >actual &&
36+
37+
test_cmp expect actual &&
38+
grep "version=1" log &&
39+
! grep "version 1" log
40+
'
41+
42+
stop_git_daemon
43+
44+
test_expect_success "create repo served by $VERSION_B" '
45+
git.b init parent &&
46+
git.b -C parent commit --allow-empty -m one
47+
'
48+
49+
test_expect_success "file:// clone with $VERSION_A and protocol v1" '
50+
GIT_TRACE_PACKET=1 git.a -c protocol.version=1 clone --upload-pack="git.b upload-pack" parent child2 2>log &&
51+
git.a -C child2 log -1 --format=%s >actual &&
52+
git.b -C parent log -1 --format=%s >expect &&
53+
test_cmp expect actual &&
54+
! grep "version 1" log
55+
'
56+
57+
test_expect_success "file:// fetch with $VERSION_A and protocol v1" '
58+
git.b -C parent commit --allow-empty -m two &&
59+
git.b -C parent log -1 --format=%s >expect &&
60+
61+
GIT_TRACE_PACKET=1 git.a -C child2 -c protocol.version=1 fetch --upload-pack="git.b upload-pack" 2>log &&
62+
git.a -C child2 log -1 --format=%s FETCH_HEAD >actual &&
63+
64+
test_cmp expect actual &&
65+
! grep "version 1" log
66+
'
67+
68+
test_done

0 commit comments

Comments
 (0)
Please sign in to comment.