transport: log received server session ID
[git.git] / t / t5705-session-id-in-capabilities.sh
blob9e782f44136dafc2eb6ab982bbad5cab6d8d402d
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" &&
21 cp -r "$LOCAL_PRISTINE" local &&
22 GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \
23 git -c protocol.version=$PROTO -C local fetch origin &&
24 test -z "$(grep \"key\":\"server-sid\" tr2-client-events)"
27 test_expect_success "session IDs not advertised by default (push v${PROTO})" '
28 test_when_finished "rm -rf local tr2-client-events" &&
29 cp -r "$LOCAL_PRISTINE" local &&
30 git -C local pull --no-rebase origin &&
31 GIT_TRACE2_EVENT_NESTING=5 \
32 GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \
33 git -c protocol.version=$PROTO -C local push origin &&
34 test -z "$(grep \"key\":\"server-sid\" tr2-client-events)"
36 done
38 test_expect_success 'enable SID advertisement' '
39 git -C "$REPO" config transfer.advertiseSID true &&
40 git -C "$LOCAL_PRISTINE" config transfer.advertiseSID true
43 for PROTO in 0 1 2
45 test_expect_success "session IDs advertised (fetch v${PROTO})" '
46 test_when_finished "rm -rf local tr2-client-events" &&
47 cp -r "$LOCAL_PRISTINE" local &&
48 GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \
49 git -c protocol.version=$PROTO -C local fetch origin &&
50 grep \"key\":\"server-sid\" tr2-client-events
53 test_expect_success "session IDs advertised (push v${PROTO})" '
54 test_when_finished "rm -rf local tr2-client-events" &&
55 cp -r "$LOCAL_PRISTINE" local &&
56 git -C local pull --no-rebase origin &&
57 GIT_TRACE2_EVENT_NESTING=5 \
58 GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \
59 git -c protocol.version=$PROTO -C local push origin &&
60 grep \"key\":\"server-sid\" tr2-client-events
62 done
64 test_done