Merge branch 'ab/ci-updates'
[git/debian.git] / t / t5705-session-id-in-capabilities.sh
blobed38c76c29059d3f5363116db1b8231c31b0dc5a
1 #!/bin/sh
3 test_description='session ID in capabilities'
5 . ./test-lib.sh
7 REPO="$(pwd)/repo"
8 LOCAL_PRISTINE="$(pwd)/local_pristine"
10 test_expect_success 'setup repos for session ID capability tests' '
11 git init "$REPO" &&
12 test_commit -C "$REPO" a &&
13 git clone "file://$REPO" "$LOCAL_PRISTINE" &&
14 test_commit -C "$REPO" b
17 for PROTO in 0 1 2
19 test_expect_success "session IDs not advertised by default (fetch v${PROTO})" '
20 test_when_finished "rm -rf local tr2-client-events tr2-server-events" &&
21 cp -r "$LOCAL_PRISTINE" local &&
22 GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \
23 git -c protocol.version=$PROTO -C local fetch \
24 --upload-pack "GIT_TRACE2_EVENT=\"$(pwd)/tr2-server-events\" git-upload-pack" \
25 origin &&
26 test -z "$(grep \"key\":\"server-sid\" tr2-client-events)" &&
27 test -z "$(grep \"key\":\"client-sid\" tr2-server-events)"
30 test_expect_success "session IDs not advertised by default (push v${PROTO})" '
31 test_when_finished "rm -rf local tr2-client-events tr2-server-events" &&
32 test_when_finished "git -C local push --delete origin new-branch" &&
33 cp -r "$LOCAL_PRISTINE" local &&
34 git -C local pull --no-rebase origin &&
35 GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \
36 git -c protocol.version=$PROTO -C local push \
37 --receive-pack "GIT_TRACE2_EVENT=\"$(pwd)/tr2-server-events\" git-receive-pack" \
38 origin HEAD:new-branch &&
39 test -z "$(grep \"key\":\"server-sid\" tr2-client-events)" &&
40 test -z "$(grep \"key\":\"client-sid\" tr2-server-events)"
42 done
44 test_expect_success 'enable SID advertisement' '
45 git -C "$REPO" config transfer.advertiseSID true &&
46 git -C "$LOCAL_PRISTINE" config transfer.advertiseSID true
49 for PROTO in 0 1 2
51 test_expect_success "session IDs advertised (fetch v${PROTO})" '
52 test_when_finished "rm -rf local tr2-client-events tr2-server-events" &&
53 cp -r "$LOCAL_PRISTINE" local &&
54 GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \
55 git -c protocol.version=$PROTO -C local fetch \
56 --upload-pack "GIT_TRACE2_EVENT=\"$(pwd)/tr2-server-events\" git-upload-pack" \
57 origin &&
58 grep \"key\":\"server-sid\" tr2-client-events &&
59 grep \"key\":\"client-sid\" tr2-server-events
62 test_expect_success "session IDs advertised (push v${PROTO})" '
63 test_when_finished "rm -rf local tr2-client-events tr2-server-events" &&
64 test_when_finished "git -C local push --delete origin new-branch" &&
65 cp -r "$LOCAL_PRISTINE" local &&
66 git -C local pull --no-rebase origin &&
67 GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \
68 git -c protocol.version=$PROTO -C local push \
69 --receive-pack "GIT_TRACE2_EVENT=\"$(pwd)/tr2-server-events\" git-receive-pack" \
70 origin HEAD:new-branch &&
71 grep \"key\":\"server-sid\" tr2-client-events &&
72 grep \"key\":\"client-sid\" tr2-server-events
75 test_expect_success "client & server log negotiated version (v${PROTO})" '
76 test_when_finished "rm -rf local tr2-client-events tr2-server-events" &&
77 cp -r "$LOCAL_PRISTINE" local &&
78 GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \
79 git -c protocol.version=$PROTO -C local fetch \
80 --upload-pack "GIT_TRACE2_EVENT=\"$(pwd)/tr2-server-events\" git-upload-pack" \
81 origin &&
82 grep \"key\":\"negotiated-version\",\"value\":\"$PROTO\" tr2-client-events &&
83 grep \"key\":\"negotiated-version\",\"value\":\"$PROTO\" tr2-server-events
85 done
87 test_done