GitHubivarvong
ply
main
1// A whole tree (or one subtree) out of a remote, without a clone, a working tree or an object store. The mirror of
2// pushTree: where readFile pays ls-refs + a commit fetch + a tree per level + the blob for every file, checkoutTree
3// resolves the commit once and asks for objects in bulk:
4//
5// ls-refs → ONE blob:none fetch of the commit (deepen 1: the commit and every tree under it, which is also all a
6// blob:none-only host such as Cloudflare Artifacts serves) → the blobs, `batch` wants per fetch.
7//
8// checkoutTree(url, { ref, path }, opts) → { ref, commit, tree, path, entries, files }
9// entries: [{ path, mode, oid }] every non-tree entry under `path`, in tree order
10// files: AsyncIterable<{ path, mode, oid, size, stream }> one per entry; stream: ReadableStream<Uint8Array>
11//
12// Paths are relative to `path`. Modes are git's canonical ones (canon_mode, from parseTree: 100664 → 100644, 40755 → a
13// directory, any type git does not know → 160000):
14// 100644, 100755, 120000 (a symlink; the stream is its target) and 160000 (a gitlink: the submodule's commit is not
15// in this repository, so size 0 and stream null). Directories are implied by the paths (git has no empty ones).
16//
17// Verification. The tree pack is delta-resolved and every object keyed by its computed hash (packresolve.js); a
18// missing tree is pack_corrupt. A blob batch is the same, and an object nobody asked for is pack_corrupt before any
19// file is yielded. A blob fetched on its own (one left in its batch, a batch split down to one, a host that refuses
20// many wants) is readFile's stream: hashed as it passes, erroring rather than ending if the bytes are not the blob's.
21//
22// Memory. The tree pack is one buffered fetch (maxPackBytes, maxInflatedTotal, maxPackObjects); the entries walked are
23// bounded by maxPackObjects (a tree reused at many paths cannot multiply them past it) and the depth by maxPathDepth.
24// A blob batch is one buffered fetch under the same caps; one that hits a cap is split in half and refetched, down to
25// single blobs, which stream in O(1) memory. Every fetch, streamed or buffered, delivers at most maxPackBytes of pack
26// (v2Step): a single blob whose pack is over it is limit_exceeded, not fetched (the default, 128 MiB, is above GitHub's
27// 100 MiB file cap). The iterator holds at most the batch it is yielding (and the previous one while its streams are unread).
28//
29// Errors are values: checkoutTree and treeFiles return a Result. The files iterator errors as an async iterator does, at
30// next(), with the PlyError.
31//
32// Workers-safe (Web APIs only). Writing into a directory is Node's and lives in checkout-node.js.
33/* oxlint-disable import/max-dependencies -- an entry composes the protocol from one import per module, so its bundle carries nothing else */
34/* oxlint-disable unicorn/explicit-length-check, require-unicode-regexp, typescript/prefer-includes -- bundle budget: the JS's truthy length checks and non-unicode regexes, byte for byte (no behaviour change); RegExp#test, not includes: a thrown value's message may be no string at run time */
35import { fail, type CommitMiss, type PlyError } from './errors.js';
36import { assertNever, err, getOrElse, mapOption, ok } from './result.js';
37import type { Result } from './result.js';
38import { operation } from './operation.js';
39import { fetchPack } from './fetchpack.js';
40import { filterUnadvertised, fallbackName, packName } from './fetch.js';
41import type { PackObject, WideFilter } from './fetch.js';
42import { resolveCommit, openBlob, pathComps } from './read.js';
43import type { ReadOptions, RefSpec } from './read.js';
44import { parseCommit, parseTree, canonMode as canonModeOf, TYPE, TYPE_NAME, nonCommitType } from './objects.js';
45import { DEFAULT_LIMITS, limitError, limitsOf, parseLimits } from './limits.js';
46import type { CheckedLimits, LimitsInput } from './limits.js';
47import { probing, withParent } from './transport.js';
48import { MODE_TREE, MODE_COMMIT } from './format.js';
49import type { Span, Tracer } from './otel.js';
50import type { FetchPackResult as FetchedPack } from './fetchpack.js';
51import type { Transport } from './transport.js';
52import type { TreeEntry } from './objects.js';
53import { thrownCodeOr, thrownReasonIs } from './boundary.js';
54import type { TypeNames } from './boundary.js';
55import { fromNullable, fromNullish, mapGet, withDefaults } from './absent.js';
56import type { Input } from './absent.js';
58type PackObjects = NonNullable<FetchedPack['objects']>;
61/* oxlint-disable no-magic-numbers -- a request-size default, not a wire-format fact */
62const BATCH = 1000;
63/* oxlint-enable no-magic-numbers */
64const TREE_MODE = /^[1-7][0-7]*$/;
66/* oxlint-disable no-await-in-loop -- the files are yielded in order, one fetch or stream at a time (bounded memory) */
68// git's canonical modes: a regular file, an executable, a symlink, a gitlink, a directory.
69export type Mode = ReturnType<typeof canonModeOf>;
70// Pure: git's canon_mode for a tree entry's mode (objects.js canonMode: the low 16 bits, as tree-walk keeps them), or
71// null for a mode git does not parse at all or errors on under fsck --strict (empty, not octal, zero-padded). parseTree
72// already returns canonical modes; this is the same function for a caller holding a raw one. Every type that is not a
73// regular file, a symlink or a directory is a gitlink to git (`git ls-tree` shows 140000, 100 and 200644 as 160000).
74export const canonMode = (mode: unknown): Mode | null => (typeof mode === 'string' && TREE_MODE.test(mode) ? canonModeOf(mode) : null);
76// One file of a checkout: its path under the checked-out directory, canonical mode, and blob (or gitlink commit) oid.
77export type CheckoutEntry = { readonly path: string; readonly mode: Mode; readonly oid: string };
78// A tree's entries by oid, or why they cannot be had (a tree missing from the pack, or one that does not parse).
79export type TreeLookup = (oid: string) => Result<readonly TreeEntry[], PlyError>;
80// `depth`: the level the walk starts at (a subtree's own depth); `limits`: maxPackObjects and maxPathDepth.
81export type TreeFilesConfig = { readonly depth: number; readonly limits: LimitsInput };
82export type TreeFilesOptions = Input<TreeFilesConfig>;
83// Pure: every non-tree entry under `oid`, depth first in tree order. `tree(oid)` → parsed entries. Each tree is checked
84// for a name given twice (git fsck duplicateEntries: a symlink `a` beside a directory `a` would route a later write
85// through the link). Every entry visited counts against maxPackObjects, trees included, so a tree reused at many paths
86// (each a distinct path, one object) cannot make the walk outgrow the pack it came from by more than that.
87export function treeFiles(tree: TreeLookup, oid: string, options: TreeFilesOptions = {}): Result<CheckoutEntry[], PlyError> {
88 const { depth, limits } = withDefaults<TreeFilesConfig>(options, { depth: 0, limits: DEFAULT_LIMITS });
89 const checked = parseLimits(limits);
90 if (!checked.ok) return checked;
91 const { maxPackObjects: maxEntries, maxPathDepth: maxDepth } = checked.value;
92 const out: CheckoutEntry[] = [];
93 let seen = 0;
94 const walk = (at: string, prefix: string, level: number): Result<true, PlyError> => {
95 const listed = tree(at);
96 if (!listed.ok) return listed;
97 const names = new Set<string>();
98 for (const e of listed.value) {
99 if (++seen > maxEntries) return err(limitError('checkout entries', seen, maxEntries));
100 if (names.has(e.name)) return fail('pack_corrupt', `tree ${at}: duplicate entry ${JSON.stringify(e.name)} (git fsck duplicateEntries)`);
101 names.add(e.name);
102 const path = prefix ? `${prefix}/${e.name}` : e.name;
103 if (level + 1 > maxDepth) return err(limitError('path depth', level + 1, maxDepth));
104 const mode = canonMode(e.mode);
105 if (mode === null) return fail('pack_corrupt', `tree ${at}: ${path} has mode ${e.mode}, which git cannot check out`);
106 if (mode !== MODE_TREE) { out.push({ path, mode, oid: e.oid }); continue; }
107 const below = walk(e.oid, path, level + 1);
108 if (!below.ok) return below;
109 }
110 return ok(true);
111 };
112 const walked = walk(oid, '', depth);
113 if (!walked.ok) return walked;
114 return ok(out);
115}
117// `blobs`: the blobs the pack brought, by oid (hash-checked by the resolver): none under blob:none; every blob of the
118// commit from a server that takes no filter, so the files iterator reads them from here instead of fetching them again.
119type Trees = { readonly root: string; readonly tree: TreeLookup; readonly objects: number; readonly trees: number; readonly blobs: ReadonlyMap<string, Uint8Array> };
120// The pack: blob:none, or no filter for a host whose advertisement does not list `filter` (fetch.ts filterUnadvertised:
121// learned from the empty answer git's upload-pack gives one, then asked again without it).
122// oxlint-disable-next-line typescript/promise-function-async -- probing's promise, passed through
123function treesPack(t: Transport, commit: string): Promise<Result<FetchedPack & { readonly filter: WideFilter }, PlyError>> {
124 // oxlint-disable-next-line typescript/promise-function-async -- fetchPack's promise, passed through
125 const get = (filter: WideFilter, learned: boolean): Promise<Result<FetchedPack, PlyError>> => fetchPack(t, { wants: [commit], filter, deepen: 1 }, filter === '' ? { attrs: { 'git.fetch.filter.fallback': fallbackName(filter), 'git.fetch.filter.requested': 'blob:none', 'git.fetch.filter.learned': learned } } : {});
126 // one probe at a time per quirks record (transport.ts probing): the filter is read after any wait
127 return probing(t.quirks, 'filter', async (): Promise<Result<FetchedPack & { readonly filter: WideFilter }, PlyError>> => {
128 const filter: WideFilter = t.quirks.treeFilter === 'none' ? '' : 'blob:none';
129 const got = await get(filter, false);
130 if (got.ok) return ok({ ...got.value, filter });
131 if (filter === '' || !(await filterUnadvertised(t, got.error))) return got;
132 const again = await get('', true);
133 return again.ok ? ok({ ...again.value, filter: '' }) : again;
134 });
135}
136// Effect: the commit and every tree under it, as one pack (deepen 1). Returns { root, tree } where tree(oid) parses a
137// tree from that pack. A bare oid that is not a commit (or not on the server) is the caller's not_found.
138async function fetchTrees(t: Transport, commit: string, limits: CheckedLimits): Promise<Result<Trees, PlyError>> {
139 const got = await treesPack(t, commit);
140 if (!got.ok) {
141 if (got.error.code === 'remote_error' && thrownReasonIs(got.error, 'not_our_ref')) return fail('not_found', `commit ${commit} not found on the remote`, { miss: { kind: 'commit', miss: { kind: 'absent', oid: commit } } });
142 return got;
143 }
144 const r = got.value;
145 const objects: PackObjects = r.objects === null ? new Map<string, PackObject>() : r.objects;
146 const wanted = mapGet(objects, commit);
147 const name = packName(r.filter);
148 if (wanted.tag === 'none') return fail('pack_corrupt', `commit ${commit} not in the ${name} pack (${objects.size} objects)`);
149 const c = wanted.value;
150 if (c.type !== TYPE.COMMIT) {
151 const found = nonCommitType(c.type);
152 const miss = ((): CommitMiss => {
153 switch (found.tag) {
154 case 'commit':
155 case 'delta':
156 case 'invalid':
157 return { kind: 'absent', oid: commit };
158 case 'notCommit':
159 return { kind: 'not_commit', oid: commit, type: found.name };
160 }
161 // Stryker disable next-line ConditionalExpression,CallExpression: unreachable, the compiler's exhaustiveness check
162 return assertNever(found);
163 })();
164 return fail('not_found', `${commit} is not a commit`, { miss: { kind: 'commit', miss } });
165 }
166 const tree = (oid: string): Result<readonly TreeEntry[], PlyError> => {
167 const o = mapGet(objects, oid);
168 if (o.tag === 'none' || o.value.type !== TYPE.TREE) return fail('pack_corrupt', `tree ${oid} not in the ${name} pack`);
169 return parseTree(o.value.data, limits);
170 };
171 let trees = 0; const blobs = new Map<string, Uint8Array>();
172 for (const [oid, o] of objects) { if (o.type === TYPE.TREE) trees++; else if (o.type === TYPE.BLOB) blobs.set(oid, o.data); }
173 const parsed = parseCommit(c.data, limits);
174 if (!parsed.ok) return parsed;
175 return ok({ root: parsed.value.tree, tree, objects: objects.size, trees, blobs });
176}
178// Effect: walk `comps` from `root` to the subtree's oid (not_found for a missing component or a non-directory).
179const subtree = (tree: TreeLookup, root: string, comps: readonly string[]): Result<string, PlyError> => {
180 let oid = root;
181 for (const [i, name] of comps.entries()) {
182 const listed = tree(oid);
183 if (!listed.ok) return listed;
184 const e = fromNullable(listed.value.find(x => x.name === name));
185 if (e.tag === 'none') return fail('not_found', `path component ${name} not found`, { miss: { kind: 'path', missing: name, existingPath: comps.slice(0, i).join('/') } });
186 if (e.value.mode !== MODE_TREE) return fail('not_found', `${comps.slice(0, i + 1).join('/')} is not a directory (mode ${e.value.mode})`, { miss: { kind: 'not_directory', path: comps.slice(0, i + 1).join('/'), mode: e.value.mode } });
187 oid = e.value.oid;
188 }
189 return ok(oid);
190};
192// Effect: one wants-list fetch of blobs, buffered and delta-resolved. Every object is keyed by its computed hash; one
193// that was not asked for, or is not a blob, is pack_corrupt. A wanted blob the pack leaves out is simply absent.
194async function fetchBlobs(t: Transport, oids: readonly string[]): Promise<Result<PackObjects, PlyError>> {
195 const want = new Set(oids);
196 const fetched = await fetchPack(t, { wants: oids });
197 if (!fetched.ok) return fetched;
198 const objects: PackObjects = fetched.value.objects === null ? new Map<string, PackObject>() : fetched.value.objects;
199 for (const [oid, o] of objects) {
200 if (!want.has(oid)) return fail('pack_corrupt', `object ${oid} served but not wanted (${oids.length} blobs asked for)`);
201 if (o.type !== TYPE.BLOB) return fail('pack_corrupt', `expected blob ${oid}, got ${getOrElse<string | number>(fromNullish((TYPE_NAME as TypeNames)[o.type]), o.type)}`);
202 }
203 return ok(objects);
204}
206// A host that answers a many-wants fetch with an error status, ERR or broken framing is asked for one blob at a time
207// from then on (remembered on the transport's quirks). A lie (pack_corrupt) is never a reason to fall back.
208const isWantsRefusal = (e: unknown): boolean => { const code = thrownCodeOr(e, null); return code === 'http' || code === 'remote_error' || code === 'protocol'; };
210// The files iterator's edge: a failure (a refused fetch, a blob that cannot be opened) rejects next() with its PlyError.
211const raise = (e: PlyError): never => { throw e; };
213const bytesStream = (data: Uint8Array): ReadableStream<Uint8Array> => new ReadableStream({ start(c) { if (data.length) c.enqueue(data); c.close(); } });
215// The files iterator. Gitlinks first (nothing to fetch), then the unique blobs in `batch`-sized wants lists; every path
216// naming a blob is yielded with it. Its span, `git.checkout.blobs`, starts at the first next() and ends when the
217// iteration does, both after the checkout root has ended: it is the root of its own trace with a follows_from link to
218// the checkout root (README "Span lifetimes"), and each streamed blob's git.read.blob follows it in turn. A failure is
219// the iterator's: next() rejects with the PlyError (the async iterator's edge).
220// `held`: the blobs the trees pack already brought (fetchTrees), read from there instead of fetched.
221type BlobPlan = { readonly batch: number; readonly held: ReadonlyMap<string, Uint8Array> };
222async function* blobFiles(transport: Transport, tracer: Tracer, opener: Span, entries: readonly CheckoutEntry[], { batch, held }: BlobPlan): AsyncGenerator<CheckoutFile, void, void> {
223 const span = tracer.start('git.checkout.blobs', { follows: opener });
224 const t: Transport = withParent(transport, span);
225 const byOid = new Map<string, CheckoutEntry[]>();
226 for (const e of entries) if (e.mode !== MODE_COMMIT) { const l = byOid.get(e.oid); if (l) l.push(e); else byOid.set(e.oid, [e]); }
227 const stat = { fetches: 0, buffered: 0, streamed: 0, splits: 0, bytes: 0 };
228 span.set({ 'git.checkout.blobs.unique': byOid.size, 'git.checkout.blobs.paths': entries.length });
229 let single = t.quirks.blobWants === 'single';
230 // A buffered blob is a stream over its bytes; any other is openBlob's.
231 const openPath = async (oid: string, data: Uint8Array | null): Promise<{ readonly size: number; readonly stream: ReadableStream<Uint8Array> }> => {
232 if (data) return { size: data.length, stream: bytesStream(data) };
233 const o = await openBlob(t, oid, { follows: span });
234 if (!o.ok) return raise(o.error);
235 return o.value;
236 };
237 // [oid, data | null] for each oid, in order; null means "stream it on its own"
238 async function* group(oids: readonly string[]): AsyncGenerator<readonly [string, Uint8Array | null], void, void> {
239 if (oids.length === 1 || single) { for (const oid of oids) yield [oid, null]; return; }
240 const got = await fetchBlobs(t, oids);
241 if (!got.ok) {
242 const e = got.error;
243 if (e.code === 'limit_exceeded') { stat.splits++; const h = Math.ceil(oids.length / 2); yield* group(oids.slice(0, h)); yield* group(oids.slice(h)); return; }
244 if (!isWantsRefusal(e)) raise(e);
245 single = true;
246 t.quirks.blobWants = 'single';
247 span.set({ 'git.checkout.blobs.refused': e.code });
248 yield* group(oids); return;
249 }
250 stat.fetches++;
251 for (const oid of oids) yield [oid, getOrElse(mapOption(mapGet(got.value, oid), o => o.data), null)];
252 }
253 // group() over the oids the trees pack did not already bring, in order: a held blob is yielded where it stands.
254 async function* fetched(oids: readonly string[]): AsyncGenerator<readonly [string, Uint8Array | null], void, void> {
255 let run: string[] = [];
256 for (const oid of oids) {
257 const h = mapGet(held, oid);
258 if (h.tag === 'none') { run.push(oid); continue; }
259 if (run.length > 0) { yield* group(run); run = []; }
260 yield [oid, h.value];
261 }
262 if (run.length > 0) yield* group(run);
263 }
264 let done = false;
265 try {
266 for (const e of entries) if (e.mode === MODE_COMMIT) yield { path: e.path, oid: e.oid, mode: e.mode, size: 0, stream: null };
267 const oids = [...byOid.keys()];
268 for (let i = 0; i < oids.length; i += batch) {
269 for await (const [oid, data] of fetched(oids.slice(i, i + batch))) {
270 // every oid in a group is a key of byOid
271 // oxlint-disable-next-line typescript/no-unsafe-type-assertion, typescript/non-nullable-type-assertion-style -- see above (and no `!`: docs/STACK.md)
272 for (const e of byOid.get(oid) as CheckoutEntry[]) {
273 // a streamed blob is opened per path: one stream cannot be read twice, and tee() would hold the whole blob
274 const opened = await openPath(oid, data);
275 // oxlint-disable-next-line max-depth -- try, batch, group, paths of one blob: the iterator's shape, as before
276 if (data) stat.buffered++; else stat.streamed++;
277 stat.bytes += opened.size;
278 // gitlinks were yielded above and are not in byOid. The arm is what makes `mode` discriminate CheckoutFile
279 // (narrowing `e.mode` does not narrow the entry object, and a spread would not either).
280 yield e.mode === MODE_COMMIT
281 ? { path: e.path, oid: e.oid, mode: e.mode, size: 0, stream: null }
282 : { path: e.path, oid: e.oid, mode: e.mode, size: opened.size, stream: opened.stream };
283 }
284 }
285 }
286 done = true;
287 } catch (e) {
288 const code = thrownCodeOr(e, null);
289 span.error(e, code).set({ 'git.checkout.blobs.outcome': code === null ? 'error' : code });
290 throw e;
291 } finally {
292 span.set({ 'git.checkout.blobs.fetches': stat.fetches, 'git.checkout.blobs.buffered': stat.buffered, 'git.checkout.blobs.streamed': stat.streamed, 'git.checkout.blobs.splits': stat.splits, 'git.checkout.blobs.bytes': stat.bytes, 'git.checkout.blobs.single': single });
293 if (done) span.set({ 'git.checkout.blobs.outcome': 'ok' });
294 // oxlint-disable-next-line typescript/strict-boolean-expressions -- any falsy outcome counts as none recorded, as before
295 else if (!span.attrs['git.checkout.blobs.outcome']) span.set({ 'git.checkout.blobs.outcome': 'cancelled' });
296 span.end();
297 }
298}
300// A file the iterator yields: its entry, size and content (null for a gitlink: its commit is not in this repository).
301// A gitlink has no blob, so no stream. Every other entry has one: the mode is the discriminant.
302export type CheckoutFile = Omit<CheckoutEntry, 'mode'> & (
303 | { readonly mode: typeof MODE_COMMIT; readonly size: number; readonly stream: null }
304 | { readonly mode: Exclude<Mode, typeof MODE_COMMIT>; readonly size: number; readonly stream: ReadableStream<Uint8Array> }
305);
306export type CheckoutResult = {
307 readonly ref: string;
308 readonly commit: string;
309 readonly tree: string;
310 readonly path: string;
311 readonly entries: readonly CheckoutEntry[];
312 readonly files: AsyncGenerator<CheckoutFile, void, void>;
313};
314// What checkoutTree takes. `ref: null` is the remote's HEAD; `path` null, '' or '/' is the whole tree.
315export type CheckoutConfig = { readonly ref: RefSpec; readonly path: string | null };
316export type CheckoutSpec = Input<CheckoutConfig>;
317// The options: operation()'s, plus `batch` (wants per blob fetch, 1..limits.maxPackObjects).
318export type CheckoutOptions = ReadOptions & Input<{ readonly batch: number }>;
319// The path's components and a batch the limits allow, refused in the order the entry always checked them.
320function checkoutArgs(path: unknown, batch: number, limits: CheckedLimits): Result<string[], PlyError> {
321 const comps = pathComps(path, limits, { allowRoot: true });
322 if (!comps.ok) return comps;
323 if (!Number.isSafeInteger(batch) || batch < 1) return fail('bad_request', 'batch must be an integer from 1 to limits.maxPackObjects', { what: 'batch' });
324 if (batch > limits.maxPackObjects) return fail('bad_request', 'batch must be an integer from 1 to limits.maxPackObjects', { what: 'batch' });
325 return comps;
326}
327// oxlint-disable-next-line require-await -- async: a refused argument is an Err in a promise, like every other answer
328export async function checkoutTree(url: string, spec: CheckoutSpec = {}, options: CheckoutOptions = {}): Promise<Result<CheckoutResult, PlyError>> {
329 const { ref, path } = withDefaults<CheckoutConfig>(spec, { ref: null, path: '' });
330 const { batch } = withDefaults<{ readonly batch: number }>(options, { batch: BATCH });
331 // A null limits record is the default, as the nullish read had it; the record is parsed once, here.
332 const checked = limitsOf(options);
333 if (!checked.ok) return checked;
334 const limits = checked.value;
335 const args = checkoutArgs(path, batch, limits);
336 if (!args.ok) return args;
337 const comps = args.value;
338 return operation('checkout', url, { ...options, limits, attrs: { 'git.checkout.ref': ref === null ? 'HEAD' : ref, 'git.checkout.path': comps.join('/'), 'git.checkout.batch': batch } }, async ({ t, root, outcome }) => {
339 const resolved = await resolveCommit(t, ref);
340 if (!resolved.ok) return resolved;
341 const { name, commit } = resolved.value;
342 const fetched = await fetchTrees(t, commit, limits);
343 if (!fetched.ok) return fetched;
344 const trees = fetched.value;
345 const sub = subtree(trees.tree, trees.root, comps);
346 if (!sub.ok) return sub;
347 const oid = sub.value;
348 const listed = treeFiles(trees.tree, oid, { depth: comps.length, limits });
349 if (!listed.ok) return listed;
350 const entries = listed.value;
351 // the tracer operation() started the root span on (opts.tracer)
352 const files = blobFiles(t, root.tracer, root, entries, { batch, held: trees.blobs });
353 return outcome('ok', { ref: name, commit, tree: oid, path: comps.join('/'), entries, files }, {
354 'git.checkout.commit': commit, 'git.checkout.tree': oid, 'git.checkout.entries': entries.length,
355 'git.checkout.pack.objects': trees.objects, 'git.checkout.pack.trees': trees.trees,
356 });
357 });
358}
Diagnostics6 git calls · 27 ms
CallStatusSizeTime027 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=10Open 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=1 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=5323b9266eea5ded637285d1c5320699f12be76eOpen pack map
fetchtree:02002.4 KiB · hit1 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=20 git.response.bytes=2507 git.response.cache=HIT git.response.duration_ms=1 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=723b6bf1d4d6021fe5eb940c622b9ff00ee4a381Open pack map
fetch2008.1 KiB · hit20 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=8306 git.response.cache=HIT git.response.duration_ms=20 git.fetch.wants=51d1d214a0b4425230b20b695f7ad2067652b980 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=5 git.pkt.data=4 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=8306 git.pkt.payload.max=8192 git.sideband.band1.bytes=8274 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
- a5e15f6bca5a725b
- Request
- e3cc7b1d…
- 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