GitLabgitlab-org

cli

main
ply8 git calls199 ms101 KiB6 cachedprotocol v2
435 lines16 KiBRaw
1//go:build !integration
3package login
5import (
6 "os"
7 "path/filepath"
8 "testing"
10 "github.com/stretchr/testify/assert"
11 "github.com/stretchr/testify/require"
12 "go.yaml.in/yaml/v3"
15func yarnrcPath(home string) string {
16 return filepath.Join(home, ".yarnrc.yml")
19// yarnrcWithEntry is the whole file loginYarn writes into an empty home: one
20// npmRegistries entry for key carrying token.
21func yarnrcWithEntry(key, token string) string {
22 return "npmRegistries:\n" +
23 " \"" + key + "\":\n" +
24 " npmAlwaysAuth: true\n" +
25 " npmAuthToken: " + token + "\n"
28func TestLoginYarn_CreatesFileWhenAbsent(t *testing.T) {
29 home := t.TempDir()
30 setHome(t, home)
32 _, err := loginYarn(mustURL(t, "https://registry.example.com/"), "tok1")
33 require.NoError(t, err)
35 got, err := os.ReadFile(yarnrcPath(home))
36 require.NoError(t, err)
37 assert.Equal(t, yarnrcWithEntry("//registry.example.com", "tok1"), string(got))
39 fileInfo, err := os.Stat(yarnrcPath(home))
40 require.NoError(t, err)
41 assert.Equal(t, os.FileMode(0o600), fileInfo.Mode().Perm())
44// TestLoginYarn_DropsOneTrailingSlash pins the key's shape with and without a
45// trailing slash: Yarn strips one from every npmRegistries key and from the
46// registry it looks up, so both spellings must land on the same key.
47func TestLoginYarn_DropsOneTrailingSlash(t *testing.T) {
48 for _, registry := range []string{"https://registry.example.com", "https://registry.example.com/"} {
49 t.Run(registry, func(t *testing.T) {
50 home := t.TempDir()
51 setHome(t, home)
53 _, err := loginYarn(mustURL(t, registry), "tok1")
54 require.NoError(t, err)
56 got, err := os.ReadFile(yarnrcPath(home))
57 require.NoError(t, err)
58 assert.Equal(t, yarnrcWithEntry("//registry.example.com", "tok1"), string(got))
59 })
60 }
63func TestLoginYarn_KeepsThePath(t *testing.T) {
64 for _, registry := range []string{
65 "https://registry.example.com/api/v4/projects/1/packages/npm",
66 "https://registry.example.com/api/v4/projects/1/packages/npm/",
67 } {
68 t.Run(registry, func(t *testing.T) {
69 home := t.TempDir()
70 setHome(t, home)
72 _, err := loginYarn(mustURL(t, registry), "tok1")
73 require.NoError(t, err)
75 got, err := os.ReadFile(yarnrcPath(home))
76 require.NoError(t, err)
77 assert.Equal(t, yarnrcWithEntry("//registry.example.com/api/v4/projects/1/packages/npm", "tok1"), string(got))
78 })
79 }
82// TestLoginYarn_KeepsThePortAsTyped pins that, unlike --npm, the default port
83// is not dropped. Yarn compares keys against the npmRegistryServer string
84// without parsing it, so ":443" there only matches ":443" here.
85func TestLoginYarn_KeepsThePortAsTyped(t *testing.T) {
86 home := t.TempDir()
87 setHome(t, home)
89 _, err := loginYarn(mustURL(t, "https://registry.example.com:8443/"), "tok1")
90 require.NoError(t, err)
91 _, err = loginYarn(mustURL(t, "https://registry.example.com:443/"), "tok2")
92 require.NoError(t, err)
94 got, err := os.ReadFile(yarnrcPath(home))
95 require.NoError(t, err)
96 assert.Equal(t, "npmRegistries:\n"+
97 " \"//registry.example.com:8443\":\n"+
98 " npmAlwaysAuth: true\n"+
99 " npmAuthToken: tok1\n"+
100 " \"//registry.example.com:443\":\n"+
101 " npmAlwaysAuth: true\n"+
102 " npmAuthToken: tok2\n", string(got))
105// TestLoginYarn_KeepsTheHostCaseAsTyped pins that, unlike --npm, the host is
106// not lower-cased, for the same reason the port is kept: Yarn never
107// normalizes the registry it looks up beyond one trailing slash.
108func TestLoginYarn_KeepsTheHostCaseAsTyped(t *testing.T) {
109 home := t.TempDir()
110 setHome(t, home)
112 _, err := loginYarn(mustURL(t, "https://AR.Example.com/API/v4/"), "tok1")
113 require.NoError(t, err)
115 got, err := os.ReadFile(yarnrcPath(home))
116 require.NoError(t, err)
117 assert.Equal(t, yarnrcWithEntry("//AR.Example.com/API/v4", "tok1"), string(got))
120func TestLoginYarn_KeepsThePathPercentEncoded(t *testing.T) {
121 home := t.TempDir()
122 setHome(t, home)
124 _, err := loginYarn(mustURL(t, "https://gl.example.com/api/v4/projects/group%2Fproj/packages/npm/"), "tok1")
125 require.NoError(t, err)
127 got, err := os.ReadFile(yarnrcPath(home))
128 require.NoError(t, err)
129 assert.Equal(t, yarnrcWithEntry("//gl.example.com/api/v4/projects/group%2Fproj/packages/npm", "tok1"), string(got))
132func TestLoginYarn_UpdatesExistingEntryInPlace(t *testing.T) {
133 home := t.TempDir()
134 setHome(t, home)
136 _, err := loginYarn(mustURL(t, "https://registry.example.com/"), "tok1")
137 require.NoError(t, err)
138 _, err = loginYarn(mustURL(t, "https://registry.example.com/"), "tok2")
139 require.NoError(t, err)
141 got, err := os.ReadFile(yarnrcPath(home))
142 require.NoError(t, err)
143 assert.Equal(t, yarnrcWithEntry("//registry.example.com", "tok2"), string(got))
146// TestLoginYarn_RefreshesEverySpellingYarnResolves pins that every key Yarn
147// would resolve to the registry is refreshed, and nothing is added next to
148// them. Yarn drops a trailing slash from each key, and tries the
149// scheme-qualified spelling before the "//" one, so a stale token under either
150// would still be the one Yarn sends. An "http://" key is a different registry
151// to a lookup of the https one, and is left alone.
152func TestLoginYarn_RefreshesEverySpellingYarnResolves(t *testing.T) {
153 home := t.TempDir()
154 setHome(t, home)
156 fixture := "npmRegistries:\n" +
157 " \"https://ar.example.com/\":\n" +
158 " npmAuthToken: old1\n" +
159 " \"//ar.example.com/\":\n" +
160 " npmAuthToken: old2\n" +
161 " \"http://ar.example.com\":\n" +
162 " npmAuthToken: other\n"
163 require.NoError(t, os.WriteFile(yarnrcPath(home), []byte(fixture), 0o600))
165 _, err := loginYarn(mustURL(t, "https://ar.example.com"), "tok1")
166 require.NoError(t, err)
168 got, err := os.ReadFile(yarnrcPath(home))
169 require.NoError(t, err)
170 assert.Equal(t, "npmRegistries:\n"+
171 " \"https://ar.example.com/\":\n"+
172 " npmAuthToken: tok1\n"+
173 " npmAlwaysAuth: true\n"+
174 " \"//ar.example.com/\":\n"+
175 " npmAuthToken: tok1\n"+
176 " npmAlwaysAuth: true\n"+
177 " \"http://ar.example.com\":\n"+
178 " npmAuthToken: other\n", string(got))
181// TestLoginYarn_PreservesUnrelatedContent pins that the round trip keeps every
182// key, value and comment it was not asked to change, including the other
183// fields of the entry it refreshes, and documents the formatting it does not
184// keep: blank lines and four-space indentation.
185func TestLoginYarn_PreservesUnrelatedContent(t *testing.T) {
186 home := t.TempDir()
187 setHome(t, home)
189 fixture := "# Managed by hand\n" +
190 "nodeLinker: node-modules\n" +
191 "\n" +
192 "npmRegistries:\n" +
193 " \"//other.example.com\":\n" +
194 " npmAuthToken: keep-me\n" +
195 " \"//ar.example.com\":\n" +
196 " npmAuthIdent: user:pass # legacy\n" +
197 " npmAlwaysAuth: false\n" +
198 " npmAuthToken: old\n" +
199 "\n" +
200 "npmScopes:\n" +
201 " acme:\n" +
202 " npmRegistryServer: \"https://ar.example.com\"\n"
203 require.NoError(t, os.WriteFile(yarnrcPath(home), []byte(fixture), 0o600))
205 _, err := loginYarn(mustURL(t, "https://ar.example.com/"), "tok1")
206 require.NoError(t, err)
208 got, err := os.ReadFile(yarnrcPath(home))
209 require.NoError(t, err)
210 assert.Equal(t, "# Managed by hand\n"+
211 "nodeLinker: node-modules\n"+
212 "npmRegistries:\n"+
213 " \"//other.example.com\":\n"+
214 " npmAuthToken: keep-me\n"+
215 " \"//ar.example.com\":\n"+
216 " npmAuthIdent: user:pass # legacy\n"+
217 " npmAlwaysAuth: true\n"+
218 " npmAuthToken: tok1\n"+
219 "npmScopes:\n"+
220 " acme:\n"+
221 " npmRegistryServer: \"https://ar.example.com\"\n", string(got))
224func TestLoginYarn_DifferentRegistryAddsSeparateEntry_NoPrefixCrossMatch(t *testing.T) {
225 home := t.TempDir()
226 setHome(t, home)
228 _, err := loginYarn(mustURL(t, "https://ar.example.com.evil.com/"), "evil")
229 require.NoError(t, err)
230 _, err = loginYarn(mustURL(t, "https://ar.example.com/"), "tok1")
231 require.NoError(t, err)
233 got, err := os.ReadFile(yarnrcPath(home))
234 require.NoError(t, err)
235 assert.Equal(t, "npmRegistries:\n"+
236 " \"//ar.example.com.evil.com\":\n"+
237 " npmAlwaysAuth: true\n"+
238 " npmAuthToken: evil\n"+
239 " \"//ar.example.com\":\n"+
240 " npmAlwaysAuth: true\n"+
241 " npmAuthToken: tok1\n", string(got))
244// TestLoginYarn_TreatsAnEmptyFileAsAbsent covers the files that hold no
245// settings.
246func TestLoginYarn_TreatsAnEmptyFileAsAbsent(t *testing.T) {
247 for name, fixture := range map[string]string{
248 "empty": "",
249 "blank lines only": "\n\n",
250 "document start": "---\n",
251 "null document": "~\n",
252 } {
253 t.Run(name, func(t *testing.T) {
254 home := t.TempDir()
255 setHome(t, home)
256 require.NoError(t, os.WriteFile(yarnrcPath(home), []byte(fixture), 0o600))
258 _, err := loginYarn(mustURL(t, "https://ar.example.com/"), "tok1")
259 require.NoError(t, err)
261 got, err := os.ReadFile(yarnrcPath(home))
262 require.NoError(t, err)
263 assert.Equal(t, yarnrcWithEntry("//ar.example.com", "tok1"), string(got))
264 })
265 }
268// TestLoginYarn_KeepsACommentOnlyFile pins that a file holding nothing but
269// comments keeps them. go-yaml decodes it to no document, so there is no node
270// to carry them through the round trip.
271func TestLoginYarn_KeepsACommentOnlyFile(t *testing.T) {
272 home := t.TempDir()
273 setHome(t, home)
275 fixture := "# npmRegistryServer: \"https://ar.example.com\"\n# yarnPath: .yarn/releases/yarn.cjs"
276 require.NoError(t, os.WriteFile(yarnrcPath(home), []byte(fixture), 0o600))
278 _, err := loginYarn(mustURL(t, "https://ar.example.com/"), "tok1")
279 require.NoError(t, err)
281 got, err := os.ReadFile(yarnrcPath(home))
282 require.NoError(t, err)
283 assert.Equal(t, fixture+"\n"+yarnrcWithEntry("//ar.example.com", "tok1"), string(got))
286// TestLoginYarn_FillsAnEmptyNpmRegistries pins that an "npmRegistries:" key
287// with no value, which Yarn reads as no entries, gets the entry rather than a
288// refusal or a second npmRegistries key.
289func TestLoginYarn_FillsAnEmptyNpmRegistries(t *testing.T) {
290 home := t.TempDir()
291 setHome(t, home)
292 require.NoError(t, os.WriteFile(yarnrcPath(home), []byte("npmRegistries:\n"), 0o600))
294 _, err := loginYarn(mustURL(t, "https://ar.example.com/"), "tok1")
295 require.NoError(t, err)
297 got, err := os.ReadFile(yarnrcPath(home))
298 require.NoError(t, err)
299 assert.Equal(t, yarnrcWithEntry("//ar.example.com", "tok1"), string(got))
302// TestLoginYarn_FillsAnEmptyFlowNpmRegistries pins that an entry added to
303// "npmRegistries: {}" stays in flow style on one line, which Yarn still reads.
304func TestLoginYarn_FillsAnEmptyFlowNpmRegistries(t *testing.T) {
305 home := t.TempDir()
306 setHome(t, home)
307 require.NoError(t, os.WriteFile(yarnrcPath(home), []byte("npmRegistries: {}\n"), 0o600))
309 _, err := loginYarn(mustURL(t, "https://ar.example.com/"), "tok1")
310 require.NoError(t, err)
312 got, err := os.ReadFile(yarnrcPath(home))
313 require.NoError(t, err)
314 assert.Equal(t, "npmRegistries: {\"//ar.example.com\": {npmAlwaysAuth: true, npmAuthToken: tok1}}\n", string(got))
317// TestYarnScopesWithOwnAuth pins which npmScopes entries make Yarn send their
318// own credential instead of the npmRegistries token for --registry.
319func TestYarnScopesWithOwnAuth(t *testing.T) {
320 for name, tc := range map[string]struct {
321 fixture string
322 want []string
323 }{
324 "no npmScopes": {"nodeLinker: pnp\n", nil},
325 "scope token": {
326 "npmScopes:\n acme:\n npmRegistryServer: \"https://ar.example.com\"\n npmAuthToken: old\n",
327 []string{"acme"},
328 },
329 "scope ident": {
330 "npmScopes:\n acme:\n npmRegistryServer: \"https://ar.example.com\"\n npmAuthIdent: user:pass\n",
331 []string{"acme"},
332 },
333 "server with another scheme and a trailing slash": {
334 "npmScopes:\n acme:\n npmRegistryServer: \"http://ar.example.com/\"\n npmAuthToken: old\n",
335 []string{"acme"},
336 },
337 "server from the top level": {
338 "npmRegistryServer: \"https://ar.example.com\"\nnpmScopes:\n acme:\n npmAuthToken: old\n",
339 []string{"acme"},
340 },
341 "tilde token is a string for Yarn": {
342 "npmScopes:\n acme:\n npmRegistryServer: \"https://ar.example.com\"\n npmAuthToken: ~\n",
343 []string{"acme"},
344 },
345 "empty token": {
346 "npmScopes:\n acme:\n npmRegistryServer: \"https://ar.example.com\"\n npmAuthToken:\n",
347 nil,
348 },
349 "scope without a credential": {
350 "npmScopes:\n acme:\n npmRegistryServer: \"https://ar.example.com\"\n",
351 nil,
352 },
353 "scope on another registry": {
354 "npmScopes:\n acme:\n npmRegistryServer: \"https://ar.example.com.evil.com\"\n npmAuthToken: old\n",
355 nil,
356 },
357 "scope on the default registry": {
358 "npmScopes:\n acme:\n npmAuthToken: old\n",
359 nil,
360 },
361 } {
362 t.Run(name, func(t *testing.T) {
363 var doc yaml.Node
364 require.NoError(t, yaml.Unmarshal([]byte(tc.fixture), &doc))
366 assert.Equal(t, tc.want, yarnScopesWithOwnAuth(doc.Content[0], mustURL(t, "https://ar.example.com/")))
367 })
368 }
371// TestLoginYarn_RefusesAFileItCannotEditSafely pins that each shape this
372// command will not edit is refused with the file left byte-for-byte as it
373// was, rather than written in a way that changes entries it was not asked to
374// touch or that Yarn would not read back.
375func TestLoginYarn_RefusesAFileItCannotEditSafely(t *testing.T) {
376 const (
377 notAMapping = "holding something other than a mapping"
378 anchor = "anchor or alias"
379 )
380 for name, tc := range map[string]struct {
381 fixture string
382 wantErr string
383 }{
384 "invalid YAML": {"npmRegistries: [\n", "parsing YAML"},
385 "two documents": {"nodeLinker: pnp\n---\nnpmRegistries: {}\n", "more than one YAML document"},
386 "top level is a sequence": {"- a\n- b\n", notAMapping},
387 "top level is a string": {"hello\n", notAMapping},
388 "npmRegistries is a string": {"npmRegistries: nope\n", notAMapping},
389 "npmRegistries is a sequence": {"npmRegistries:\n - \"//ar.example.com\"\n", notAMapping},
390 "entry is a string": {"npmRegistries:\n \"//ar.example.com\": nope\n", notAMapping},
391 "entry is a sequence": {"npmRegistries:\n \"//ar.example.com/\":\n - npmAuthToken\n", notAMapping},
392 "duplicate npmRegistries": {"npmRegistries:\n \"//ar.example.com\": {}\nnpmRegistries:\n \"//other.example.com\": {}\n", "found 2 npmRegistries keys"},
393 "anchored top level": {"&root\nnpmRegistries: {}\n", anchor},
394 "anchored npmRegistries": {"npmRegistries: &regs\n \"//other.example.com\": {}\nbackup: *regs\n", anchor},
395 "aliased npmRegistries": {"base: &regs\n \"//other.example.com\": {}\nnpmRegistries: *regs\n", anchor},
396 "alias key in npmRegistries": {"k: &k \"//ar.example.com\"\nnpmRegistries:\n *k : {}\n", anchor},
397 "anchored entry": {"npmRegistries:\n \"//ar.example.com\": &e\n npmAuthToken: old\n \"//other.example.com\": *e\n", anchor},
398 "anchored token": {"npmRegistries:\n \"//ar.example.com\":\n npmAuthToken: &t old\n \"//other.example.com\":\n npmAuthToken: *t\n", anchor},
399 } {
400 t.Run(name, func(t *testing.T) {
401 home := t.TempDir()
402 setHome(t, home)
403 require.NoError(t, os.WriteFile(yarnrcPath(home), []byte(tc.fixture), 0o600))
405 _, err := loginYarn(mustURL(t, "https://ar.example.com/"), "tok1")
406 require.Error(t, err)
407 assert.Contains(t, err.Error(), tc.wantErr)
408 assert.Contains(t, err.Error(), yarnrcPath(home), "the error must name the file it refused")
410 got, readErr := os.ReadFile(yarnrcPath(home))
411 require.NoError(t, readErr)
412 assert.Equal(t, tc.fixture, string(got), "a refused file must be left untouched")
413 })
414 }
417// TestLoginYarn_IgnoresYarnRcFilename pins that the token lands in
418// ~/.yarnrc.yml even when YARN_RC_FILENAME is set. Yarn only uses that name
419// for the project file and its parent directories. The home file is always
420// ~/.yarnrc.yml.
421func TestLoginYarn_IgnoresYarnRcFilename(t *testing.T) {
422 home := t.TempDir()
423 setHome(t, home)
424 t.Setenv("YARN_RC_FILENAME", ".custom-yarnrc.yml")
426 _, err := loginYarn(mustURL(t, "https://ar.example.com/"), "tok1")
427 require.NoError(t, err)
429 got, err := os.ReadFile(yarnrcPath(home))
430 require.NoError(t, err)
431 assert.Equal(t, yarnrcWithEntry("//ar.example.com", "tok1"), string(got))
433 _, err = os.Stat(filepath.Join(home, ".custom-yarnrc.yml"))
434 assert.ErrorIs(t, err, os.ErrNotExist)
Diagnostics8 git calls · 199 ms
CallStatusSizeTime0199 ms
discover200185 B2 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=2
git.response.bytes=185
git.server.agent=git/2.56.g1891de4-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=185
git.pkt.payload.max=35
ls-refs20058 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=59849
git.response.cache=HIT
git.response.duration_ms=2
git.protocol.version=2
git.pkt.frames=731
git.pkt.data=730
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=59849
git.pkt.payload.max=143
git.ls_refs.count=730
git.ls_refs.head=refs/heads/main
fetchcombine:blob:none+tree:2 · deepen 12004.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=3
git.response.bytes=4273
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=combine:blob:none+tree:2
git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9
git.fetch.haves.count=0
git.fetch.deepen=1
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=4273
git.pkt.payload.max=4173
git.sideband.band1.bytes=4173
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=11
git.pack.bytes=4173
git.fetch.wide.objects=11
git.fetch.wide.extra_bytes=3930
git.fetch.wide.blobs=0
fetchtree:0 · deepen 1020032 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=32926
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=tree:0
git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9
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=22
git.pkt.data=20
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=32926
git.pkt.payload.max=32046
git.sideband.band1.bytes=32046
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=80
git.pack.bytes=32046
git.pack.ofs_delta=36
git.pack.ref_delta=0
git.pack.chain.max=2
git.pack.trailer=cb0bad5d7ffc514895d8b21c4dd470327f90bc91
git.pack.full=44
Open pack map
fetchtree:02001.8 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=1857
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=tree:0
git.fetch.wants=dce174ff8c632a19d17eea99c8a9b7c37fb2b592
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=1857
git.pkt.payload.max=1830
git.sideband.band1.bytes=1830
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=1830
git.pack.trailer=fb03183b7909876778f740d196d7516811003517
Open pack map
fetchtree:0200242 B · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
git.response.bytes=242
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=tree:0
git.fetch.wants=5da85e254ab77f5f6e7e1419be57d524a9f8208e
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=242
git.pkt.payload.max=215
git.sideband.band1.bytes=215
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=215
git.pack.trailer=bd426fb1ae09d9fdcf755902c6903cd2eea819b2
Open pack map
fetchtree:0200494 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=494
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=tree:0
git.fetch.wants=400358373377bb8e4922d8b821520ebdf8130c4d
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=494
git.pkt.payload.max=467
git.sideband.band1.bytes=467
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=467
git.pack.trailer=363b27e4d94209a9331c11b44fe1ce6e5f4e6e81
Open pack map
fetch2003.3 KiB188 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=188
git.response.bytes=3401
git.response.cache=MISS
git.response.duration_ms=188
git.fetch.wants=91b9bd87ba98bcd6dd73a3f1a18453745691a577
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=3401
git.pkt.payload.max=3374
git.sideband.band1.bytes=3374
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://gitlab.com/gitlab-org/cli
Ref
refs/heads/main
Commit
0dd7574dce9e385c5c30540e6c15657adc6bdce9
cf-ray
a5e2fbb3fa64cf81
Request
189a115f…
Protocol
v2 · sha1
Agent
git/2.56.g1891de4-Linux
Filter
advertised
Fetch
shallow wait-for-done filter
Capabilities
agent ls-refs fetch server-option object-format