main
1// Every public entry takes refs and paths as plain `string`: each checks them at run time (validateRef, validatePushRef,
2// validatePath → bad_request) and keeps the Refname / Path brands inside. readme.typetest.ts covers the README calls;
3// this file covers the rest. `tsc --noEmit` must pass.
4import { editFile, validateSpec } from '../../src/edit.js';
5import { commitChanges, type Change } from '../../src/changes.js';
6import { pushTree } from '../../src/tree.js';
7import { pushDir } from '../../src/tree-node.js';
8import { readFile, listTree, readCommit } from '../../src/read.js';
9import { readLog } from '../../src/log.js';
10import { checkoutTree } from '../../src/checkout.js';
11import { checkoutDir } from '../../src/checkout-node.js';
12import { mergeBranch, fastForward, deleteRef } from '../../src/merge.js';
13import { rebaseBranch, cherryPick, revertCommit, pickCommit } from '../../src/rebase.js';
14import { createBranch, deleteBranch, createTag } from '../../src/refops.js';
15import { GitHttp } from '../../src/client.js';
16import { push, type Command } from '../../src/push.js';
17import { Tracer } from '../../src/otel.js';
18import { DEFAULT_LIMITS } from '../../src/limits.js';
19import type { Transport } from '../../src/transport.js';
21declare const url: string;
22declare const ref: string;
23declare const path: string;
24declare const oid: string;
25declare const t: Transport;
26const tracer = new Tracer();
27const author = { name: 'a', email: 'a@x' };
29await editFile(url, { ref, base: ref, path, find: 'a', replace: 'b', author, message: 'm' }, { tracer });
30void validateSpec({ ref, path, find: 'a', replace: 'b', author, message: 'm' }, DEFAULT_LIMITS);
31const changes: Change[] = [
32 { kind: 'create', path, content: 'x' }, { kind: 'write', path, content: 'x', mode: '100755' },
33 { kind: 'edit', path, find: 'a', replace: 'b' }, { kind: 'delete', path }, { kind: 'rename', from: path, to: path },
34];
35await commitChanges(url, { ref, base: ref, changes, author, message: 'm' }, { tracer });
36await pushTree(url, { ref, base: ref, files: { [path]: 'x' }, author, message: 'm' }, { tracer });
37await pushDir(url, { dir: '.', ref, author, message: 'm' }, { tracer });
38await readFile(url, { ref, path }, { tracer });
39await listTree(url, { ref, path }, { tracer });
40await readCommit(url, { ref }, { tracer });
41await readLog(url, { ref, limit: 5 }, { tracer });
42await checkoutTree(url, { ref, path }, { tracer });
43await checkoutDir(url, { dir: './out', ref, path }, { tracer });
44await checkoutDir(url, { dir: './out' }, { tracer });
45await mergeBranch(url, { ref, from: ref, author }, { tracer });
46await rebaseBranch(url, { ref, onto: ref, committer: author }, { tracer });
47await cherryPick(url, { ref, commit: oid, committer: author }, { tracer });
48await revertCommit(url, { ref, commit: oid, committer: author }, { tracer });
49await pickCommit(url, { ref, commit: oid, committer: author, revert: true }, { tracer });
50await createBranch(url, { ref, from: ref }, { tracer, verify: true });
51await deleteBranch(url, { ref, expected: oid }, { tracer });
52await deleteBranch(url, { ref }, { tracer });
53await createTag(url, { name: ref, target: ref, message: 'm', tagger: author }, { tracer });
54await fastForward(t, { ref, from: oid, to: oid });
55await deleteRef(t, { ref, oid });
56const command: Command = { ref, oldOid: oid, newOid: oid };
57await push(t, { ref, oldOid: oid, newOid: oid, objects: [] });
58await push(t, { commands: [command] });
59const client = GitHttp.create(url);
60if (client.ok) await client.value.push({ ref, oldOid: oid, newOid: oid, objects: [], atomic: false });
62// HttpOptions in, HttpSettings out (#156): settings come only from parseHttpOptions
63import { parseHttpOptions, type HttpSettings } from '../../src/http.js';
64const settings = parseHttpOptions(url, { userAgent: 'x', limits: DEFAULT_LIMITS });
65if (settings.ok) { const s: HttpSettings = settings.value; const n: number = s.requestTimeoutMs; void n; }
66// @ts-expect-error a plain record is not HttpSettings (the brand)
67const forgedSettings: HttpSettings = { requestTimeoutMs: 1 };
68void forgedSettings;
69// Ids, prefixes and tree entries are plain strings too, parsed at each entry (#156, part 2)
70import { fetchObject } from '../../src/fetch.js';
71import { fetchCommit } from '../../src/commit.js';
72import { mergeBase, bestBases } from '../../src/merge.js';
73import { walkPath } from '../../src/read.js';
74import { lsRefsBody } from '../../src/lsrefs.js';
75import { encodeTree } from '../../src/objects.js';
76import { fetchBody } from '../../src/fetch.js';
77declare const mode: string;
78await fetchObject(t, { oid, filter: 'tree:0' });
79await fetchCommit(t, oid);
80await mergeBase(t, oid, oid);
81await walkPath(t, oid, [path]);
82void lsRefsBody([ref]);
83void encodeTree([{ mode, name: path, oid }]);
84void fetchBody({ wants: [oid], haves: [oid] });
85// a caller's own graph names its nodes with any strings
86void bestBases(new Map<string, { readonly parents: readonly string[] }>([['a', { parents: [] }]]), 'a', 'a');
Diagnostics4 git calls · 34 ms
CallStatusSizeTime034 ms
discover200152 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=152 git.server.agent=gitty/1.0 git.server.object_format=sha1 git.server.caps=agent ls-refs fetch object-format git.server.fetch=shallow filter sideband-all git.protocol.version=2 git.pkt.frames=8 git.pkt.data=6 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=152 git.pkt.payload.max=34
ls-refs200145 B · 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=145 git.response.cache=HIT git.response.duration_ms=2 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=145 git.pkt.payload.max=76 git.ls_refs.count=2 git.ls_refs.head=refs/heads/main
fetchblob:none · deepen 1020038 KiB · hit7 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=24 git.response.bytes=38434 git.response.cache=HIT git.response.duration_ms=7 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false 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=6 git.pkt.data=4 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=38434 git.pkt.payload.max=38339 git.sideband.band1.bytes=38338 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=63 git.pack.bytes=38338 git.pack.ofs_delta=0 git.pack.ref_delta=8 git.pack.chain.max=8 git.pack.trailer=0bc36ab7adf82d3109177f11f1ea93f1ce071f77 git.pack.full=55Open pack map
fetch2001.6 KiB · hit24 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=1606 git.response.cache=HIT git.response.duration_ms=24 git.fetch.wants=07eef897865698b6fc24457390d4c5ff8f68a25d 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=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=1606 git.pkt.payload.max=1585 git.sideband.band1.bytes=1584 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://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/ply.git
- Ref
- refs/heads/main
- Commit
- 19912563f540228593df0c489082e5e2508e21e4
- cf-ray
- a5e2f2152f4ffda9
- Request
- 62791240…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format