GitLabgitlab-org

cli

main
ply8 git calls68 ms101 KiB7 cachedprotocol v2
515 lines15 KiBRaw
1//go:build !integration
3package download
5import (
6 "context"
7 "net/http"
8 "net/http/httptest"
9 "net/url"
10 "os"
11 "path/filepath"
12 "sync"
13 "testing"
15 "github.com/stretchr/testify/assert"
16 "github.com/stretchr/testify/require"
17 "go.uber.org/mock/gomock"
19 gitlab "gitlab.com/gitlab-org/api/client-go/v3"
20 gitlabtesting "gitlab.com/gitlab-org/api/client-go/v3/testing"
22 "gitlab.com/gitlab-org/cli/internal/commands/release/releaseutils/upload"
23 "gitlab.com/gitlab-org/cli/internal/testing/cmdtest"
26func doesFileExist(fileName string) bool {
27 _, err := os.Stat(fileName)
28 return err == nil
31func TestDownloadCommand_WithTag_NoAssets(t *testing.T) {
32 t.Parallel()
34 testClient := gitlabtesting.NewTestClient(t)
36 testClient.MockReleases.EXPECT().
37 GetRelease("OWNER/REPO", "v1.0.0", gomock.Any()).
38 Return(&gitlab.Release{
39 TagName: "v1.0.0",
40 Name: "Release v1.0.0",
41 Assets: gitlab.ReleaseAssets{
42 Links: []*gitlab.ReleaseLink{},
43 Sources: []gitlab.ReleaseAssetsSource{},
44 },
45 }, nil, nil)
47 exec := cmdtest.SetupCmdForTest(t, NewCmdDownload, false,
48 cmdtest.WithGitLabClient(testClient.Client),
49 cmdtest.WithBaseRepo("OWNER", "REPO", ""),
50 )
52 output, err := exec("v1.0.0")
53 require.NoError(t, err)
55 // No assets to download, so it should succeed with a warning
56 assert.Contains(t, output.String(), "no release assets found")
59func TestDownloadCommand_LatestRelease(t *testing.T) {
60 t.Parallel()
62 testClient := gitlabtesting.NewTestClient(t)
64 testClient.MockReleases.EXPECT().
65 ListReleases("OWNER/REPO", gomock.Any()).
66 Return([]*gitlab.Release{
67 {
68 TagName: "v2.0.0",
69 Name: "Release v2.0.0",
70 Assets: gitlab.ReleaseAssets{
71 Links: []*gitlab.ReleaseLink{},
72 Sources: []gitlab.ReleaseAssetsSource{},
73 },
74 },
75 }, nil, nil)
77 exec := cmdtest.SetupCmdForTest(t, NewCmdDownload, false,
78 cmdtest.WithGitLabClient(testClient.Client),
79 cmdtest.WithBaseRepo("OWNER", "REPO", ""),
80 )
82 output, err := exec("")
83 require.NoError(t, err)
85 // No assets to download, so it should succeed with a warning
86 assert.Contains(t, output.String(), "no release assets found")
89func TestDownloadCommand_NoReleases(t *testing.T) {
90 t.Parallel()
92 testClient := gitlabtesting.NewTestClient(t)
94 testClient.MockReleases.EXPECT().
95 ListReleases("OWNER/REPO", gomock.Any()).
96 Return([]*gitlab.Release{}, nil, nil)
98 exec := cmdtest.SetupCmdForTest(t, NewCmdDownload, false,
99 cmdtest.WithGitLabClient(testClient.Client),
100 cmdtest.WithBaseRepo("OWNER", "REPO", ""),
101 )
103 _, err := exec("")
104 require.Error(t, err)
105 // The WrapError returns the underlying error message ("not found")
106 assert.Contains(t, err.Error(), "not found")
109func TestDownloadCommand_ReleaseNotFound(t *testing.T) {
110 t.Parallel()
112 testClient := gitlabtesting.NewTestClient(t)
114 notFoundResp := &gitlab.Response{
115 Response: &http.Response{StatusCode: http.StatusNotFound},
116 }
117 testClient.MockReleases.EXPECT().
118 GetRelease("OWNER/REPO", "v999.0.0", gomock.Any()).
119 Return(nil, notFoundResp, gitlab.ErrNotFound)
121 exec := cmdtest.SetupCmdForTest(t, NewCmdDownload, false,
122 cmdtest.WithGitLabClient(testClient.Client),
123 cmdtest.WithBaseRepo("OWNER", "REPO", ""),
124 )
126 _, err := exec("v999.0.0")
127 require.Error(t, err)
128 // The WrapError returns the underlying error message
129 assert.Error(t, err)
132func TestDownloadAsset_InvalidURL(t *testing.T) {
133 t.Parallel()
135 client, err := gitlab.NewClient("test-token")
136 require.NoError(t, err)
138 destinationPath := filepath.Join(t.TempDir(), "asset")
139 err = downloadAsset(t.Context(), client, "%", destinationPath, failOnExisting)
141 require.EqualError(t, err, `parsing release asset URL: parse "%": invalid URL escape "%"`)
142 assert.NoFileExists(t, destinationPath)
145// Test_downloadAssets tests the internal downloadAssets function for path sanitization
146// and file download behavior. Uses httptest.NewServer for HTTP mocking since
147// this tests raw HTTP download functionality, not GitLab API calls.
148func Test_downloadAssets(t *testing.T) {
149 // Cannot use t.Parallel() because subtests share the test server
151 // Create a test HTTP server that serves file content
152 testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
153 w.WriteHeader(http.StatusOK)
154 _, _ = w.Write([]byte("test_data"))
155 }))
156 defer testServer.Close()
158 // Create a GitLab client with the test server's URL
159 gitlabClient, err := gitlab.NewClient("test-token", gitlab.WithBaseURL(testServer.URL))
160 require.NoError(t, err)
162 tests := []struct {
163 name string
164 filename string
165 want string
166 wantErr bool
167 }{
168 {
169 name: "A regular filename",
170 filename: "cli-v1.22.0.tar",
171 want: "cli-v1.22.0.tar",
172 },
173 {
174 name: "A filename with directory traversal",
175 filename: "cli-v1.../../22.0.tar",
176 want: "22.0.tar",
177 },
178 {
179 name: "A particularly nasty filename",
180 filename: "..././..././..././etc/password_file",
181 wantErr: true,
182 },
183 }
184 for _, tt := range tests {
185 t.Run(tt.name, func(t *testing.T) {
186 // Do not use t.Parallel() here - test server must stay alive
188 fullURL := testServer.URL + "/" + tt.filename
190 io, _, _, _ := cmdtest.TestIOStreams()
192 release := &upload.ReleaseAsset{
193 Name: &tt.filename,
194 URL: &fullURL,
195 }
197 releases := []*upload.ReleaseAsset{release}
199 tempPath := t.TempDir()
201 filePathWanted := filepath.Join(tempPath, tt.want)
203 err := downloadAssets(t.Context(), gitlabClient, io, releases, tempPath, failOnExisting)
205 if tt.wantErr {
206 assert.Error(t, err, "Should error out if a path doesn't exist")
207 return
208 }
210 require.NoError(t, err, "Should not have errors")
211 assert.True(t, doesFileExist(filePathWanted), "File should exist")
212 })
213 }
216func Test_downloadAsset_SameHost_UsesContextCancellation(t *testing.T) {
217 t.Parallel()
219 testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
220 <-r.Context().Done()
221 }))
222 defer testServer.Close()
224 gitlabClient, err := gitlab.NewClient("test-token", gitlab.WithBaseURL(testServer.URL))
225 require.NoError(t, err)
227 ctx, cancel := context.WithCancel(t.Context())
228 cancel()
230 destPath := filepath.Join(t.TempDir(), "asset.bin")
231 err = downloadAsset(ctx, gitlabClient, testServer.URL+"/asset.bin", destPath, failOnExisting)
232 require.Error(t, err)
233 require.ErrorIs(t, err, context.Canceled)
234 assert.False(t, doesFileExist(destPath), "partial asset file should be removed on failure")
237func Test_downloadAsset_RemovesPartialFileOnErrorStatus(t *testing.T) {
238 t.Parallel()
240 tests := []struct {
241 name string
242 sameHost bool
243 assetPath string
244 }{
245 {
246 name: "other host",
247 assetPath: "/asset.bin",
248 },
249 {
250 name: "markdown upload",
251 sameHost: true,
252 assetPath: "/-/project/42/uploads/8a4f0b1c/file.tar.gz",
253 },
254 }
256 for _, tc := range tests {
257 t.Run(tc.name, func(t *testing.T) {
258 t.Parallel()
260 testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
261 w.WriteHeader(http.StatusInternalServerError)
262 }))
263 defer testServer.Close()
265 baseURL := "https://gitlab.example.com"
266 if tc.sameHost {
267 baseURL = testServer.URL
268 }
269 gitlabClient, err := gitlab.NewClient("test-token", gitlab.WithBaseURL(baseURL), gitlab.WithoutRetries())
270 require.NoError(t, err)
272 destPath := filepath.Join(t.TempDir(), "asset.bin")
273 err = downloadAsset(t.Context(), gitlabClient, testServer.URL+tc.assetPath, destPath, failOnExisting)
275 require.Error(t, err)
276 assert.False(t, doesFileExist(destPath), "partial asset file should be removed on an error status")
277 })
278 }
281func Test_parseMarkdownUploadRef(t *testing.T) {
282 t.Parallel()
284 mustParse := func(t *testing.T, raw string) *url.URL {
285 t.Helper()
286 u, err := url.Parse(raw)
287 require.NoError(t, err)
288 return u
289 }
291 tests := []struct {
292 name string
293 baseURL string
294 assetURL string
295 want markdownUploadRef
296 wantOK bool
297 }{
298 {
299 name: "project ID form, GitLab 17.0 and later",
300 baseURL: "https://gitlab.example.com/api/v4/",
301 assetURL: "https://gitlab.example.com/-/project/42/uploads/8a4f0b1c/file.tar.gz",
302 want: markdownUploadRef{project: "42", secret: "8a4f0b1c", filename: "file.tar.gz"},
303 wantOK: true,
304 },
305 {
306 name: "namespace and project form, before GitLab 17.0",
307 baseURL: "https://gitlab.example.com/api/v4/",
308 assetURL: "https://gitlab.example.com/group/project/uploads/8a4f0b1c/file.tar.gz",
309 want: markdownUploadRef{project: "group/project", secret: "8a4f0b1c", filename: "file.tar.gz"},
310 wantOK: true,
311 },
312 {
313 name: "project in a subgroup",
314 baseURL: "https://gitlab.example.com/api/v4/",
315 assetURL: "https://gitlab.example.com/group/sub/project/uploads/8a4f0b1c/file.tar.gz",
316 want: markdownUploadRef{project: "group/sub/project", secret: "8a4f0b1c", filename: "file.tar.gz"},
317 wantOK: true,
318 },
319 {
320 name: "project in a nested subgroup",
321 baseURL: "https://gitlab.example.com/api/v4/",
322 assetURL: "https://gitlab.example.com/group/sub/subsub/project/uploads/8a4f0b1c/file.tar.gz",
323 want: markdownUploadRef{project: "group/sub/subsub/project", secret: "8a4f0b1c", filename: "file.tar.gz"},
324 wantOK: true,
325 },
326 {
327 name: "namespace and project form on an instance served from a subfolder",
328 baseURL: "https://example.com/gitlab/api/v4/",
329 assetURL: "https://example.com/gitlab/group/project/uploads/8a4f0b1c/file.tar.gz",
330 want: markdownUploadRef{project: "group/project", secret: "8a4f0b1c", filename: "file.tar.gz"},
331 wantOK: true,
332 },
333 {
334 name: "instance served from a subfolder",
335 baseURL: "https://example.com/gitlab/api/v4/",
336 assetURL: "https://example.com/gitlab/-/project/42/uploads/8a4f0b1c/file.tar.gz",
337 want: markdownUploadRef{project: "42", secret: "8a4f0b1c", filename: "file.tar.gz"},
338 wantOK: true,
339 },
340 {
341 name: "escaped characters in the file name",
342 baseURL: "https://gitlab.example.com/api/v4/",
343 assetURL: "https://gitlab.example.com/-/project/42/uploads/8a4f0b1c/my%20file.tar.gz",
344 want: markdownUploadRef{project: "42", secret: "8a4f0b1c", filename: "my file.tar.gz"},
345 wantOK: true,
346 },
347 {
348 // A package registry asset is already served by the API, so it must
349 // keep its existing download path.
350 name: "package registry link",
351 baseURL: "https://gitlab.example.com/api/v4/",
352 assetURL: "https://gitlab.example.com/api/v4/projects/42/packages/generic/pkg/1.0/file.tar.gz",
353 wantOK: false,
354 },
355 {
356 name: "release evidence link",
357 baseURL: "https://gitlab.example.com/api/v4/",
358 assetURL: "https://gitlab.example.com/group/project/-/releases/v1/evidences/1.json",
359 wantOK: false,
360 },
361 {
362 name: "raw repository file under an uploads directory",
363 baseURL: "https://gitlab.example.com/api/v4/",
364 assetURL: "https://gitlab.example.com/group/project/-/raw/main/uploads/images/logo.png",
365 wantOK: false,
366 },
367 {
368 name: "blob repository file under an uploads directory",
369 baseURL: "https://gitlab.example.com/api/v4/",
370 assetURL: "https://gitlab.example.com/group/project/-/blob/main/uploads/images/logo.png",
371 wantOK: false,
372 },
373 {
374 name: "raw repository file in a subgroup project",
375 baseURL: "https://gitlab.example.com/api/v4/",
376 assetURL: "https://gitlab.example.com/group/sub/project/-/raw/v1.0/docs/uploads/8a4f0b1c/file.tar.gz",
377 wantOK: false,
378 },
379 {
380 name: "job artifact under an uploads directory",
381 baseURL: "https://gitlab.example.com/api/v4/",
382 assetURL: "https://gitlab.example.com/group/project/-/jobs/7/artifacts/raw/uploads/8a4f0b1c/file.tar.gz",
383 wantOK: false,
384 },
385 {
386 name: "a path too short to name a project",
387 baseURL: "https://gitlab.example.com/api/v4/",
388 assetURL: "https://gitlab.example.com/uploads/8a4f0b1c/file.tar.gz",
389 wantOK: false,
390 },
391 {
392 name: "no file name after the secret",
393 baseURL: "https://gitlab.example.com/api/v4/",
394 assetURL: "https://gitlab.example.com/group/project/uploads/8a4f0b1c/",
395 wantOK: false,
396 },
397 }
399 for _, tt := range tests {
400 t.Run(tt.name, func(t *testing.T) {
401 t.Parallel()
403 got, ok := parseMarkdownUploadRef(mustParse(t, tt.baseURL), mustParse(t, tt.assetURL))
405 assert.Equal(t, tt.wantOK, ok)
406 if tt.wantOK {
407 assert.Equal(t, tt.want, got)
408 }
409 })
410 }
413// A Markdown upload link is a web route that only a browser session
414// authenticates, so reading it with a token fails. The asset must come from
415// the uploads API instead. See issue #1301.
416func Test_downloadAsset_MarkdownUpload_UsesUploadsAPI(t *testing.T) {
417 t.Parallel()
419 const (
420 secret = "8a4f0b1c"
421 apiPath = "/api/v4/projects/42/uploads/" + secret + "/file.tar.gz"
422 webPath = "/-/project/42/uploads/" + secret + "/file.tar.gz"
423 expected = "asset_payload"
424 )
426 var mu sync.Mutex
427 var requested []string
429 testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
430 mu.Lock()
431 requested = append(requested, r.URL.Path)
432 mu.Unlock()
434 if r.URL.Path == apiPath {
435 if r.Header.Get("Private-Token") == "" {
436 w.WriteHeader(http.StatusUnauthorized)
437 return
438 }
439 _, _ = w.Write([]byte(expected))
440 return
441 }
443 // The web route redirects a token request to the sign-in page, which
444 // answers 404 for a private project.
445 w.WriteHeader(http.StatusNotFound)
446 }))
447 defer testServer.Close()
449 gitlabClient, err := gitlab.NewClient("test-token", gitlab.WithBaseURL(testServer.URL))
450 require.NoError(t, err)
452 destPath := filepath.Join(t.TempDir(), "file.tar.gz")
453 err = downloadAsset(t.Context(), gitlabClient, testServer.URL+webPath, destPath, failOnExisting)
454 require.NoError(t, err)
456 content, err := os.ReadFile(destPath)
457 require.NoError(t, err)
458 assert.Equal(t, expected, string(content))
460 mu.Lock()
461 defer mu.Unlock()
462 assert.Contains(t, requested, apiPath, "the asset should come from the uploads API")
463 assert.NotContains(t, requested, webPath, "the web route should not be requested")
466// Links that are not Markdown uploads keep their existing download path.
467func Test_downloadAsset_SameHost_NonUploadLinkIsUnchanged(t *testing.T) {
468 t.Parallel()
470 tests := []struct {
471 name string
472 assetPath string
473 }{
474 {
475 name: "package registry link",
476 assetPath: "/api/v4/projects/42/packages/generic/pkg/1.0/file.tar.gz",
477 },
478 {
479 name: "raw repository file under an uploads directory",
480 assetPath: "/group/project/-/raw/main/uploads/images/logo.png",
481 },
482 }
484 for _, tt := range tests {
485 t.Run(tt.name, func(t *testing.T) {
486 t.Parallel()
488 var mu sync.Mutex
489 var requested []string
491 testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
492 mu.Lock()
493 requested = append(requested, r.URL.Path)
494 mu.Unlock()
495 _, _ = w.Write([]byte("asset_payload"))
496 }))
497 defer testServer.Close()
499 gitlabClient, err := gitlab.NewClient("test-token", gitlab.WithBaseURL(testServer.URL))
500 require.NoError(t, err)
502 destPath := filepath.Join(t.TempDir(), "asset")
503 err = downloadAsset(t.Context(), gitlabClient, testServer.URL+tt.assetPath, destPath, failOnExisting)
504 require.NoError(t, err)
506 content, err := os.ReadFile(destPath)
507 require.NoError(t, err)
508 assert.Equal(t, "asset_payload", string(content))
510 mu.Lock()
511 defer mu.Unlock()
512 assert.Equal(t, []string{tt.assetPath}, requested)
513 })
514 }
Diagnostics8 git calls · 68 ms
CallStatusSizeTime068 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 · 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=59849
git.response.cache=HIT
git.response.duration_ms=3
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
fetchtree:0 · deepen 1020032 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=32926
git.response.cache=HIT
git.response.duration_ms=2
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
fetchcombine:blob:none+tree:2 · deepen 12004.2 KiB · hit5 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=5
git.response.bytes=4273
git.response.cache=HIT
git.response.duration_ms=5
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:02001.8 KiB · 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=1857
git.response.cache=HIT
git.response.duration_ms=3
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:0200350 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=350
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=tree:0
git.fetch.wants=b2a837e646ba305993f35203fafafb109e57a7ca
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=350
git.pkt.payload.max=323
git.sideband.band1.bytes=323
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=323
git.pack.trailer=1232131042f2ba4c9c4dbd99382667a1f0849e15
Open pack map
fetchtree:0200178 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=178
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=tree:0
git.fetch.wants=17d7a4e972314f40abefc6eac0a09f9eb4ccf7cc
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=178
git.pkt.payload.max=151
git.sideband.band1.bytes=151
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=151
git.pack.trailer=a4a10e7178122a1f1b1ad28fec85c87cc0de9191
Open pack map
fetch2003.4 KiB · hit52 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=52
git.response.bytes=3502
git.response.cache=HIT
git.response.duration_ms=52
git.fetch.wants=6361470e6d7701be26006965b521cb01fbb7ac20
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=3502
git.pkt.payload.max=3475
git.sideband.band1.bytes=3475
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
a5e342566a8d6e2a
Request
43428dbb…
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