]>
Commit | Line | Data |
---|---|---|
23bf486a JS |
1 | #!/bin/sh |
2 | ||
3 | test_description='session ID in capabilities' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
7 | REPO="$(pwd)/repo" | |
8 | LOCAL_PRISTINE="$(pwd)/local_pristine" | |
9 | ||
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 | |
15 | ' | |
16 | ||
17 | for PROTO in 0 1 2 | |
18 | do | |
19 | test_expect_success "session IDs not advertised by default (fetch v${PROTO})" ' | |
82959467 | 20 | test_when_finished "rm -rf local tr2-client-events tr2-server-events" && |
23bf486a JS |
21 | cp -r "$LOCAL_PRISTINE" local && |
22 | GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \ | |
82959467 JS |
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)" | |
23bf486a JS |
28 | ' |
29 | ||
30 | test_expect_success "session IDs not advertised by default (push v${PROTO})" ' | |
31 | test_when_finished "rm -rf local tr2-client-events" && | |
32 | cp -r "$LOCAL_PRISTINE" local && | |
33 | git -C local pull --no-rebase origin && | |
34 | GIT_TRACE2_EVENT_NESTING=5 \ | |
35 | GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \ | |
36 | git -c protocol.version=$PROTO -C local push origin && | |
37 | test -z "$(grep \"key\":\"server-sid\" tr2-client-events)" | |
38 | ' | |
39 | done | |
40 | ||
41 | test_expect_success 'enable SID advertisement' ' | |
42 | git -C "$REPO" config transfer.advertiseSID true && | |
43 | git -C "$LOCAL_PRISTINE" config transfer.advertiseSID true | |
44 | ' | |
45 | ||
46 | for PROTO in 0 1 2 | |
47 | do | |
48 | test_expect_success "session IDs advertised (fetch v${PROTO})" ' | |
82959467 | 49 | test_when_finished "rm -rf local tr2-client-events tr2-server-events" && |
23bf486a JS |
50 | cp -r "$LOCAL_PRISTINE" local && |
51 | GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \ | |
82959467 JS |
52 | git -c protocol.version=$PROTO -C local fetch \ |
53 | --upload-pack "GIT_TRACE2_EVENT=\"$(pwd)/tr2-server-events\" git-upload-pack" \ | |
54 | origin && | |
55 | grep \"key\":\"server-sid\" tr2-client-events && | |
56 | grep \"key\":\"client-sid\" tr2-server-events | |
23bf486a JS |
57 | ' |
58 | ||
59 | test_expect_success "session IDs advertised (push v${PROTO})" ' | |
60 | test_when_finished "rm -rf local tr2-client-events" && | |
61 | cp -r "$LOCAL_PRISTINE" local && | |
62 | git -C local pull --no-rebase origin && | |
63 | GIT_TRACE2_EVENT_NESTING=5 \ | |
64 | GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \ | |
65 | git -c protocol.version=$PROTO -C local push origin && | |
66 | grep \"key\":\"server-sid\" tr2-client-events | |
67 | ' | |
68 | done | |
69 | ||
70 | test_done |