GitHubivarvong

ply

main
ply6 git calls67 ms28 KiB4 cachedprotocol v2
326 lines20 KiBRaw
1// syncRef (#122): one ref mirrored from a source remote to a destination, both `git http-backend` bare repositories
2// (the default fixture and a stock one: upload-pack at git's defaults). git builds the histories and judges:
3// - after every sync `git rev-parse <dstRef>` on the destination is the source's tip and `git fsck --strict` is clean;
4// - the pack ply sent (captured from the receive-pack request) is self-contained (git index-pack without --fix-thin
5// takes it) and its object set is exactly `git rev-list --objects <new> --not <old dst tip>` on the source: nothing
6// reachable from the destination's old tip is sent again;
7// - in_sync sends no fetch and no receive-pack; a refused non-fast-forward sends no receive-pack;
8// - a destination moved between ls-refs and receive-pack is cas_conflict naming the tip git holds.
9import { readBody } from './body.js';
10import { test, describe, beforeAll as before, afterAll as after } from 'vitest';
11import assert from 'node:assert/strict';
12import { join } from 'node:path';
13import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs';
14import { execFileSync, spawnSync } from 'node:child_process';
15import { git, tmpRoot, makeBareRepo, startGitServer, startAuthGate, fsckProblems, initRepo } from './server.js';
16import * as ply from '../src/index.js';
17import { Tracer, arrayExporter, flattenLine } from '../src/otel.js';
19const { syncRef } = ply;
20const ZERO = '0'.repeat(40);
21let root, cleanup, srv, n = 0;
22before(async () => { ({ root, cleanup } = tmpRoot()); srv = await startGitServer(root); });
23after(async () => { await srv.close(); cleanup(); });
25const ID = ['-c', 'user.name=Mirror', '-c', 'user.email=mirror@example.com'];
26const rev = (dir, r) => git(dir, ['rev-parse', '--verify', '-q', r]).trim();
27const has = (dir, r) => spawnSync('git', ['rev-parse', '--verify', '-q', r], { cwd: dir }).status === 0;
28const objectsOf = (dir, args) => new Set(git(dir, ['rev-list', '--objects', ...args]).trim().split('\n').filter(Boolean).map(l => l.slice(0, 40)));
29const clean = bare => assert.deepEqual(fsckProblems(bare), [], 'git fsck --strict on the destination');
30const errOf = r => { assert.equal(r.ok, false, 'expected an Err'); return r.error; };
31const okOf = r => { assert.equal(r.ok, true, r.ok ? '' : `${r.error.code}: ${r.error.message}`); return r.value; };
33// Per-side request log: every POST body's command (ls-refs / fetch / receive-pack) and every pack pushed.
34function side(before = () => {}) {
35 const log = { commands: [], packs: [] };
36 const fetchImpl = async (url, given) => {
37 const kind = String(url).split('/').pop();
38 // a pack past INFLATE_CHUNK is a streamed body (src/packwrite.ts): read once, forwarded as its bytes
39 const { bytes: body, init } = await readBody(given);
40 if (init?.method === 'POST') {
41 if (kind === 'git-receive-pack') {
42 log.commands.push('receive-pack');
43 const at = body.indexOf('0000PACK');
44 log.packs.push(at < 0 ? null : body.subarray(at + 4));
45 before();
46 } else log.commands.push(/command=fetch/.test(body.toString('latin1')) ? 'fetch' : 'ls-refs');
47 }
48 return fetch(url, init);
49 };
50 return { log, fetchImpl };
52// The pack's object ids as git reads it: index-pack (no --fix-thin: a thin pack is refused) in a fresh repository.
53function packOids(pack) {
54 const dir = mkdtempSync(join(root, 'ip-'));
55 git(dir, ['init', '-q', '--bare']);
56 const out = execFileSync('git', ['index-pack', '--stdin', '-v'], { cwd: dir, input: pack, stdio: ['pipe', 'pipe', 'pipe'] });
57 const idx = join(dir, 'objects', 'pack', `pack-${out.toString().trim().split(/\s+/).pop()}.idx`);
58 const rows = git(dir, ['verify-pack', '-v', idx]).trim().split('\n').filter(l => /^[0-9a-f]{40} /.test(l));
59 return { oids: new Set(rows.map(l => l.slice(0, 40))), deltas: rows.filter(l => l.split(/\s+/).length >= 7).length };
62// A source and a destination on the same server, and a work repository that pushes to the source.
63function pair(stock) {
64 const id = n++;
65 const src = makeBareRepo(root, `src${id}`, { stock });
66 const dst = makeBareRepo(root, `dst${id}`, { stock });
67 const work = join(root, `work${id}`);
68 initRepo(work);
69 return { src, dst, work, srcUrl: `${srv.url}/src${id}.git`, dstUrl: `${srv.url}/dst${id}.git` };
71const body = (seed, count) => Array.from({ length: count }, (_, i) => `export const v${i} = ${(i * 2654435761 + seed) >>> 0};`);
72// A commit in `work` that edits one line of a 200-line file (so packs carry deltas) and adds a file.
73function commit(work, i, msg = `c${i}`) {
74 const lines = body(1, 200);
75 lines[(i * 37) % lines.length] = `// edited in ${i}`;
76 writeFileSync(join(work, 'main.js'), `${lines.join('\n')}\n`);
77 writeFileSync(join(work, `f${i}.txt`), `file ${i}\n`);
78 git(work, ['add', '-A']);
79 git(work, [...ID, 'commit', '-q', '-m', msg]);
80 return rev(work, 'HEAD');
82const pushTo = (work, bare, spec) => git(work, ['push', '-q', '-f', bare, spec]);
83// What the pack must hold: everything reachable from `to` that `from` does not reach (all of it for a create).
84const needed = (src, to, from) => objectsOf(src, [to, ...(from === null ? [] : ['--not', from])]);
85// After a sync that pushed: dst ref is the source tip, fsck is clean, one receive-pack whose pack is exactly `needed`
86// and disjoint from everything the destination's old tip reaches.
87function judgePush(p, log, { ref = 'refs/heads/main', dstRef = ref, to, from }) {
88 assert.equal(rev(p.dst, dstRef), to, 'git rev-parse on the destination is the source tip');
89 clean(p.dst);
90 assert.equal(log.packs.length, 1, 'one receive-pack');
91 const { oids, deltas } = packOids(log.packs[0]);
92 assert.deepEqual([...oids].sort(), [...needed(p.src, to, from)].sort(), 'the pack is rev-list --objects new --not old');
93 if (from !== null) for (const o of objectsOf(p.src, [from])) assert.equal(oids.has(o), false, `${o} is reachable from the old tip and was sent again`);
94 return { oids, deltas };
97for (const stock of [false, true]) describe(stock ? 'stock upload-pack' : 'default fixture', () => {
98 test('create, incremental update, then in_sync (no fetch, no push)', async () => {
99 const p = pair(stock);
100 for (let i = 1; i <= 4; i++) commit(p.work, i);
101 pushTo(p.work, p.src, 'HEAD:refs/heads/main');
102 const c4 = rev(p.work, 'HEAD');
103 const s = side();
104 const created = okOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/heads/main' }, { dst: { fetchImpl: s.fetchImpl } }));
105 assert.equal(created.outcome, 'created');
106 assert.equal(created.from, null);
107 assert.equal(created.to, c4);
108 assert.equal(created.forced, false);
109 const first = judgePush(p, s.log, { to: c4, from: null });
110 assert.equal(created.objects, first.oids.size);
111 assert.ok(first.deltas > 0, 'the source\'s deltas are forwarded');
112 assert.equal(created.pushBytes, s.log.packs[0].length);
114 for (let i = 5; i <= 7; i++) commit(p.work, i);
115 pushTo(p.work, p.src, 'HEAD:refs/heads/main');
116 const c7 = rev(p.work, 'HEAD');
117 const s2 = side();
118 const src2 = side();
119 const updated = okOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/heads/main' }, { src: { fetchImpl: src2.fetchImpl }, dst: { fetchImpl: s2.fetchImpl } }));
120 assert.deepEqual({ outcome: updated.outcome, from: updated.from, to: updated.to, forced: updated.forced }, { outcome: 'updated', from: c4, to: c7, forced: false });
121 const inc = judgePush(p, s2.log, { to: c7, from: c4 });
122 assert.equal(updated.objects, inc.oids.size);
123 assert.ok(inc.oids.size < first.oids.size + 12, 'incremental: only the three new commits, their trees and blobs');
124 assert.deepEqual(src2.log.commands, ['ls-refs', 'fetch'], 'source: one ls-refs, one fetch');
125 assert.deepEqual(s2.log.commands, ['ls-refs', 'receive-pack'], 'destination: one ls-refs, one receive-pack');
127 const s3 = side();
128 const src3 = side();
129 const same = okOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/heads/main' }, { src: { fetchImpl: src3.fetchImpl }, dst: { fetchImpl: s3.fetchImpl } }));
130 assert.deepEqual(same, { outcome: 'in_sync', ref: 'refs/heads/main', dstRef: 'refs/heads/main', oid: c7 });
131 assert.deepEqual(src3.log.commands, ['ls-refs'], 'in_sync: no fetch');
132 assert.deepEqual(s3.log.commands, ['ls-refs'], 'in_sync: no receive-pack');
133 });
135 test('a rewritten source: not_fast_forward with nothing pushed, then force follows it (only what dst lacks)', async () => {
136 const p = pair(stock);
137 for (let i = 1; i <= 3; i++) commit(p.work, i);
138 pushTo(p.work, p.src, 'HEAD:refs/heads/main');
139 okOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/heads/main' }));
140 const old = rev(p.dst, 'refs/heads/main');
141 git(p.work, ['reset', '-q', '--hard', 'HEAD~1']);
142 commit(p.work, 9, 'rewritten');
143 pushTo(p.work, p.src, 'HEAD:refs/heads/main');
144 const rewritten = rev(p.work, 'HEAD');
145 const s = side();
146 const refused = errOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/heads/main' }, { dst: { fetchImpl: s.fetchImpl } }));
147 assert.equal(refused.code, 'not_fast_forward', refused.message);
148 assert.deepEqual(refused.got, ['refs/heads/main']);
149 assert.deepEqual(s.log.commands, ['ls-refs'], 'nothing pushed');
150 assert.equal(rev(p.dst, 'refs/heads/main'), old, 'untouched');
151 const s2 = side();
152 const forced = okOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/heads/main', force: true }, { dst: { fetchImpl: s2.fetchImpl } }));
153 assert.deepEqual({ outcome: forced.outcome, from: forced.from, to: forced.to, forced: forced.forced }, { outcome: 'updated', from: old, to: rewritten, forced: true });
154 judgePush(p, s2.log, { to: rewritten, from: old });
155 });
157 test('a destination ahead of the source is not a fast-forward; forced, it rewinds with an empty pack (the source knows the tip)', async () => {
158 const p = pair(stock);
159 for (let i = 1; i <= 2; i++) commit(p.work, i);
160 pushTo(p.work, p.src, 'HEAD:refs/heads/main');
161 const tip = rev(p.work, 'HEAD');
162 commit(p.work, 3);
163 pushTo(p.work, p.dst, 'HEAD:refs/heads/main');
164 pushTo(p.work, p.src, 'HEAD:refs/heads/ahead'); // the source has the commit (on another branch): it ACKs the have
165 const ahead = rev(p.work, 'HEAD');
166 assert.equal(errOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/heads/main' })).code, 'not_fast_forward');
167 const s = side();
168 const r = okOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/heads/main', force: true }, { dst: { fetchImpl: s.fetchImpl } }));
169 assert.deepEqual({ outcome: r.outcome, from: r.from, to: r.to, forced: r.forced, objects: r.objects }, { outcome: 'updated', from: ahead, to: tip, forced: true, objects: 0 });
170 judgePush(p, s.log, { to: tip, from: ahead });
171 });
173 test('unrelated histories, forced: the source NAKs the unknown have and the whole history goes; dst ends equal', async () => {
174 const p = pair(stock);
175 commit(p.work, 1);
176 pushTo(p.work, p.src, 'HEAD:refs/heads/main');
177 const tip = rev(p.work, 'HEAD');
178 const other = join(root, `other${n++}`);
179 initRepo(other);
180 commit(other, 50, 'unrelated');
181 pushTo(other, p.dst, 'HEAD:refs/heads/main');
182 const theirs = rev(other, 'HEAD');
183 assert.equal(errOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/heads/main' })).code, 'not_fast_forward');
184 const s = side();
185 const r = okOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/heads/main', force: true }, { dst: { fetchImpl: s.fetchImpl } }));
186 assert.equal(r.from, theirs);
187 assert.equal(rev(p.dst, 'refs/heads/main'), tip);
188 clean(p.dst);
189 assert.deepEqual([...packOids(s.log.packs[0]).oids].sort(), [...objectsOf(p.src, [tip])].sort(), 'everything reachable from the source tip');
190 });
192 test('a lost race (dst moved between ls-refs and receive-pack) is cas_conflict naming the tip git holds', async () => {
193 const p = pair(stock);
194 commit(p.work, 1);
195 pushTo(p.work, p.src, 'HEAD:refs/heads/main');
196 okOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/heads/main' }));
197 const old = rev(p.dst, 'refs/heads/main');
198 commit(p.work, 2);
199 pushTo(p.work, p.dst, 'HEAD:refs/heads/side');
200 const winner = rev(p.work, 'HEAD');
201 git(p.work, ['reset', '-q', '--hard', 'HEAD~1']);
202 commit(p.work, 3);
203 pushTo(p.work, p.src, 'HEAD:refs/heads/main');
204 const racing = side(() => git(p.dst, ['update-ref', 'refs/heads/main', winner]));
205 const lost = errOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/heads/main' }, { dst: { fetchImpl: racing.fetchImpl } }));
206 assert.equal(lost.code, 'cas_conflict', lost.message);
207 assert.equal(lost.expected, old, 'the tip ls-refs read');
208 assert.equal(lost.actual, winner, 'the tip the winner left, read back');
209 assert.equal(rev(p.dst, 'refs/heads/main'), winner, 'not clobbered');
210 // a create that loses: the ref appears between ls-refs and receive-pack
211 const createRace = side(() => git(p.dst, ['update-ref', 'refs/heads/new', winner]));
212 const lostCreate = errOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/heads/main', dstRef: 'refs/heads/new' }, { dst: { fetchImpl: createRace.fetchImpl } }));
213 assert.equal(lostCreate.code, 'cas_conflict', lostCreate.message);
214 assert.equal(lostCreate.expected, ZERO);
215 assert.equal(lostCreate.actual, winner);
216 // deleted by the winner: actual null
217 const delRace = side(() => git(p.dst, ['update-ref', '-d', 'refs/heads/main']));
218 const gone = errOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/heads/main', force: true }, { dst: { fetchImpl: delRace.fetchImpl } }));
219 assert.equal(gone.code, 'cas_conflict', gone.message);
220 assert.equal(gone.expected, winner);
221 assert.equal(gone.actual, null);
222 assert.equal(has(p.dst, 'refs/heads/main'), false);
223 });
224});
226describe('refs, options and refusals', () => {
227 test('dstRef, an annotated tag (created, then a moved tag refused unless forced), verify', async () => {
228 const p = pair(false);
229 commit(p.work, 1);
230 git(p.work, [...ID, 'tag', '-a', '-m', 'one', 'v1']);
231 pushTo(p.work, p.src, 'HEAD:refs/heads/main');
232 pushTo(p.work, p.src, 'refs/tags/v1');
233 const tracer = (() => { const ex = arrayExporter(); return { tracer: new Tracer({ exporter: ex }), spans: () => ex.lines.flatMap(flattenLine) }; })();
234 const mirrored = okOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/heads/main', dstRef: 'refs/heads/mirror' }, { verify: true, tracer: tracer.tracer }));
235 assert.equal(mirrored.dstRef, 'refs/heads/mirror');
236 assert.equal(rev(p.dst, 'refs/heads/mirror'), rev(p.src, 'refs/heads/main'));
237 assert.equal(has(p.dst, 'refs/heads/main'), false);
238 const rootSpan = tracer.spans().find(s => s.name === 'git.sync_ref');
239 assert.equal(rootSpan.attrs['git.sync_ref.outcome'], 'created');
240 assert.equal(rootSpan.attrs['git.sync_ref.verify.ref'], mirrored.to);
241 const tag = okOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/tags/v1' }));
242 assert.equal(tag.outcome, 'created');
243 assert.equal(rev(p.dst, 'refs/tags/v1'), rev(p.src, 'refs/tags/v1'));
244 assert.equal(git(p.dst, ['cat-file', '-t', 'refs/tags/v1']).trim(), 'tag');
245 clean(p.dst);
246 commit(p.work, 2);
247 git(p.work, [...ID, 'tag', '-f', '-a', '-m', 'one again', 'v1']);
248 pushTo(p.work, p.src, 'refs/tags/v1');
249 const moved = errOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/tags/v1' }));
250 assert.equal(moved.code, 'not_fast_forward', moved.message);
251 assert.match(moved.message, /tag already exists/);
252 const s = side();
253 const forced = okOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/tags/v1', force: true }, { dst: { fetchImpl: s.fetchImpl } }));
254 assert.equal(forced.forced, true);
255 judgePush(p, s.log, { ref: 'refs/tags/v1', to: rev(p.src, 'refs/tags/v1'), from: tag.to });
256 });
258 test('each side its own credential: the destination behind a gate sees only its token, the root span neither', async () => {
259 const p = pair(false);
260 commit(p.work, 1);
261 pushTo(p.work, p.src, 'HEAD:refs/heads/main');
262 const dstToken = 'dst-secret-token';
263 const srcToken = 'src-secret-token';
264 const gate = await startAuthGate(srv.url, a => a === `Basic ${Buffer.from(`x-access-token:${dstToken}`).toString('base64')}`);
265 try {
266 const gatedDst = `${gate.url}/${p.dstUrl.split('/').pop()}`;
267 const ex = arrayExporter();
268 // without the destination's credential the gate refuses: the source's token is not sent there
269 const denied = errOf(await syncRef(p.srcUrl, gatedDst, { ref: 'refs/heads/main' }, { src: { auth: { token: srcToken } }, tracer: new Tracer({ exporter: ex }) }));
270 assert.equal(denied.code, 'auth');
271 assert.ok(gate.seen.every(s => s.authorization === null), 'the source credential never reaches the destination');
272 const r = okOf(await syncRef(p.srcUrl, gatedDst, { ref: 'refs/heads/main' }, { src: { auth: { token: srcToken } }, dst: { auth: { token: dstToken } }, tracer: new Tracer({ exporter: ex }) }));
273 assert.equal(r.outcome, 'created');
274 assert.equal(rev(p.dst, 'refs/heads/main'), rev(p.src, 'refs/heads/main'));
275 const exported = JSON.stringify(ex.lines);
276 assert.equal(exported.includes(dstToken), false, 'the destination token is scrubbed');
277 assert.equal(exported.includes(srcToken), false, 'the source token is scrubbed');
278 } finally { await gate.close(); }
279 });
281 test('refusals before anything is sent: bad refs, force not boolean, top-level auth; a missing source ref is not_found', async () => {
282 const p = pair(false);
283 commit(p.work, 1);
284 pushTo(p.work, p.src, 'HEAD:refs/heads/main');
285 const s = side();
286 const o = { src: { fetchImpl: s.fetchImpl }, dst: { fetchImpl: s.fetchImpl } };
287 assert.equal(errOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'main' }, o)).code, 'bad_request');
288 assert.equal(errOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/heads/main', dstRef: 'refs/heads/a..b' }, o)).code, 'bad_request');
289 const force = errOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/heads/main', force: 'yes' }, o));
290 assert.equal(force.what, 'force');
291 const auth = errOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/heads/main' }, { ...o, auth: { token: 't' } }));
292 assert.deepEqual([auth.code, auth.what], ['bad_request', 'auth']);
293 assert.deepEqual(s.log.commands, [], 'nothing sent');
294 const missing = errOf(await syncRef(p.srcUrl, p.dstUrl, { ref: 'refs/heads/nope' }, o));
295 assert.equal(missing.code, 'not_found');
296 assert.deepEqual(missing.miss, { kind: 'ref', ref: 'refs/heads/nope', candidates: ['refs/heads/nope'] });
297 assert.equal(has(p.dst, 'refs/heads/nope'), false);
298 // a destination that is not a repository: its ls-refs error, nothing pushed
299 assert.equal(errOf(await syncRef(p.srcUrl, `${srv.url}/absent-repo.git`, { ref: 'refs/heads/main' })).code, 'not_found');
300 // the caller's own transports, one per side
301 const srcT = ply.createTransport(p.srcUrl);
302 const dstT = ply.createTransport(p.dstUrl);
303 const viaTransport = okOf(await syncRef('ignored', 'ignored', { ref: 'refs/heads/main' }, { src: { transport: srcT.value }, dst: { transport: dstT.value } }));
304 assert.equal(viaTransport.outcome, 'created');
305 assert.equal(rev(p.dst, 'refs/heads/main'), rev(p.src, 'refs/heads/main'));
306 });
308 test('the README example runs as written', async () => {
309 const readme = readFileSync(new URL('../README.md', import.meta.url), 'utf8');
310 const [, code] = readme.match(/```js\n\/\/ sync-ref example\n([\s\S]*?)```/);
311 const p = pair(true);
312 commit(p.work, 1);
313 pushTo(p.work, p.src, 'HEAD:refs/heads/main');
314 const printed = [];
315 const quiet = { log: (...a) => printed.push(a) };
316 const AsyncFunction = (async () => {}).constructor;
317 const run = new AsyncFunction('syncRef', 'srcUrl', 'dstUrl', 'process', 'console', code.replace(/^import .*\n/m, ''));
318 const env = { env: { SRC_TOKEN: 'read-token', DST_TOKEN: 'write-token' } }; // http-backend ignores them
319 await run(syncRef, p.srcUrl, p.dstUrl, env, quiet);
320 assert.equal(printed[0][0], 'created');
321 assert.equal(rev(p.dst, 'refs/heads/main'), rev(p.src, 'refs/heads/main'));
322 await run(syncRef, p.srcUrl, p.dstUrl, env, quiet);
323 assert.deepEqual(printed[1], ['in sync at', rev(p.src, 'refs/heads/main')]);
324 clean(p.dst);
325 });
326});
Diagnostics6 git calls · 67 ms
CallStatusSizeTime067 ms
discover200191 B2 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=191
git.server.agent=git/github-9922ec520325-Linux
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch server-option object-format
git.server.fetch=shallow wait-for-done filter
git.protocol.version=2
git.pkt.frames=9
git.pkt.data=7
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=191
git.pkt.payload.max=36
ls-refs20012 KiB · hit2 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=2
git.response.bytes=11990
git.response.cache=HIT
git.response.duration_ms=2
git.protocol.version=2
git.pkt.frames=152
git.pkt.data=151
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=11990
git.pkt.payload.max=122
git.ls_refs.count=151
git.ls_refs.head=refs/heads/main
fetchtree:0 · deepen 102004.2 KiB · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=4347
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=tree:0
git.fetch.wants=19912563f540228593df0c489082e5e2508e21e4
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=7
git.pkt.data=5
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=4347
git.pkt.payload.max=4247
git.sideband.band1.bytes=4247
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=10
git.pack.bytes=4247
git.pack.ofs_delta=0
git.pack.ref_delta=0
git.pack.chain.max=0
git.pack.trailer=a6caf8e129bea82c9bae4cbc7c130c9205add400
git.pack.full=10
Open pack map
fetchtree:0200919 B · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=919
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=tree:0
git.fetch.wants=800d30ba8923860bfc460ca884b7f9ba22083588
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=919
git.pkt.payload.max=892
git.sideband.band1.bytes=892
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=892
git.pack.trailer=5323b9266eea5ded637285d1c5320699f12be76e
Open pack map
fetchtree:02005.6 KiB · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=59
git.response.bytes=5724
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=tree:0
git.fetch.wants=58fabb6768b3f737ee9cd8bac647bdc27405fb4d
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=5724
git.pkt.payload.max=5697
git.sideband.band1.bytes=5697
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=5697
git.pack.trailer=be7e0453974a5fe832f9065a33bb7e3434c10e9b
Open pack map
fetch2005.5 KiB59 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=5660
git.response.cache=MISS
git.response.duration_ms=59
git.fetch.wants=7762eb24b0b36f09a0be09fb0d46672ac253b0a1
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=5660
git.pkt.payload.max=5633
git.sideband.band1.bytes=5633
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://github.com/ivarvong/ply
Ref
refs/heads/main
Commit
19912563f540228593df0c489082e5e2508e21e4
cf-ray
a5e0f840efc8332c
Request
bbf0c928…
Protocol
v2 · sha1
Agent
git/github-9922ec520325-Linux
Filter
advertised
Fetch
shallow wait-for-done filter
Capabilities
agent ls-refs fetch server-option object-format