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_NESTING=5 \
36 GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \
37 git -c protocol.version=$PROTO -C local push \
38 --receive-pack "GIT_TRACE2_EVENT=\"$(pwd)/tr2-server-events\" git-receive-pack" \
39 origin HEAD:new-branch &&
40 test -z "$(grep \"key\":\"server-sid\" tr2-client-events)" &&
41 test -z "$(grep \"key\":\"client-sid\" tr2-server-events)"
45 test_expect_success 'enable SID advertisement' '
46 git -C "$REPO" config transfer.advertiseSID true &&
47 git -C "$LOCAL_PRISTINE" config transfer.advertiseSID true
52 test_expect_success "session IDs advertised (fetch v${PROTO})" '
53 test_when_finished "rm -rf local tr2-client-events tr2-server-events" &&
54 cp -r "$LOCAL_PRISTINE" local &&
55 GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \
56 git -c protocol.version=$PROTO -C local fetch \
57 --upload-pack "GIT_TRACE2_EVENT=\"$(pwd)/tr2-server-events\" git-upload-pack" \
59 grep \"key\":\"server-sid\" tr2-client-events &&
60 grep \"key\":\"client-sid\" tr2-server-events
63 test_expect_success "session IDs advertised (push v${PROTO})" '
64 test_when_finished "rm -rf local tr2-client-events tr2-server-events" &&
65 test_when_finished "git -C local push --delete origin new-branch" &&
66 cp -r "$LOCAL_PRISTINE" local &&
67 git -C local pull --no-rebase origin &&
68 GIT_TRACE2_EVENT_NESTING=5 \
69 GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \
70 git -c protocol.version=$PROTO -C local push \
71 --receive-pack "GIT_TRACE2_EVENT=\"$(pwd)/tr2-server-events\" git-receive-pack" \
72 origin HEAD:new-branch &&
73 grep \"key\":\"server-sid\" tr2-client-events &&
74 grep \"key\":\"client-sid\" tr2-server-events