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'
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" '
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 &&
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
44 test_expect_success "create repo served by $VERSION_B" '
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