Merge branch 'ag/rebase-p'
[git.git] / t / interop / i5700-protocol-transition.sh
blob97e8e580efebff64536cdfb033ca3b0b13e727e8
1 #!/bin/sh
3 VERSION_A=.
4 VERSION_B=v2.0.0
6 : ${LIB_GIT_DAEMON_PORT:=5700}
7 LIB_GIT_DAEMON_COMMAND='git.b daemon'
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
13 start_git_daemon --export-all
15 repo=$GIT_DAEMON_DOCUMENT_ROOT_PATH/repo
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
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
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 &&
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 &&
37 test_cmp expect actual &&
38 grep "version=1" log &&
39 ! grep "version 1" log
42 stop_git_daemon
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
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
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 &&
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 &&
64 test_cmp expect actual &&
65 ! grep "version 1" log
68 test_done