GitLabgitlab-org
cli
main
1//go:build !integration
3package view
5import (
6 "net/http"
7 "os/exec"
8 "testing"
10 "github.com/MakeNowJust/heredoc/v2"
11 "github.com/stretchr/testify/assert"
12 "github.com/stretchr/testify/require"
13 "go.uber.org/mock/gomock"
15 gitlab "gitlab.com/gitlab-org/api/client-go/v3"
16 gitlabtesting "gitlab.com/gitlab-org/api/client-go/v3/testing"
18 "gitlab.com/gitlab-org/cli/internal/api"
19 "gitlab.com/gitlab-org/cli/internal/glinstance"
20 "gitlab.com/gitlab-org/cli/internal/run"
21 "gitlab.com/gitlab-org/cli/internal/testing/cmdtest"
22 "gitlab.com/gitlab-org/cli/test"
23)
25func TestGetReadmeFileRejectsMalformedURL(t *testing.T) {
26 t.Parallel()
28 project := &gitlab.Project{
29 WebURL: "https://gitlab.com/OWNER/REPO",
30 ReadmeURL: "https://gitlab.com/OWNER/REPO/README.md",
31 }
33 _, err := getReadmeFile(&options{}, project)
35 require.EqualError(t, err, `invalid README URL: "https://gitlab.com/OWNER/REPO/README.md"`)
36}
38func TestProjectView(t *testing.T) {
39 tests := []struct {
40 name string
41 cli string
42 isTTY bool
43 stub bool
44 repoHost string
46 // For mocking
47 setupMocks func(t *testing.T, testClient *gitlabtesting.TestClient)
49 expectedOutput string
50 }{
51 {
52 name: "view the project details for the current project",
53 cli: "",
54 setupMocks: func(t *testing.T, testClient *gitlabtesting.TestClient) {
55 t.Helper()
56 testClient.MockProjects.EXPECT().
57 GetProject("OWNER/REPO", gomock.Any()).
58 Return(&gitlab.Project{
59 ID: 37777023,
60 Description: "this is a test description",
61 Name: "REPO",
62 NameWithNamespace: "Test User / REPO",
63 Path: "REPO",
64 PathWithNamespace: "OWNER/REPO",
65 DefaultBranch: "main",
66 WebURL: "https://gitlab.com/OWNER/REPO",
67 ReadmeURL: "https://gitlab.com/OWNER/REPO/-/blob/main/README.md",
68 }, nil, nil)
69 testClient.MockRepositoryFiles.EXPECT().
70 GetFile("OWNER/REPO", "README.md", gomock.Any()).
71 Return(&gitlab.File{
72 FileName: "README.md",
73 FilePath: "README.md",
74 Encoding: "base64",
75 Ref: "main",
76 Content: "dGVzdCByZWFkbWUK",
77 }, nil, nil)
78 },
79 expectedOutput: heredoc.Doc(`name: Test User / REPO
80description: this is a test description
81---
82test readme
84`),
85 },
86 {
87 name: "view a project with a README in a subdirectory",
88 cli: "",
89 setupMocks: func(t *testing.T, testClient *gitlabtesting.TestClient) {
90 t.Helper()
91 testClient.MockProjects.EXPECT().
92 GetProject("OWNER/REPO", gomock.Any()).
93 Return(&gitlab.Project{
94 NameWithNamespace: "Test User / REPO",
95 Description: "nested readme",
96 PathWithNamespace: "OWNER/REPO",
97 DefaultBranch: "main",
98 WebURL: "https://gitlab.com/OWNER/REPO",
99 ReadmeURL: "https://gitlab.com/OWNER/REPO/-/blob/main/docs/README.md",
100 }, nil, nil)
101 testClient.MockRepositoryFiles.EXPECT().
102 GetFile("OWNER/REPO", "docs/README.md", gomock.Any()).
103 Return(&gitlab.File{Content: "dGVzdCByZWFkbWUK"}, nil, nil)
104 },
105 expectedOutput: heredoc.Doc(`name: Test User / REPO
106description: nested readme
107---
108test readme
110`),
111 },
112 {
113 name: "view another project whose default branch contains a slash",
114 cli: "OWNER/REPO",
115 setupMocks: func(t *testing.T, testClient *gitlabtesting.TestClient) {
116 t.Helper()
117 testClient.MockProjects.EXPECT().
118 GetProject("OWNER/REPO", gomock.Any()).
119 Return(&gitlab.Project{
120 NameWithNamespace: "Test User / REPO",
121 Description: "slash branch",
122 PathWithNamespace: "OWNER/REPO",
123 DefaultBranch: "release/main",
124 WebURL: "https://gitlab.com/OWNER/REPO",
125 ReadmeURL: "https://gitlab.com/OWNER/REPO/-/blob/release/main/docs/README.md",
126 }, nil, nil)
127 testClient.MockRepositoryFiles.EXPECT().
128 GetFile("OWNER/REPO", "docs/README.md", &gitlab.GetFileOptions{Ref: new("release/main")}).
129 Return(&gitlab.File{Content: "dGVzdCByZWFkbWUK"}, nil, nil)
130 },
131 expectedOutput: heredoc.Doc(`name: Test User / REPO
132description: slash branch
133---
134test readme
136`),
137 },
138 {
139 name: "view the current project whose default branch contains a slash",
140 cli: "",
141 setupMocks: func(t *testing.T, testClient *gitlabtesting.TestClient) {
142 t.Helper()
143 testClient.MockProjects.EXPECT().
144 GetProject("OWNER/REPO", gomock.Any()).
145 Return(&gitlab.Project{
146 NameWithNamespace: "Test User / REPO",
147 Description: "slash branch",
148 PathWithNamespace: "OWNER/REPO",
149 DefaultBranch: "release/main",
150 WebURL: "https://gitlab.com/OWNER/REPO",
151 ReadmeURL: "https://gitlab.com/OWNER/REPO/-/blob/release/main/README.md",
152 }, nil, nil)
153 testClient.MockRepositoryFiles.EXPECT().
154 GetFile("OWNER/REPO", "README.md", &gitlab.GetFileOptions{Ref: new("#current-branch")}).
155 Return(&gitlab.File{Content: "dGVzdCByZWFkbWUK"}, nil, nil)
156 },
157 expectedOutput: heredoc.Doc(`name: Test User / REPO
158description: slash branch
159---
160test readme
162`),
163 },
164 {
165 name: "view a branch of another project whose default branch contains a slash",
166 cli: "OWNER/REPO --branch release/next",
167 setupMocks: func(t *testing.T, testClient *gitlabtesting.TestClient) {
168 t.Helper()
169 testClient.MockProjects.EXPECT().
170 GetProject("OWNER/REPO", gomock.Any()).
171 Return(&gitlab.Project{
172 NameWithNamespace: "Test User / REPO",
173 Description: "slash branch",
174 PathWithNamespace: "OWNER/REPO",
175 DefaultBranch: "release/main",
176 WebURL: "https://gitlab.com/OWNER/REPO",
177 ReadmeURL: "https://gitlab.com/OWNER/REPO/-/blob/release/main/README.md",
178 }, nil, nil)
179 testClient.MockRepositoryFiles.EXPECT().
180 GetFile("OWNER/REPO", "README.md", &gitlab.GetFileOptions{Ref: new("release/next")}).
181 Return(&gitlab.File{Content: "dGVzdCByZWFkbWUK"}, nil, nil)
182 },
183 expectedOutput: heredoc.Doc(`name: Test User / REPO
184description: slash branch
185---
186test readme
188`),
189 },
190 {
191 name: "view another project whose README URL does not start with the default branch",
192 cli: "OWNER/REPO",
193 setupMocks: func(t *testing.T, testClient *gitlabtesting.TestClient) {
194 t.Helper()
195 testClient.MockProjects.EXPECT().
196 GetProject("OWNER/REPO", gomock.Any()).
197 Return(&gitlab.Project{
198 NameWithNamespace: "Test User / REPO",
199 Description: "other ref",
200 PathWithNamespace: "OWNER/REPO",
201 DefaultBranch: "main",
202 WebURL: "https://gitlab.com/OWNER/REPO",
203 ReadmeURL: "https://gitlab.com/OWNER/REPO/-/blob/stable/docs/README.md",
204 }, nil, nil)
205 testClient.MockRepositoryFiles.EXPECT().
206 GetFile("OWNER/REPO", "docs/README.md", &gitlab.GetFileOptions{Ref: new("stable")}).
207 Return(&gitlab.File{Content: "dGVzdCByZWFkbWUK"}, nil, nil)
208 },
209 expectedOutput: heredoc.Doc(`name: Test User / REPO
210description: other ref
211---
212test readme
214`),
215 },
216 {
217 name: "view the details of a project owned by the current user",
218 cli: "foo",
219 setupMocks: func(t *testing.T, testClient *gitlabtesting.TestClient) {
220 t.Helper()
221 testClient.MockUsers.EXPECT().
222 CurrentUser(gomock.Any()).
223 Return(&gitlab.User{Username: "test_user"}, nil, nil)
224 testClient.MockProjects.EXPECT().
225 GetProject("test_user/foo", gomock.Any()).
226 Return(&gitlab.Project{
227 ID: 37777023,
228 Description: "this is a test description",
229 Name: "foo",
230 NameWithNamespace: "test_user / foo",
231 Path: "foo",
232 PathWithNamespace: "test_user/foo",
233 DefaultBranch: "main",
234 WebURL: "https://gitlab.com/test_user/foo",
235 ReadmeURL: "https://gitlab.com/test_user/foo/-/blob/main/README.md",
236 }, nil, nil)
237 testClient.MockRepositoryFiles.EXPECT().
238 GetFile("test_user/foo", "README.md", gomock.Any()).
239 Return(&gitlab.File{
240 FileName: "README.md",
241 FilePath: "README.md",
242 Encoding: "base64",
243 Ref: "main",
244 Content: "dGVzdCByZWFkbWUK",
245 }, nil, nil)
246 },
247 expectedOutput: heredoc.Doc(`name: test_user / foo
248description: this is a test description
249---
250test readme
252`),
253 },
254 {
255 name: "view a specific project's details",
256 cli: "foo/bar",
257 setupMocks: func(t *testing.T, testClient *gitlabtesting.TestClient) {
258 t.Helper()
259 testClient.MockProjects.EXPECT().
260 GetProject("foo/bar", gomock.Any()).
261 Return(&gitlab.Project{
262 ID: 37777023,
263 Description: "this is a test description",
264 Name: "bar",
265 NameWithNamespace: "foo / bar",
266 Path: "bar",
267 PathWithNamespace: "foo/bar",
268 DefaultBranch: "main",
269 WebURL: "https://gitlab.com/foo/bar",
270 ReadmeURL: "https://gitlab.com/foo/bar/-/blob/main/README.md",
271 }, nil, nil)
272 testClient.MockRepositoryFiles.EXPECT().
273 GetFile("foo/bar", "README.md", gomock.Any()).
274 Return(&gitlab.File{
275 FileName: "README.md",
276 FilePath: "README.md",
277 Encoding: "base64",
278 Ref: "main",
279 Content: "dGVzdCByZWFkbWUK",
280 }, nil, nil)
281 },
282 expectedOutput: heredoc.Doc(`name: foo / bar
283description: this is a test description
284---
285test readme
287`),
288 },
289 {
290 name: "view a group's specific project details",
291 cli: "group/foo/bar",
292 setupMocks: func(t *testing.T, testClient *gitlabtesting.TestClient) {
293 t.Helper()
294 testClient.MockProjects.EXPECT().
295 GetProject("group/foo/bar", gomock.Any()).
296 Return(&gitlab.Project{
297 ID: 37777023,
298 Description: "this is a test description",
299 Name: "bar",
300 NameWithNamespace: "group / foo / bar",
301 Path: "bar",
302 PathWithNamespace: "group/foo/bar",
303 DefaultBranch: "main",
304 WebURL: "https://gitlab.com/group/foo/bar",
305 ReadmeURL: "https://gitlab.com/group/foo/bar/-/blob/main/README.md",
306 }, nil, nil)
307 testClient.MockRepositoryFiles.EXPECT().
308 GetFile("group/foo/bar", "README.md", gomock.Any()).
309 Return(&gitlab.File{
310 FileName: "README.md",
311 FilePath: "README.md",
312 Encoding: "base64",
313 Ref: "main",
314 Content: "dGVzdCByZWFkbWUK",
315 }, nil, nil)
316 },
317 expectedOutput: heredoc.Doc(`name: group / foo / bar
318description: this is a test description
319---
320test readme
322`),
323 },
324 {
325 name: "view a project details from a project not hosted on the default host",
326 cli: "",
327 repoHost: "gitlab.company.org",
328 setupMocks: func(t *testing.T, testClient *gitlabtesting.TestClient) {
329 t.Helper()
330 testClient.MockProjects.EXPECT().
331 GetProject("OWNER/REPO", gomock.Any()).
332 Return(&gitlab.Project{
333 ID: 37777023,
334 Description: "this is a test description",
335 Name: "bar",
336 NameWithNamespace: "OWNER / REPO",
337 Path: "bar",
338 PathWithNamespace: "OWNER/REPO",
339 DefaultBranch: "main",
340 WebURL: "https://gitlab.company.org/OWNER/REPO",
341 ReadmeURL: "https://gitlab.company.org/OWNER/REPO/-/blob/main/README.md",
342 }, nil, nil)
343 testClient.MockRepositoryFiles.EXPECT().
344 GetFile("OWNER/REPO", "README.md", gomock.Any()).
345 Return(&gitlab.File{
346 FileName: "README.md",
347 FilePath: "README.md",
348 Encoding: "base64",
349 Ref: "main",
350 Content: "dGVzdCByZWFkbWUK",
351 }, nil, nil)
352 },
353 expectedOutput: heredoc.Doc(`name: OWNER / REPO
354description: this is a test description
355---
356test readme
358`),
359 },
360 {
361 name: "view project details from a git URL",
362 cli: "https://gitlab.company.org/OWNER/REPO.git",
363 setupMocks: func(t *testing.T, testClient *gitlabtesting.TestClient) {
364 t.Helper()
365 testClient.MockProjects.EXPECT().
366 GetProject("OWNER/REPO", gomock.Any()).
367 Return(&gitlab.Project{
368 ID: 37777023,
369 Description: "this is a test description",
370 Name: "bar",
371 NameWithNamespace: "OWNER / REPO",
372 Path: "bar",
373 PathWithNamespace: "OWNER/REPO",
374 DefaultBranch: "main",
375 WebURL: "https://gitlab.company.org/OWNER/REPO",
376 ReadmeURL: "https://gitlab.company.org/OWNER/REPO/-/blob/main/README.md",
377 }, nil, nil)
378 testClient.MockRepositoryFiles.EXPECT().
379 GetFile("OWNER/REPO", "README.md", gomock.Any()).
380 Return(&gitlab.File{
381 FileName: "README.md",
382 FilePath: "README.md",
383 Encoding: "base64",
384 Ref: "main",
385 Content: "dGVzdCByZWFkbWUK",
386 }, nil, nil)
387 },
388 expectedOutput: heredoc.Doc(`name: OWNER / REPO
389description: this is a test description
390---
391test readme
393`),
394 },
395 {
396 name: "view project on web where current branch is different to default branch",
397 cli: "--web",
398 isTTY: true,
399 stub: true,
400 setupMocks: func(t *testing.T, testClient *gitlabtesting.TestClient) {
401 t.Helper()
402 testClient.MockProjects.EXPECT().
403 GetProject("OWNER/REPO", gomock.Any()).
404 Return(&gitlab.Project{
405 ID: 37777023,
406 Description: "this is a test description",
407 Name: "REPO",
408 NameWithNamespace: "Test User / REPO",
409 Path: "REPO",
410 PathWithNamespace: "OWNER/REPO",
411 DefaultBranch: "main",
412 WebURL: "https://gitlab.com/OWNER/REPO",
413 ReadmeURL: "https://gitlab.com/OWNER/REPO/-/blob/main/README.md",
414 }, nil, nil)
415 },
416 expectedOutput: "Opening gitlab.com/OWNER/REPO/-/tree/%23current-branch in your browser.\n",
417 },
418 {
419 name: "view project default branch on web",
420 cli: "--web",
421 isTTY: true,
422 stub: true,
423 setupMocks: func(t *testing.T, testClient *gitlabtesting.TestClient) {
424 t.Helper()
425 testClient.MockProjects.EXPECT().
426 GetProject("OWNER/REPO", gomock.Any()).
427 Return(&gitlab.Project{
428 ID: 37777023,
429 Description: "this is a test description",
430 Name: "REPO",
431 NameWithNamespace: "Test User / REPO",
432 Path: "REPO",
433 PathWithNamespace: "OWNER/REPO",
434 DefaultBranch: "#current-branch",
435 WebURL: "https://gitlab.com/OWNER/REPO",
436 ReadmeURL: "https://gitlab.com/OWNER/REPO/-/blob/main/README.md",
437 }, nil, nil)
438 },
439 expectedOutput: "Opening gitlab.com/OWNER/REPO in your browser.\n",
440 },
441 {
442 name: "view project when passing a https git URL on web",
443 cli: "https://gitlab.company.org/OWNER/REPO.git --web",
444 isTTY: true,
445 stub: true,
446 setupMocks: func(t *testing.T, testClient *gitlabtesting.TestClient) {
447 t.Helper()
448 testClient.MockProjects.EXPECT().
449 GetProject("OWNER/REPO", gomock.Any()).
450 Return(&gitlab.Project{
451 ID: 37777023,
452 Description: "this is a test description",
453 Name: "REPO",
454 NameWithNamespace: "Test User / REPO",
455 Path: "REPO",
456 PathWithNamespace: "OWNER/REPO",
457 DefaultBranch: "#current-branch",
458 WebURL: "https://gitlab.company.org/OWNER/REPO",
459 ReadmeURL: "https://gitlab.company.org/OWNER/REPO/-/blob/main/README.md",
460 }, nil, nil)
461 },
462 expectedOutput: "Opening gitlab.company.org/OWNER/REPO in your browser.\n",
463 },
464 {
465 name: "view project when passing a https git URL on web with branch",
466 cli: "https://gitlab.company.org/OWNER/REPO.git --web --branch foobranch",
467 isTTY: true,
468 stub: true,
469 setupMocks: func(t *testing.T, testClient *gitlabtesting.TestClient) {
470 t.Helper()
471 testClient.MockProjects.EXPECT().
472 GetProject("OWNER/REPO", gomock.Any()).
473 Return(&gitlab.Project{
474 ID: 37777023,
475 Description: "this is a test description",
476 Name: "REPO",
477 NameWithNamespace: "Test User / REPO",
478 Path: "REPO",
479 PathWithNamespace: "OWNER/REPO",
480 DefaultBranch: "#current-branch",
481 WebURL: "https://gitlab.company.org/OWNER/REPO",
482 ReadmeURL: "https://gitlab.company.org/OWNER/REPO/-/blob/main/README.md",
483 }, nil, nil)
484 },
485 expectedOutput: "Opening gitlab.company.org/OWNER/REPO/-/tree/foobranch in your browser.\n",
486 },
487 {
488 name: "view project when passing a https URL on web",
489 cli: "https://gitlab.company.org/OWNER/REPO --web",
490 isTTY: true,
491 stub: true,
492 setupMocks: func(t *testing.T, testClient *gitlabtesting.TestClient) {
493 t.Helper()
494 testClient.MockProjects.EXPECT().
495 GetProject("OWNER/REPO", gomock.Any()).
496 Return(&gitlab.Project{
497 ID: 37777023,
498 Description: "this is a test description",
499 Name: "REPO",
500 NameWithNamespace: "Test User / REPO",
501 Path: "REPO",
502 PathWithNamespace: "OWNER/REPO",
503 DefaultBranch: "#current-branch",
504 WebURL: "https://gitlab.company.org/OWNER/REPO",
505 ReadmeURL: "https://gitlab.company.org/OWNER/REPO/-/blob/main/README.md",
506 }, nil, nil)
507 },
508 expectedOutput: "Opening gitlab.company.org/OWNER/REPO in your browser.\n",
509 },
510 {
511 name: "view project when passing a git URL on web",
512 cli: "git@gitlab.company.org:OWNER/REPO.git --web",
513 isTTY: true,
514 stub: true,
515 setupMocks: func(t *testing.T, testClient *gitlabtesting.TestClient) {
516 t.Helper()
517 testClient.MockProjects.EXPECT().
518 GetProject("OWNER/REPO", gomock.Any()).
519 Return(&gitlab.Project{
520 ID: 37777023,
521 Description: "this is a test description",
522 Name: "REPO",
523 NameWithNamespace: "Test User / REPO",
524 Path: "REPO",
525 PathWithNamespace: "OWNER/REPO",
526 DefaultBranch: "#current-branch",
527 WebURL: "https://gitlab.company.org/OWNER/REPO",
528 ReadmeURL: "https://gitlab.company.org/OWNER/REPO/-/blob/main/README.md",
529 }, nil, nil)
530 },
531 expectedOutput: "Opening gitlab.company.org/OWNER/REPO in your browser.\n",
532 },
533 {
534 name: "view a project that isn't on the default host on web",
535 cli: "--web",
536 isTTY: true,
537 stub: true,
538 repoHost: "gitlab.company.org",
539 setupMocks: func(t *testing.T, testClient *gitlabtesting.TestClient) {
540 t.Helper()
541 testClient.MockProjects.EXPECT().
542 GetProject("OWNER/REPO", gomock.Any()).
543 Return(&gitlab.Project{
544 ID: 37777023,
545 Description: "this is a test description",
546 Name: "REPO",
547 NameWithNamespace: "Test User / REPO",
548 Path: "REPO",
549 PathWithNamespace: "OWNER/REPO",
550 DefaultBranch: "#current-branch",
551 WebURL: "https://gitlab.company.org/OWNER/REPO",
552 ReadmeURL: "https://gitlab.company.org/OWNER/REPO/-/blob/main/README.md",
553 }, nil, nil)
554 },
555 expectedOutput: "Opening gitlab.company.org/OWNER/REPO in your browser.\n",
556 },
557 {
558 name: "view a specific project branch on the web",
559 cli: "--branch foo --web",
560 isTTY: true,
561 stub: true,
562 setupMocks: func(t *testing.T, testClient *gitlabtesting.TestClient) {
563 t.Helper()
564 testClient.MockProjects.EXPECT().
565 GetProject("OWNER/REPO", gomock.Any()).
566 Return(&gitlab.Project{
567 ID: 37777023,
568 Description: "this is a test description",
569 Name: "REPO",
570 NameWithNamespace: "Test User / REPO",
571 Path: "REPO",
572 PathWithNamespace: "OWNER/REPO",
573 DefaultBranch: "#current-branch",
574 WebURL: "https://gitlab.com/OWNER/REPO",
575 ReadmeURL: "https://gitlab.com/OWNER/REPO/-/blob/main/README.md",
576 }, nil, nil)
577 },
578 expectedOutput: "Opening gitlab.com/OWNER/REPO/-/tree/foo in your browser.\n",
579 },
580 }
582 for _, tc := range tests {
583 t.Run(tc.name, func(t *testing.T) {
584 testClient := gitlabtesting.NewTestClient(t)
586 tc.setupMocks(t, testClient)
588 // Create api.Client that wraps the mock gitlab.Client
589 apiClient, err := api.NewClient(
590 func(*http.Client) (gitlab.AuthSource, error) {
591 return gitlab.AccessTokenAuthSource{Token: ""}, nil
592 },
593 api.WithGitLabClient(testClient.Client),
594 )
595 if err != nil {
596 t.Fatalf("failed to create api client: %v", err)
597 }
599 repoHost := glinstance.DefaultHostname
600 if tc.repoHost != "" {
601 repoHost = tc.repoHost
602 }
604 cmdExec := cmdtest.SetupCmdForTest(t, NewCmdView, tc.isTTY,
605 cmdtest.WithGitLabClient(testClient.Client),
606 cmdtest.WithBranch("#current-branch"),
607 cmdtest.WithBaseRepo("OWNER", "REPO", repoHost),
608 cmdtest.WithApiClient(apiClient),
609 )
611 var restoreCmd func()
612 if tc.stub {
613 restoreCmd = run.SetPrepareCmd(func(cmd *exec.Cmd) run.Runnable {
614 return &test.OutputStub{}
615 })
616 defer restoreCmd()
617 }
619 output, err := cmdExec(tc.cli)
621 if assert.NoErrorf(t, err, "error running command `project view %s`: %v", tc.cli, err) {
622 assert.Equal(t, tc.expectedOutput, output.String())
623 assert.Empty(t, output.Stderr())
624 }
625 })
626 }
627}
Diagnostics8 git calls · 245 ms
CallStatusSizeTime0245 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=44Open pack map
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=fb03183b7909876778f740d196d7516811003517Open pack map
fetchtree:0200614 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=614 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=tree:0 git.fetch.wants=3a89d0cfc8e81880c982180388e42e561a0b7eee 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=614 git.pkt.payload.max=587 git.sideband.band1.bytes=587 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=587 git.pack.trailer=eb8250f8e8340ff2fafc22c5aba90db34fd906a9Open pack map
fetchtree:0200144 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=144 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=tree:0 git.fetch.wants=07856548f31627c156093092d9ba11933f27466d 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=144 git.pkt.payload.max=117 git.sideband.band1.bytes=117 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=117 git.pack.trailer=34e6e16d08a698193239463a1692183c2563a257Open pack map
fetch2002.3 KiB234 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=234 git.response.bytes=2372 git.response.cache=MISS git.response.duration_ms=234 git.fetch.wants=8708ebfa0dce8be61a797df92d12b5db96ff3dfb 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=2372 git.pkt.payload.max=2345 git.sideband.band1.bytes=2345 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
- a5ea56785d417089
- Request
- aad3cf51…
- 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