main
1// Caller-supplied strings that reach a git object header or a protocol command line are validated here.
2// Anything that could terminate a header line or a pkt-line field is rejected rather than escaped: git has no escaping.
3// Each check returns a Result.
4import { fail } from './errors.js';
5import type { ErrorOf } from './errors.js';
6import { parseLimits } from './limits.js';
7import type { LimitsInput } from './limits.js';
8import { encodeBytes, te } from './bytes.js';
9import { MODE_LINK, IDENT_TZ_DIGITS, IDENT_TZ_HOUR_MIN, IDENT_TZ_HOUR_MAX, IDENT_TZ_MINUTE_MAX } from './format.js';
10import type { Err, Option, Result } from './result.js';
11import { none, ok, some } from './result.js';
12import type { Input } from './absent.js';
13import { withDefaults } from './absent.js';
14import type { Refname } from './refname.js';
15import type { Path } from './path.js';
17type Bad = ErrorOf<'bad_request'>;
18const bad = (what: string, why: string): Err<Bad> => fail('bad_request', `invalid ${what}: ${why}`, { what });
20// Brand for an ident that has been through validateIdent. A spread drops it, so ident() cannot be fed a copy.
21const VALIDATED_IDENT: unique symbol = Symbol('validatedIdent');
22export type Ident = { readonly name: string; readonly email: string; readonly time: number; readonly tz: string };
23export type ValidatedIdent = Ident & { readonly [VALIDATED_IDENT]: true };
24// What a caller hands validateIdent: anything, field by field (a public input record, parsed once below).
25export type IdentFields = { readonly name: unknown; readonly email: unknown; readonly time: unknown; readonly tz: unknown };
26export type IdentInput = Input<IdentFields>;
27export const isValidatedIdent = (person: unknown): person is ValidatedIdent =>
28 typeof person === 'object' && person !== null && Reflect.get(person, VALIDATED_IDENT) === true;
29const TZ_TEXT = new RegExp(`^[+-][0-9]{${IDENT_TZ_DIGITS}}$`, 'u');
30// A field the caller left out is null here, which every check below refuses as it refused the missing value. An
31// omitted zone means UTC (a null one is refused, as before).
32const identDefaults = (): IdentFields => ({ name: null, email: null, time: null, tz: '+0000' });
34export function validateIdent(input: IdentInput = {}): Result<ValidatedIdent, Bad> {
35 const { name, email, time, tz } = withDefaults(input, identDefaults());
36 // Exactly fsck.c fsck_ident(): name is everything before " <" and may not contain '<', '>', NUL or newline;
37 // email is between '<' and '>' and may not contain '<', '>', NUL or newline. Anything else — punctuation,
38 // leading/trailing spaces, tabs, empty name or email — is a valid object. (Verified against git fsck --strict.)
39 for (const [k, v] of [['author name', name], ['author email', email]] as const) {
40 if (typeof v !== 'string') return bad(k, 'must be a string');
41 if (/[\0\n<>]/u.test(v)) return bad(k, 'must not contain NUL, newline, < or >');
42 }
43 // Caller time is a unix epoch. A string would be interpolated into the header; only a safe non-negative integer is.
44 if (!Number.isSafeInteger(time) || Number(time) < 0) return bad('time', 'must be a non-negative safe integer');
45 // Caller zones are the civil range. fsck_ident does not range-check (checkIdent still accepts +9999).
46 if (typeof tz !== 'string' || !TZ_TEXT.test(tz)) return bad('tz', 'must be a sign and four digits');
47 const hourDigits = IDENT_TZ_DIGITS / 2;
48 const sign = tz.startsWith('-') ? -1 : 1;
49 const hours = sign * Number(tz.slice(1, 1 + hourDigits));
50 const minutes = Number(tz.slice(1 + hourDigits));
51 if (minutes > IDENT_TZ_MINUTE_MAX || minutes < 0) return bad('tz', 'minutes out of range');
52 if (hours < IDENT_TZ_HOUR_MIN || hours > IDENT_TZ_HOUR_MAX) return bad('tz', 'hours out of range');
53 if ((hours === IDENT_TZ_HOUR_MAX || hours === IDENT_TZ_HOUR_MIN) && minutes !== 0) return bad('tz', 'extreme offset must be on the hour');
54 const person = { name, email, time, tz };
55 Object.defineProperty(person, VALIDATED_IDENT, { value: true });
56 // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- the loop above checked name and email, defineProperty added the brand; neither narrows the type
57 return ok(Object.freeze(person) as ValidatedIdent);
58}
60// A pkt-line field. CR, LF, or NUL ends the line or the command the way a header injection does.
61declare const wireBrand: unique symbol;
62/** One pkt-line field: a string without NUL, CR, or LF (validateWire grants the brand, and nothing else does). */
63export type WireField = string & { readonly [wireBrand]: typeof wireBrand };
64// The whole check, and the brand it grants.
65const isWireField = (value: unknown): value is WireField => typeof value === 'string' && !/[\0\r\n]/u.test(value);
66export function validateWire(value: unknown, what: string): Result<WireField, Bad> {
67 if (!isWireField(value)) return bad(what, 'must be a string without NUL, CR, or LF');
68 return ok(value);
69}
71// An HTTP field value (RFC 9110 §5.5): field-vchar (VCHAR, obs-text 0x80-0xFF), SP and HTAB. A control character
72// or a code point above U+00FF is no header value (fetch refuses it as a ByteString), so it is refused here, before
73// it could fail later as a retryable network error (#300-1). It is also a WireField (no NUL, CR or LF). field-content
74// starts and ends with a field-vchar, so a leading or trailing SP or HTAB is refused too.
75export function validateFieldValue(value: unknown, what: string): Result<WireField, Bad> {
76 // oxlint-disable-next-line no-control-regex -- RFC 9110 field-content excludes the controls; matching them is the point
77 if (!isWireField(value) || /[^\t\u0020-\u007E\u0080-\u00FF]|^[\t ]|[\t ]$/u.test(value)) return bad(what, 'must be an HTTP field value: visible ASCII, Latin-1, space or tab');
78 return ok(value);
79}
81// The first check of validateRef, and the brand it grants: a value leaves validateRef as a Refname only
82// after every check below it, so the brand is the whole check (refname.ts reads the brand; no second test).
83const isFullRef = (ref: unknown): ref is Refname => typeof ref === 'string' && ref.startsWith('refs/');
85export function validateRef(ref: unknown): Result<Refname, Bad> {
86 if (!isFullRef(ref)) return bad('ref', 'must be a full ref name starting with refs/');
87 // git check-ref-format rules that matter for injection and server acceptance
88 // (NUL, CR, LF and the other controls are one class: check-ref-format refuses all of them)
89 // oxlint-disable-next-line no-control-regex -- check-ref-format refuses control characters; matching them is the point
90 if (/[\0-\u001F\u007F ~^:?*[\\]|\.\.|@\{|\/\/|\/$|\.$|\.lock(\/|$)|^\/|\/\.|^\./u.test(ref)) return bad('ref', 'fails check-ref-format');
91 if (ref.length > 1024) return bad('ref', 'too long');
92 // a lone surrogate would be written as U+FFFD (TextEncoder); only an escaped byte from a read maps back (#43)
93 const bytes = encodeBytes(ref, 'ref');
94 if (!bytes.ok) return bytes;
95 return ok(ref);
96}
98// A ref a push may name: git v2.50.0 receive-pack.c update() refuses anything else as "funny refname", checking the name
99// after "refs/" with check_refname_format(name + 5, deleting ? REFNAME_ALLOW_ONELEVEL : 0). validateRef already holds the
100// full name to check_refname_format, so every component passes; what is left is the part after refs/ as a refname of its
101// own: it may not be exactly "@" (refs/@), and a create or update needs two components there (refs/foo can be deleted,
102// never written). Proved cell by cell against git in test/space/refname.test.js.
103// Any value: validateRef refuses a non-string (push.ts parses a caller's command with it).
104export function validatePushRef(ref: unknown, deleting: boolean): Result<Refname, Bad> {
105 const full = validateRef(ref);
106 if (!full.ok) return full;
107 const name = full.value.slice('refs/'.length);
108 if (name === '@' || (!deleting && !name.includes('/'))) return bad('ref', 'receive-pack refuses it (funny refname)');
109 return full;
110}
112// ---- git's spellings of .git and its dotfiles (git v2.50.0 utf8.c is_hfs_dot*, path.c is_ntfs_dot*), on name bytes ----
113// Ported line by line, because the edges are where a name gets through: `git~1` but not `git~2`; `.git:x` (an NTFS
114// stream) and `.git . .` (NTFS trims trailing dots and spaces); `.g\u200cit` and `.git\xff` (HFS+ skips ignorable code
115// points, and git treats an invalid UTF-8 sequence after `.git` as the end of the name); `gi7eba~1` and `~1234567` (the
116// NTFS fallback short names of .gitmodules); `a\.git` (fsck reads a backslash as a separator, whatever the platform).
117// Case folds ASCII only (git's tolower), never Unicode. The fuzz-free check of all of it: test/space/fsck-tree.test.js.
118// These run on every tree entry (#207): nothing below allocates. The needles are encoded once, here; a code point and its
119// length are two calls, not a tuple; the loops are inline, not closures. test/dotnames.test.js holds every function
120// below to the version before #207 (test/oracle/dotnames-ref.ts) over every byte string up to three bytes, every
121// spelling's truncations and one-byte substitutions, and random names; test/fuzz/dotnames.mjs runs the large campaign.
122// Past the end reads 0 (git's NUL terminator); no caller passes a negative index.
123// oxlint-disable-next-line typescript/no-unsafe-type-assertion, typescript/non-nullable-type-assertion-style -- i < b.length: the read is in range (`as`, not the `!` src/ forbids)
124const at = (b: Uint8Array, i: number): number => (i < b.length ? (b[i] as number) : 0);
125const lower = (c: number): number => (c >= 0x41 && c <= 0x5a ? c + 0x20 : c);
126// ASCII needles only: their UTF-8 bytes are their code points
127const ascii = (s: string): Uint8Array => te.encode(s);
128const GIT = ascii('git');
129const IT_TILDE_1 = ascii('it~1');
131// utf8.c pick_one_utf8_char at i: the sequence's length (1 to 4), or 0 for what git calls invalid (C0/C1 leads, overlong
132// 3- and 4-byte forms, surrogates, U+FFFE/U+FFFF, above U+10FFFF, a cut sequence). Its code point is codePointAt's.
133const cont = (c: number): boolean => (c & 0xc0) === 0x80;
134// oxlint-disable-next-line eslint/complexity -- pick_one_utf8_char line for line
135function utf8Length(b: Uint8Array, i: number): number {
136 const s0 = at(b, i);
137 if (s0 < 0x80) return 1;
138 const s1 = at(b, i + 1);
139 if ((s0 & 0xe0) === 0xc0) return !cont(s1) || (s0 & 0xfe) === 0xc0 ? 0 : 2;
140 const s2 = at(b, i + 2);
141 if ((s0 & 0xf0) === 0xe0) {
142 if (!cont(s1) || !cont(s2) || (s0 === 0xe0 && (s1 & 0xe0) === 0x80) || (s0 === 0xed && (s1 & 0xe0) === 0xa0) || (s0 === 0xef && s1 === 0xbf && (s2 & 0xfe) === 0xbe)) return 0;
143 return 3;
144 }
145 const s3 = at(b, i + 3);
146 if ((s0 & 0xf8) === 0xf0) {
147 if (!cont(s1) || !cont(s2) || !cont(s3) || (s0 === 0xf0 && (s1 & 0xf0) === 0x80) || (s0 === 0xf4 && s1 > 0x8f) || s0 > 0xf4) return 0;
148 return 4;
149 }
150 return 0;
151}
152// The code point of the `len`-byte sequence at i (utf8Length's answer, not 0)
153function codePointAt(b: Uint8Array, i: number, len: number): number {
154 const s0 = at(b, i);
155 if (len === 1) return s0;
156 if (len === 2) return ((s0 & 0x1f) << 6) | (at(b, i + 1) & 0x3f);
157 if (len === 3) return ((s0 & 0x0f) << 12) | ((at(b, i + 1) & 0x3f) << 6) | (at(b, i + 2) & 0x3f);
158 return ((s0 & 0x07) << 18) | ((at(b, i + 1) & 0x3f) << 12) | ((at(b, i + 2) & 0x3f) << 6) | (at(b, i + 3) & 0x3f);
159}
160// utf8.c next_hfs_char's list: U+200C..U+200F, U+202A..U+202E, U+206A..U+206F, U+FEFF
161const hfsIgnored = (cp: number): boolean =>
162 (cp >= 0x20_0c && cp <= 0x20_0f) || (cp >= 0x20_2a && cp <= 0x20_2e) || (cp >= 0x20_6a && cp <= 0x20_6f) || cp === 0xfe_ff;
163// utf8.c is_hfs_dot_generic: `.` and the needle, ASCII case folded, then the end or `/`, reading code points with
164// next_hfs_char (the ones HFS+ ignores are skipped; an invalid sequence reads as 0, the end). k = -1 reads the dot,
165// k = needle.length the end. Every read decides: a 0 (an invalid sequence, or the end) is the end at k = needle.length
166// and fails every other read, so nothing is read after one (git's "0 from then on" is never consulted). git also
167// refuses a code point above 127 before folding; lower() leaves one unchanged and no needle byte is above 127, so the
168// comparison alone refuses it.
169function isHfsDot(b: Uint8Array, needle: Uint8Array): boolean {
170 let i = 0;
171 for (let k = -1; ; k++) {
172 let c = 0;
173 for (;;) {
174 const len = utf8Length(b, i);
175 if (len === 0) break;
176 const cp = codePointAt(b, i, len);
177 i += len;
178 if (!hfsIgnored(cp)) { c = cp; break; }
179 }
180 if (k === needle.length) return c === 0 || c === 0x2f;
181 if (k < 0 ? c !== 0x2e : lower(c) !== needle[k]) return false;
182 }
183}
184// The `count` bytes at i are `needle`'s first `count`, ASCII case folded
185function foldedAt(b: Uint8Array, i: number, needle: Uint8Array, count: number): boolean {
186 for (let k = 0; k < count; k++) if (lower(at(b, i + k)) !== needle[k]) return false;
187 return true;
188}
189// path.c is_ntfs_dotgit, from offset `o`: `.git` or `git~1`, then only dots and spaces up to the end, a separator
190// (`/` or `\`) or `:`. git folds case for the letters only (`.git`, and `gi` of `git~1`); folding `~1` too is the same
191// test, since lower() changes only A-Z.
192function isNtfsDotGit(b: Uint8Array, o: number): boolean {
193 const c0 = at(b, o);
194 if (c0 !== 0x2e && lower(c0) !== 0x67) return false;
195 const want = c0 === 0x2e ? GIT : IT_TILDE_1;
196 if (!foldedAt(b, o + 1, want, want.length)) return false;
197 for (let i = o + 1 + want.length; ; i++) {
198 const c = at(b, i);
199 if (c === 0 || c === 0x2f || c === 0x5c || c === 0x3a) return true;
200 if (c !== 0x2e && c !== 0x20) return false;
201 }
202}
203// is_ntfs_dot_generic's tail from i: only dots and spaces up to the end or `:`
204function ntfsTail(b: Uint8Array, i: number): boolean {
205 for (let j = i; ; j++) {
206 const x = at(b, j);
207 if (x === 0 || x === 0x3a) return true;
208 if (x !== 0x20 && x !== 0x2e) return false;
209 }
210}
211type DotSpelling = { readonly name: Uint8Array; readonly prefix: Uint8Array };
212// path.c is_ntfs_dot_generic, from offset `o`: `.<name>`, its 6-character short name `<name[0..6]>~1`..`~4`, or the
213// fallback short name (`<prefix>~N` with digits to 8 characters), then only dots and spaces up to the end or `:`
214function isNtfsDot(b: Uint8Array, o: number, { name, prefix }: DotSpelling): boolean {
215 if (at(b, o) === 0x2e && foldedAt(b, o + 1, name, name.length)) return ntfsTail(b, o + name.length + 1);
216 if (foldedAt(b, o, name, 6) && at(b, o + 6) === 0x7e && at(b, o + 7) >= 0x31 && at(b, o + 7) <= 0x34) return ntfsTail(b, o + 8);
217 let sawTilde = false;
218 for (let i = 0; i < 8; i++) {
219 const x = at(b, o + i);
220 if (x === 0) return false;
221 if (sawTilde) { if (x < 0x30 || x > 0x39) return false; }
222 else if (x === 0x7e) { const d = at(b, o + ++i); if (d < 0x31 || d > 0x39) return false; sawTilde = true; }
223 // git also refuses i >= 6 and a byte >= 0x80 here: past the prefix's 6 bytes at() reads 0, which x is not (refused
224 // above), and lower() leaves a byte >= 0x80 unchanged, which no prefix byte is; the comparison refuses both
225 else if (lower(x) !== at(prefix, i)) return false;
226 }
227 return ntfsTail(b, o + 8);
228}
229export type DotFile = 'gitmodules' | 'gitignore' | 'gitattributes' | 'mailmap';
230const dot = (name: string, prefix: string): DotSpelling => ({ name: ascii(name), prefix: ascii(prefix) });
231const DOTFILES: Readonly<Record<DotFile, DotSpelling>> = {
232 gitmodules: dot('gitmodules', 'gi7eba'), gitignore: dot('gitignore', 'gi250a'), gitattributes: dot('gitattributes', 'gi7d29'), mailmap: dot('mailmap', 'maba30'),
233};
234const GITMODULES = DOTFILES.gitmodules.name;
235// is_ntfs_dotgit (`dotgit`) or is_ntfs_dot<file> after any backslash in the name (fsck_tree's offsets past the first)
236function afterBackslash(b: Uint8Array, dotgit: boolean): boolean {
237 for (let i = b.indexOf(0x5c); i >= 0; i = b.indexOf(0x5c, i + 1)) {
238 if (dotgit ? isNtfsDotGit(b, i + 1) : isNtfsDot(b, i + 1, DOTFILES.gitmodules)) return true;
239 }
240 return false;
241}
242// Every spelling above, from offset 0, starts with one of these bytes: `.`; the lead byte of an HFS+ ignorable (E2 for
243// U+20xx, EF for U+FEFF), which isHfsDot skips before the dot; `g`/`G` (git~1, and every name's and prefix's first
244// letter but mailmap's) and `m`/`M` (mailmap's); `~` (a fallback short name with no prefix, `~1234567`). Any other first
245// byte, the end (an empty name) included, fails each check at its first read. A name that also holds no backslash has no
246// other offset to look at: it spells nothing (the common case: one switch and one indexOf).
247function maySpell(b: Uint8Array): boolean {
248 switch (at(b, 0)) {
249 case 0x2e: case 0xe2: case 0xef: case 0x67: case 0x47: case 0x6d: case 0x4d: case 0x7e: return true;
250 default: return b.includes(0x5c);
251 }
252}
254// fsck hasDotgit for one tree entry name (bytes): is_hfs_dotgit || is_ntfs_dotgit, and is_ntfs_dotgit after a backslash
255export const isDotGitName = (b: Uint8Array): boolean => maySpell(b) && (isHfsDot(b, GIT) || isNtfsDotGit(b, 0) || afterBackslash(b, true));
256// fsck's `is_hfs_dot<file> || is_ntfs_dot<file>` for file \u2208 gitmodules, gitignore, gitattributes, mailmap; for
257// .gitmodules also after a backslash (fsck_tree checks only that one there)
258export const isDotFileName = (b: Uint8Array, file: DotFile): boolean => {
259 const spelling = DOTFILES[file];
260 return maySpell(b) && (isHfsDot(b, spelling.name) || isNtfsDot(b, 0, spelling) || (file === 'gitmodules' && afterBackslash(b, false)));
261};
263// read-cache.c verify_path for the checkout of one path (`/`-separated tree names) of `mode` (canonical) on `platform`
264// (process.platform), with git's defaults: core.protectNTFS on everywhere, core.protectHFS on macOS. Returns the reason
265// git refuses it, or None. Every name parseTree accepts passes on Linux and macOS (fsck --strict refuses a superset:
266// test/space/fsck-tree.test.js checks it against `git read-tree` with both protections on); this is the check at the
267// point of writing all the same. On Windows a backslash is a separator (verify_path refuses it outright) and
268// compat/mingw.c is_valid_win32_path refuses the characters `: < > " | ? *` and controls, a component ending in a space or
269// a period, and the reserved device names (AUX, CON, NUL, PRN, COM1-9, LPT0-9, CONIN$, CONOUT$, whatever follows them
270// after spaces, a period or a colon). A component with no byte form (a lone surrogate) is a bad_request.
271export function checkoutPathRefusal(path: string, mode: string, platform: string): Result<Option<string>, Bad> {
272 const comps = path.split('/');
273 for (const [k, c] of comps.entries()) {
274 const encoded = encodeBytes(c, 'checkout path');
275 if (!encoded.ok) return encoded;
276 const b = encoded.value;
277 if (c === '' || c === '.' || c === '..') return ok(some('an empty, `.` or `..` component'));
278 if (isDotGitName(b)) return ok(some('a spelling of .git'));
279 // git compares ASCII case-insensitively; /iu would also fold U+017F to s (and U+212A to k)
280 // oxlint-disable-next-line eslint/require-unicode-regexp -- see above
281 if (mode === MODE_LINK && (/^\.gitmodules$/i.test(c) || (platform === 'darwin' && isHfsDot(b, GITMODULES)) || (k === comps.length - 1 && isDotFileName(b, 'gitmodules')))) return ok(some('a symlink at a spelling of .gitmodules'));
282 }
283 if (platform !== 'win32') return ok(none);
284 if (path.includes('\\')) return ok(some('a backslash (a separator on Windows)'));
285 for (const c of comps) {
286 // oxlint-disable-next-line no-control-regex -- is_valid_win32_path refuses control characters; matching them is the point
287 if (/[:<>"|?*\u0001-\u001F]/u.test(c)) return ok(some('a character Windows refuses in a name'));
288 if (/[ .]$/u.test(c)) return ok(some('a name ending in a space or a period'));
289 // oxlint-disable-next-line eslint/require-unicode-regexp -- ASCII case folding, as git's strncasecmp; /iu folds U+017F and U+212A too
290 if (/^(aux|prn|nul|con|com[1-9]|lpt[0-9]|conin\$|conout\$) *([.:]|$)/i.test(c)) return ok(some('a reserved Windows device name'));
291 }
292 return ok(none);
293}
295// The first check of validatePath, and the brand it grants: the value leaves as a Path only after every check
296// below it (path.ts reads the brand; no second test).
297const isPathText = (path: unknown): path is Path => typeof path === 'string' && path.length > 0;
298// A validated path and its components (the path is their `/` join: split and join are inverses).
299export type ValidPath = { readonly path: Path; readonly components: string[] };
301// `limits`: the caller's record (any subset, a key left out is the default; null, the default, is DEFAULT_LIMITS),
302// parsed once (parseLimits) and read for maxPathDepth and maxPathComponent.
303export function validatePath(path: unknown, limits: LimitsInput | null = null): Result<ValidPath, Bad> {
304 if (!isPathText(path)) return bad('path', 'must be a non-empty string');
305 const checked = parseLimits(limits);
306 if (!checked.ok) return checked;
307 const { maxPathDepth: maxDepth, maxPathComponent: maxComponent } = checked.value;
308 const comps = path.split('/');
309 if (comps.length > maxDepth) return bad('path', `depth ${comps.length} exceeds ${maxDepth}`);
310 for (const c of comps) {
311 if (c === '' ) return bad('path', 'empty component (leading, trailing or doubled slash)');
312 // Every component is encoded, so the whole path is too (a `/` cannot complete a surrogate pair).
313 const bytes = encodeBytes(c, 'path');
314 if (!bytes.ok) return bytes;
315 if (c === '.' || c === '..' || isDotGitName(bytes.value)) return bad('path', `component ${JSON.stringify(c)} not allowed (git fsck hasDotgit)`);
316 if (c.includes('\0')) return bad('path', 'NUL in component');
317 if (c.length > maxComponent) return bad('path', 'component too long');
318 }
319 return ok({ path, components: comps });
320}
322export function validateMessage(message: unknown): Result<string, Bad> {
323 if (typeof message !== 'string') return bad('message', 'must be a string');
324 if (message.includes('\0')) return bad('message', 'NUL not allowed');
325 const bytes = encodeBytes(message, 'message');
326 if (!bytes.ok) return bytes;
327 return ok(message);
328}
Diagnostics4 git calls · 365 ms
CallStatusSizeTime0365 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=4 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 · hit3 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=145 git.response.cache=HIT git.response.duration_ms=3 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 · hit4 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=358 git.response.bytes=38434 git.response.cache=HIT git.response.duration_ms=4 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
fetch2007.9 KiB358 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=8110 git.response.cache=MISS git.response.duration_ms=358 git.fetch.wants=6593e442cd670fb8c384bb9969258849fddd90c3 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=8110 git.pkt.payload.max=8089 git.sideband.band1.bytes=8088 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
- a5e2707c38c0d806
- Request
- 4c347d55…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format