GitHubivarvong

ply

main
ply6 git calls93 ms27 KiB3 cachedprotocol v2
390 lines22 KiBRaw
1// Plan how to push a pack's objects as several pushes, each under a caller's budget (#237). The input is a spooled pack's
2// layout (scanPackIndex, #236) and every entry's oid, type and base (resolvePackRange, #248); the output is plain data:
3// which entries go in which push, in what order, and a hash that names the plan. Nothing here reads or writes bytes;
4// packSubset (#235) builds each batch's pack and pushPack (#234) sends it.
5//
6// Children first. A strict server (receive.fsckObjects) refuses a pushed tree whose blob it does not have, even when no
7// ref reaches it (measured 2026-11-09 against stock git; Artifacts refuses it once a ref does). So every blob is pushed
8// in a batch before the trees, and the trees, commits and tags go last, in one batch: v1 refuses a plan whose trees do
9// not fit in one batch (limit_exceeded) rather than ordering trees by depth.
10//
11// Delta families stay together: a whole object and every delta resting on it, directly or through other deltas, go in
12// one batch, so every base a batch needs is in it. A family too big for one batch is refused unless `crossBatchRef`:
13// then it is split in chain order, and a delta whose base landed in an earlier batch is written as REF_DELTA to the
14// base's oid (an OFS_DELTA is rewritten; a REF_DELTA, which is all a Cloudflare Artifacts pack holds, already is). How
15// an entry is written given where its base is, is packSubset's own rule (`entryWrite`, `baseId`), called here: a batch
16// this plans is one packSubset builds when it is given the same `resolved` (a base that is itself a delta has an id
17// only there). An entry that rule cannot write fails the plan (bad_request), before anything is pushed. A cut is a
18// thin pack resting on objects the server already has; git's receive-pack runs index-pack --fix-thin and accepts
19// it, but whether a host does is the host's to say, so it is opt-in. A selected delta whose base is not selected, or a
20// thin pack's delta whose base is outside the pack, likewise needs `crossBatchRef` (the destination must hold the base).
21//
22// Budget: every dimension is the caller's (no host numbers here). Per push: request bytes (pack + `reserveBytes` for
23// the command prefix, capabilities and any generated objects) and objects (entries + `reserveObjects`). Per object: the
24// resolved (inflated) size and the compressed (zlib member) size, each checked for every entry before any batch is
25// planned. Sizes are counted as written, with room for header growth: an OFS_DELTA's distance is counted at the length
26// the largest possible distance in a push needs, and a REF rewrite at 20 bytes of oid.
27//
28// Deterministic: the same index, resolution and options give the same plan. `hash` (SHA-1 of the canonical JSON of the
29// plan version, the source pack's trailer, the budget, the options and the batches) names it, so a resumed transfer can
30// tell its plan from another.
31import type { PlyError } from './errors.js';
32import { fail, argsError } from './errors.js';
33import type { Result } from './result.js';
34import { ok, err } from './result.js';
35import { limitExceeded } from './limits.js';
36import type { ScannedPack } from './packscanindex.js';
37import type { ResolvedIndex } from './packrangeresolve.js';
38import { NO_BASE, THIN_BASE } from './packrangeresolve.js';
39import type { Threw, Nothing } from './packsubset.js';
40import { entryWrite, baseId, ofsDistanceBytes, WRITE_OFS, WRITE_REFUSED } from './packsubset.js';
41import { Sha1 } from './sha1.js';
42import { te } from './bytes.js';
43import { withDefaults, mapGet, at } from './absent.js';
44import type { Input } from './absent.js';
45import { OID_BYTES, PACK_HEADER_BYTES, PACK_TRAILER_BYTES, OBJ_COMMIT, OBJ_TREE, OBJ_BLOB, OBJ_TAG, OBJ_OFS_DELTA } from './format.js';
47// In-range indexed reads of columns sized by the index; noUncheckedIndexedAccess cannot see that.
48/* oxlint-disable typescript/no-unsafe-type-assertion, typescript/non-nullable-type-assertion-style -- in-range indexed reads, see above */
50export const PLAN_VERSION = 1;
51export type PushBudget = {
52 // one push's receive-pack request body: the pack plus reserveBytes
53 readonly maxRequestBytes: number;
54 // objects in one push, reserveObjects included
55 readonly maxObjects: number;
56 // one object's resolved (inflated) size
57 readonly maxObjectBytes: number;
58 // one entry's compressed bytes as stored (its zlib member)
59 readonly maxCompressedObjectBytes: number;
60 // per push, outside the planned entries: the command prefix, capabilities, generated objects (a temp commit and tree)
61 readonly reserveBytes: number;
62 readonly reserveObjects: number;
63};
64export type PlanOpts = {
65 readonly budget: PushBudget;
66 // the entries to plan, by index (default: every entry)
67 readonly select: readonly number[] | null;
68 // allow a delta whose base is pushed in an earlier batch (or already on the destination) as REF_DELTA
69 readonly crossBatchRef: boolean;
70};
71// 'blobs': only blobs (and their deltas); 'final': the trees, commits and tags (with any blobs that fit), always last.
72export type BatchKind = 'blobs' | 'final';
73export type PlannedBatch = {
74 readonly kind: BatchKind;
75 // entry indices in the order to write them: every base before the delta resting on it
76 readonly entries: readonly number[];
77 // the pack this batch writes, counted with header growth (an upper bound): header, entries, trailer
78 readonly packBytes: number;
79 // entries in the batch (reserveObjects not included)
80 readonly objects: number;
81 // entries written as REF_DELTA because their base is not in this batch
82 readonly refRewrites: number;
83};
84export type PackPlan = {
85 readonly version: typeof PLAN_VERSION;
86 readonly trailer: string;
87 readonly budget: PushBudget;
88 readonly crossBatchRef: boolean;
89 readonly select: readonly number[] | null;
90 readonly batches: readonly PlannedBatch[];
91 readonly entries: number;
92 // SHA-1 hex of the canonical JSON of everything above
93 readonly hash: string;
94};
96const BLOB = OBJ_BLOB;
97const COMMIT = OBJ_COMMIT;
98const OFS_DELTA = OBJ_OFS_DELTA;
99const TAG = OBJ_TAG;
100const TREE = OBJ_TREE;
101const ofsLen = ofsDistanceBytes;
103function checkBudget(b: PushBudget): PlyError | null {
104 const fields: ReadonlyArray<readonly [string, number]> = [
105 ['maxRequestBytes', b.maxRequestBytes], ['maxObjects', b.maxObjects], ['maxObjectBytes', b.maxObjectBytes],
106 ['maxCompressedObjectBytes', b.maxCompressedObjectBytes], ['reserveBytes', b.reserveBytes], ['reserveObjects', b.reserveObjects],
107 ];
108 for (const [name, v] of fields) {
109 if (!Number.isSafeInteger(v) || v < 0) return fail('bad_request', `budget ${name} must be a non-negative integer, got ${String(v)}`).error;
110 }
111 if (b.reserveObjects >= b.maxObjects) return fail('bad_request', `budget reserveObjects ${b.reserveObjects} leaves no room under maxObjects ${b.maxObjects}`).error;
112 if (b.reserveBytes + PACK_HEADER_BYTES + PACK_TRAILER_BYTES >= b.maxRequestBytes) return fail('bad_request', `budget reserveBytes ${b.reserveBytes} leaves no room for a pack under maxRequestBytes ${b.maxRequestBytes}`).error;
113 return null;
116// The entries to plan: every entry, or the caller's selection (each an entry index, once).
117function selection(n: number, select: readonly number[] | null): Result<Uint8Array, PlyError> {
118 const chosen = new Uint8Array(n);
119 if (select === null) return ok(chosen.fill(1));
120 for (const i of select) {
121 if (!Number.isInteger(i) || i < 0 || i >= n) return fail('bad_request', `select: ${String(i)} is not an entry of this pack (0..${n - 1})`);
122 if (chosen[i] === 1) return fail('bad_request', `select: entry ${i} named twice`);
123 chosen[i] = 1;
124 }
125 return ok(chosen);
128type Ctx = {
129 readonly pack: ScannedPack;
130 readonly resolved: ResolvedIndex;
131 readonly budget: PushBudget;
132 readonly cross: boolean;
133 readonly chosen: Uint8Array;
134 // the batch each planned entry is in, -1 before it is placed
135 readonly batchOf: Int32Array;
136 // bytes of an OFS distance counted for a delta written as OFS: the length the largest distance in a push needs
137 readonly ofsMax: number;
138 // entries the builder's rule cannot write where the plan put them (none, unless `resolved` lacks a base's id)
139 readonly unbuildable: number[];
140 // what the caller's `resolved.oid()` threw, the first time it did, or that it returned nothing (at most one): the
141 // plan's refusal, with what was thrown as its cause
142 readonly threw: Array<Threw | Nothing>;
143 // what the last wireBytes call found besides the bytes (see wireBytes)
144 readonly last: { rewrite: boolean; refused: boolean };
145};
147// The entry's base inside the selection, or -1 (a whole object, a thin base, or a base not selected).
148function inBase(c: Ctx, i: number): number {
149 const b = c.resolved.columns.base[i] as number;
150 return b >= 0 && c.chosen[b] === 1 ? b : -1;
152// An OFS_DELTA's part of wireBytes, kept out of it so the whole-object and REF_DELTA path stays as small as main's.
153function ofsWire(c: Ctx, i: number, sameBatch: boolean, header: number, compressed: number): number {
154 const cols = c.pack.columns;
155 const last = c.last;
156 const storedBase = cols.baseIndex[i] as number;
157 const typeSize = header - ofsLen((cols.offset[i] as number) - (cols.offset[storedBase] as number));
158 // the builder's own rule: OFS beside its base, else a REF_DELTA to the base's id, which `resolved` must know. The
159 // id is asked for only when it would be written (the base is outside this batch): this runs per entry per try
160 const id = sameBatch ? null : baseId(c.pack, c.resolved, storedBase);
161 if (id !== null && typeof id !== 'string' && c.threw.length === 0) c.threw.push(id);
162 const write = entryWrite(OFS_DELTA, sameBatch, sameBatch || typeof id === 'string', c.cross ? 'ref' : 'refuse');
163 last.refused = write === WRITE_REFUSED;
164 if (write === WRITE_OFS) { last.rewrite = false; return typeSize + c.ofsMax + compressed; }
165 last.rewrite = true;
166 return typeSize + OID_BYTES + compressed;
168// Bytes the entry takes in a batch whose number is `batch`: its header as it will be written, then its compressed bytes.
169// It returns the bytes and leaves in `c.last` whether the entry is written as a REF_DELTA where it was not stored as one
170// (`rewrite`) and whether the builder's rule cannot write it there at all (`refused`: an OFS_DELTA outside its base's
171// batch without a known base id). Nothing is allocated per call: this runs per entry per try, and a returned record per
172// call (two shapes of it once OFS cuts were checked) made the REF-only planner 5-9% slower than main 8e3939db.
173function wireBytes(c: Ctx, i: number, batch: number): number {
174 const cols = c.pack.columns;
175 const compressed = cols.compressed[i] as number;
176 const header = cols.headerBytes[i] as number;
177 const stored = cols.storedType[i] as number;
178 const b = inBase(c, i);
179 const isDelta = (c.resolved.columns.base[i] as number) !== NO_BASE;
180 const last = c.last;
181 if (!isDelta) { last.rewrite = false; last.refused = false; return header + compressed; }
182 const sameBatch = b >= 0 && (c.batchOf[b] as number) === batch;
183 if (stored === OFS_DELTA) return ofsWire(c, i, sameBatch, header, compressed);
184 // a REF_DELTA is written as it is stored, wherever its base is
185 last.rewrite = !sameBatch;
186 last.refused = false;
187 return header + compressed;
190// Every planned entry checked against the per-object budget and the type it resolved to.
191function checkEntries(c: Ctx): PlyError | null {
192 const n = c.pack.count;
193 for (let i = 0; i < n; i++) {
194 if (c.chosen[i] !== 1) continue;
195 const t = c.resolved.columns.type[i] as number;
196 if (t !== COMMIT && t !== TREE && t !== BLOB && t !== TAG) return fail('bad_request', `entry ${i} has no resolved type (resolvePackRange first)`).error;
197 const size = c.resolved.columns.size[i] as number;
198 if (size > c.budget.maxObjectBytes) return limitExceeded(`object bytes (entry ${i})`, size, c.budget.maxObjectBytes);
199 const compressed = c.pack.columns.compressed[i] as number;
200 if (compressed > c.budget.maxCompressedObjectBytes) return limitExceeded(`compressed object bytes (entry ${i})`, compressed, c.budget.maxCompressedObjectBytes);
201 const base = c.resolved.columns.base[i] as number;
202 const outside = base === THIN_BASE || (base >= 0 && c.chosen[base] !== 1);
203 if (outside && !c.cross) return fail('bad_request', `entry ${i} is a delta whose base is not in the selection; it needs crossBatchRef (the destination must hold the base)`).error;
204 }
205 return null;
208// Families: each planned entry's chain root (the whole object it rests on, or the first entry above a base outside the
209// selection), and per root the entries in chain order (depth, then index), so a base comes before its deltas.
210// The columns are the caller's (a ResolvedIndex can be built by hand or read from storage), so the walk to a root is
211// bounded here: a chain of distinct entries has fewer links than the pack has entries, so a walk that takes that many
212// is in a cycle, which no pack resolves to. That is refused (bad_request) having held at most one path of n indices.
213function families(c: Ctx): Result<Map<number, number[]>, PlyError> {
214 const n = c.pack.count;
215 const rootOf = new Int32Array(n).fill(-1);
216 const root = (i: number): number => {
217 const path: number[] = [];
218 let u = i;
219 while ((rootOf[u] as number) < 0) {
220 const b = inBase(c, u);
221 if (b < 0) { rootOf[u] = u; break; }
222 if (path.length >= n) return -1;
223 path.push(u);
224 u = b;
225 }
226 const r = rootOf[u] as number;
227 for (const p of path) rootOf[p] = r;
228 return r;
229 };
230 const byRoot = new Map<number, number[]>();
231 for (let i = 0; i < n; i++) {
232 if (c.chosen[i] !== 1) continue;
233 const r = root(i);
234 if (r < 0) return fail('bad_request', `resolved index is malformed: the bases from entry ${i} never reach a whole object (a cycle)`, { what: 'resolved' });
235 const list = mapGet(byRoot, r);
236 if (list.tag === 'none') byRoot.set(r, [i]);
237 else list.value.push(i);
238 }
239 const depth = c.resolved.columns.depth;
240 for (const list of byRoot.values()) list.sort((x, y) => (depth[x] as number) - (depth[y] as number) || x - y);
241 return ok(byRoot);
244type Open = { kind: BatchKind; entries: number[]; bytes: number; refRewrites: number };
245const PACK_OVERHEAD = PACK_HEADER_BYTES + PACK_TRAILER_BYTES;
246const open = (kind: BatchKind): Open => ({ kind, entries: [], bytes: PACK_OVERHEAD, refRewrites: 0 });
247const fitsBytes = (c: Ctx, packBytes: number): boolean => packBytes + c.budget.reserveBytes <= c.budget.maxRequestBytes;
248const fitsObjects = (c: Ctx, count: number): boolean => count + c.budget.reserveObjects <= c.budget.maxObjects;
250// Bytes the family would add to batch `batch` if placed whole (its bases all in it).
251function familyBytes(c: Ctx, list: readonly number[], batch: number): number {
252 for (const i of list) c.batchOf[i] = batch;
253 let sum = 0;
254 for (const i of list) sum += wireBytes(c, i, batch);
255 for (const i of list) c.batchOf[i] = -1;
256 return sum;
258function place(c: Ctx, b: Open, batch: number, i: number): void {
259 c.batchOf[i] = batch;
260 b.bytes += wireBytes(c, i, batch);
261 b.entries.push(i);
262 if (!c.last.rewrite) return;
263 b.refRewrites += 1;
264 if (c.last.refused) c.unbuildable.push(i);
266const done = (b: Open): PlannedBatch => ({ kind: b.kind, entries: b.entries, packBytes: b.bytes, objects: b.entries.length, refRewrites: b.refRewrites });
268// Blob families, greedily in root order: a family whole into the open batch, else a new one; a family no empty batch
269// holds is split in chain order (crossBatchRef) or refused.
270function planBlobs(c: Ctx, fams: ReadonlyArray<readonly number[]>): Result<PlannedBatch[], PlyError> {
271 const out: PlannedBatch[] = [];
272 let cur = open('blobs');
273 for (const list of fams) {
274 const batch = out.length;
275 const add = familyBytes(c, list, batch);
276 if (fitsBytes(c, cur.bytes + add) && fitsObjects(c, cur.entries.length + list.length)) {
277 for (const i of list) place(c, cur, batch, i);
278 continue;
279 }
280 if (cur.entries.length > 0) { out.push(done(cur)); cur = open('blobs'); }
281 const fresh = out.length;
282 const alone = familyBytes(c, list, fresh);
283 if (fitsBytes(c, PACK_OVERHEAD + alone) && fitsObjects(c, list.length)) {
284 for (const i of list) place(c, cur, fresh, i);
285 continue;
286 }
287 if (!c.cross) {
288 const objects = !fitsObjects(c, list.length);
289 return err(objects
290 ? limitExceeded(`delta family objects (root entry ${list[0] as number}; crossBatchRef splits it)`, list.length + c.budget.reserveObjects, c.budget.maxObjects)
291 : limitExceeded(`delta family bytes (root entry ${list[0] as number}; crossBatchRef splits it)`, PACK_OVERHEAD + alone + c.budget.reserveBytes, c.budget.maxRequestBytes));
292 }
293 for (const i of list) {
294 let batch2 = out.length;
295 let w = wireBytes(c, i, batch2);
296 if (!(fitsBytes(c, cur.bytes + w) && fitsObjects(c, cur.entries.length + 1)) && cur.entries.length > 0) {
297 out.push(done(cur));
298 cur = open('blobs');
299 batch2 = out.length;
300 w = wireBytes(c, i, batch2);
301 }
302 if (!fitsBytes(c, cur.bytes + w)) return err(limitExceeded(`entry bytes (entry ${i})`, PACK_OVERHEAD + w + c.budget.reserveBytes, c.budget.maxRequestBytes));
303 place(c, cur, batch2, i);
304 }
305 }
306 if (cur.entries.length > 0) out.push(done(cur));
307 return ok(out);
310// One 'final' batch numbered `batch` holding `blobEntries` then every family, or null if it does not fit.
311function tryFinal(c: Ctx, fams: ReadonlyArray<readonly number[]>, batch: number, blobEntries: readonly number[]): PlannedBatch | null {
312 const b = open('final');
313 for (const i of blobEntries) c.batchOf[i] = -1;
314 for (const i of blobEntries) place(c, b, batch, i);
315 for (const list of fams) for (const i of list) place(c, b, batch, i);
316 if (fitsBytes(c, b.bytes) && fitsObjects(c, b.entries.length)) return done(b);
317 for (const i of b.entries) c.batchOf[i] = -1;
318 for (const i of blobEntries) c.batchOf[i] = batch;
319 return null;
322// The trees, commits and tags, in one batch after every blob batch. If the last blob batch fits beside them, it joins.
323function planFinal(c: Ctx, fams: ReadonlyArray<readonly number[]>, blobs: PlannedBatch[]): Result<PlannedBatch[], PlyError> {
324 if (fams.length === 0) return ok(blobs);
325 const last = at(blobs, blobs.length - 1);
326 const merged = last.tag === 'none' ? null : tryFinal(c, fams, blobs.length - 1, last.value.entries);
327 if (merged !== null) return ok([...blobs.slice(0, -1), merged]);
328 const alone = tryFinal(c, fams, blobs.length, []);
329 if (alone !== null) return ok([...blobs, alone]);
330 const entries = fams.flat();
331 const bytes = PACK_OVERHEAD + familyBytes(c, entries, blobs.length);
332 return err(fitsObjects(c, entries.length)
333 ? limitExceeded('tree batch bytes (trees, commits and tags must fit one push in plan v1)', bytes + c.budget.reserveBytes, c.budget.maxRequestBytes)
334 : limitExceeded('tree batch objects (trees, commits and tags must fit one push in plan v1)', entries.length + c.budget.reserveObjects, c.budget.maxObjects));
336// The canonical form a plan's hash is taken over: fixed key order, entries as arrays of numbers.
337function canonical(p: Omit<PackPlan, 'hash'>): string {
338 const b = p.budget;
339 return JSON.stringify([
340 p.version, p.trailer,
341 [b.maxRequestBytes, b.maxObjects, b.maxObjectBytes, b.maxCompressedObjectBytes, b.reserveBytes, b.reserveObjects],
342 p.crossBatchRef, p.select, p.entries,
343 p.batches.map(x => [x.kind, x.packBytes, x.objects, x.refRewrites, x.entries]),
344 ]);
346// The hash a plan should carry: SHA-1 hex of its canonical JSON. A plan read back from storage can be checked with it.
347export function planHash(p: Omit<PackPlan, 'hash'>): string {
348 return new Sha1().update(te.encode(canonical(p))).hex();
351// Plan the pushes for `pack` (its scanPackIndex index) given `resolved` (resolvePackRange over the same pack).
352export function planPackBatches(pack: ScannedPack, resolved: ResolvedIndex, input: Input<PlanOpts> & { readonly budget: PushBudget }): Result<PackPlan, PlyError> {
353 const shape = argsError('planPackBatches', [['pack', pack, 'object'], ['resolved', resolved, 'object'], ['options', input, 'object']]);
354 if (shape !== null) return shape;
355 const opts = withDefaults<PlanOpts>(input, { budget: input.budget, select: null, crossBatchRef: false });
356 if (resolved.count !== pack.count) return fail('bad_request', `resolved index has ${resolved.count} entries, the pack ${pack.count}`);
357 const budgetBad = checkBudget(opts.budget);
358 if (budgetBad !== null) return err(budgetBad);
359 const chosen = selection(pack.count, opts.select);
360 if (!chosen.ok) return chosen;
361 const c: Ctx = {
362 pack, resolved, budget: opts.budget, cross: opts.crossBatchRef, chosen: chosen.value,
363 batchOf: new Int32Array(pack.count).fill(-1), ofsMax: ofsLen(opts.budget.maxRequestBytes), unbuildable: [], threw: [], last: { rewrite: false, refused: false },
364 };
365 const bad = checkEntries(c);
366 if (bad !== null) return err(bad);
367 const fams = families(c);
368 if (!fams.ok) return fams;
369 const blobFams: number[][] = [];
370 const restFams: number[][] = [];
371 for (const [r, list] of [...fams.value].toSorted((x, y) => x[0] - y[0])) {
372 if ((resolved.columns.type[r] as number) === BLOB) blobFams.push(list);
373 else restFams.push(list);
374 }
375 const blobs = planBlobs(c, blobFams);
376 const batches = blobs.ok ? planFinal(c, restFams, blobs.value) : blobs;
377 // an exception out of the caller's `resolved.oid()` is the cause, ahead of any other refusal: never swallowed
378 const threw = at(c.threw, 0);
379 if (threw.tag === 'some') {
380 return 'threw' in threw.value
381 ? fail('bad_request', 'the resolved index\'s oid() threw when a cut base\'s id was asked for', { cause: threw.value.threw })
382 : fail('bad_request', 'the resolved index\'s oid() returned nothing when a cut base\'s id was asked for');
383 }
384 if (!batches.ok) return batches;
385 const stuck = at(c.unbuildable, 0);
386 if (stuck.tag === 'some') return fail('bad_request', `entry ${stuck.value} is an OFS_DELTA cut from its base, and the resolved index has no id (40 lowercase hex) for that base to write it as a REF_DELTA`);
387 const entries = batches.value.reduce((s, b) => s + b.objects, 0);
388 const body = { version: PLAN_VERSION, trailer: pack.trailer, budget: { ...opts.budget }, crossBatchRef: opts.crossBatchRef, select: opts.select === null ? null : [...opts.select], batches: batches.value, entries } as const;
389 return ok({ ...body, hash: planHash(body) });
Diagnostics6 git calls · 93 ms
CallStatusSizeTime093 ms
discover200191 B3 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 KiB2 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=UPDATING
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:02002.4 KiB · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=84
git.response.bytes=2507
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=tree:0
git.fetch.wants=8f720d29ff85ce682ffdad9c393b04a3834c3203
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=2507
git.pkt.payload.max=2480
git.sideband.band1.bytes=2480
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=2480
git.pack.trailer=723b6bf1d4d6021fe5eb940c622b9ff00ee4a381
Open pack map
fetch2007.1 KiB84 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=7245
git.response.cache=MISS
git.response.duration_ms=84
git.fetch.wants=71920536c72d9ddff9336829a6b88f5c1c3c2820
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=7245
git.pkt.payload.max=7218
git.sideband.band1.bytes=7218
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
a5e0fe8d6910332c
Request
e35a7c71…
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