Artifactspublic-v0

ply

main
ply4 git calls412 ms39 KiB2 cachedprotocol v2
42 lines2.5 KiBRaw
1// editFile creating a branch from a base ref that is a tag of a tag (refs/tags/vv -> tag v1 -> commit).
2// Oracle: git itself. `git branch oracle refs/tags/vv` in the bare repo starts the branch at the commit git peels the
3// tag chain to; editFile's new commit must have exactly that commit as its parent.
4import { test, beforeAll as before, afterAll as after } from 'vitest';
5import assert from 'node:assert/strict';
6import { join } from 'node:path';
7import { writeFileSync } from 'node:fs';
8import { git, tmpRoot, makeBareRepo, startGitServer, initRepo } from './server.js';
9import { editFile } from '../src/edit.js';
10import { Tracer } from '../src/otel.js';
12let root, cleanup, srv, bare;
13before(async () => {
14 ({ root, cleanup } = tmpRoot());
15 srv = await startGitServer(root);
16 const seed = join(root, 'seed');
17 initRepo(seed);
18 for (const [k, v] of [['user.name', 's'], ['user.email', 's@x'], ['commit.gpgsign', 'false']]) git(seed, ['config', k, v]);
19 writeFileSync(join(seed, 'plain.txt'), 'plain\n');
20 git(seed, ['add', '-A']); git(seed, ['commit', '-q', '-m', 'seed']);
21 git(seed, ['tag', '-a', '-m', 'v1', 'v1', 'main']);
22 git(seed, ['tag', '-a', '-m', 'vv', 'vv', 'v1']);
23 bare = makeBareRepo(root, 'tagtag'); git(seed, ['push', '-q', bare, 'main', 'v1', 'vv']);
24});
25after(async () => { await srv.close(); cleanup(); });
27test('a base that is a tag of a tag is the commit git starts a branch at', async () => {
28 // the fixture is what it claims: vv is a tag object whose target is another tag object
29 assert.equal(git(bare, ['cat-file', '-t', 'refs/tags/vv']).trim(), 'tag');
30 assert.match(git(bare, ['cat-file', '-p', 'refs/tags/vv']), /^object [0-9a-f]{40}\ntype tag\n/u);
31 git(bare, ['branch', 'oracle', 'refs/tags/vv']);
32 const start = git(bare, ['rev-parse', 'refs/heads/oracle']).trim();
33 assert.equal(git(bare, ['cat-file', '-t', start]).trim(), 'commit');
35 const r = await editFile(`${srv.url}/tagtag.git`, { ref: 'refs/heads/feature', base: 'refs/tags/vv', path: 'plain.txt', find: 'plain', replace: 'edited', author: { name: 'Ada', email: 'ada@x' }, message: 'm' }, { tracer: new Tracer() });
36 assert.equal(r.ok ? 'ok' : `${r.error.code}: ${r.error.message}`, 'ok');
37 assert.equal(r.value.oldCommit, start);
38 const tip = git(bare, ['rev-parse', 'refs/heads/feature']).trim();
39 assert.equal(tip, r.value.newCommit);
40 assert.equal(git(bare, ['rev-parse', `${tip}^`]).trim(), start);
41 assert.equal(git(bare, ['cat-file', '-p', `${tip}:plain.txt`]), 'edited\n');
42});
Diagnostics4 git calls · 412 ms
CallStatusSizeTime0412 ms
discover200152 B3 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
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 · 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 · hit3 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=38434
git.response.cache=HIT
git.response.duration_ms=3
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=55
Open pack map
fetch2001.0 KiB406 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=406
git.response.bytes=1073
git.response.cache=MISS
git.response.duration_ms=406
git.fetch.wants=b7dccbcacf1a77a7799b90ab8c3b644774bcaf6b
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=1073
git.pkt.payload.max=1052
git.sideband.band1.bytes=1051
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
a5e3a61e8a36a53e
Request
ad851d9e…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format