3 test_description
='session ID in capabilities'
8 LOCAL_PRISTINE
="$(pwd)/local_pristine"
10 test_expect_success
'setup repos for session ID capability tests' '
12 test_commit -C "$REPO" a &&
13 git clone "file://$REPO" "$LOCAL_PRISTINE" &&
14 test_commit -C "$REPO" b
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" \
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)"
44 test_expect_success
'enable SID advertisement' '
45 git -C "$REPO" config transfer.advertiseSID true &&
46 git -C "$LOCAL_PRISTINE" config transfer.advertiseSID true
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" \
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" \
82 grep \"key\":\"negotiated-version\",\"value\":\"$PROTO\" tr2-client-events &&
83 grep \"key\":\"negotiated-version\",\"value\":\"$PROTO\" tr2-server-events