GitLabgitlab-org

cli

main
ply10 git calls388 ms101 KiB8 cachedprotocol v2
372 lines14 KiBRaw
1//go:build !integration
3package update
5import (
6 "errors"
7 "os"
8 "path/filepath"
9 "testing"
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/config"
19 "gitlab.com/gitlab-org/cli/internal/testing/cmdtest"
22func TestDraftUpdate(t *testing.T) {
23 t.Parallel()
25 t.Run("general pending comment sends no position", func(t *testing.T) {
26 t.Parallel()
28 tc := setupMR(t)
29 mockGetDraft(tc, &gitlab.DraftNote{ID: 501, Note: "old", Position: &gitlab.NotePosition{}})
30 tc.MockDraftNotes.EXPECT().
31 UpdateDraftNote("OWNER/REPO", int64(1), int64(501), gomock.Any(), gomock.Any()).
32 DoAndReturn(func(_ any, _ int64, _ int64, opts *gitlab.UpdateDraftNoteOptions, _ ...gitlab.RequestOptionFunc) (*gitlab.DraftNote, *gitlab.Response, error) {
33 assert.Equal(t, "new", *opts.Note)
34 assert.Nil(t, opts.Position)
35 return &gitlab.DraftNote{ID: 501}, nil, nil
36 })
38 output, err := setupExec(t, tc)(`1 501 -m "new"`)
39 require.NoError(t, err)
40 assert.Equal(t, "501\n", output.String())
41 })
43 t.Run("pending reply sends no position", func(t *testing.T) {
44 t.Parallel()
46 tc := setupMR(t)
47 mockGetDraft(tc, &gitlab.DraftNote{ID: 501, Note: "old", DiscussionID: "abc12345"})
48 tc.MockDraftNotes.EXPECT().
49 UpdateDraftNote("OWNER/REPO", int64(1), int64(501), gomock.Any(), gomock.Any()).
50 DoAndReturn(func(_ any, _ int64, _ int64, opts *gitlab.UpdateDraftNoteOptions, _ ...gitlab.RequestOptionFunc) (*gitlab.DraftNote, *gitlab.Response, error) {
51 assert.Nil(t, opts.Position)
52 return &gitlab.DraftNote{ID: 501}, nil, nil
53 })
55 _, err := setupExec(t, tc)(`1 501 -m "new"`)
56 require.NoError(t, err)
57 })
59 t.Run("single-line diff comment re-sends its position", func(t *testing.T) {
60 t.Parallel()
62 tc := setupMR(t)
63 mockGetDraft(tc, &gitlab.DraftNote{ID: 501, Note: "old", Position: &gitlab.NotePosition{
64 BaseSHA: "base",
65 StartSHA: "start",
66 HeadSHA: "head",
67 PositionType: "text",
68 NewPath: "main.go",
69 OldPath: "main.go",
70 NewLine: 42,
71 }})
72 tc.MockDraftNotes.EXPECT().
73 UpdateDraftNote("OWNER/REPO", int64(1), int64(501), gomock.Any(), gomock.Any()).
74 DoAndReturn(func(_ any, _ int64, _ int64, opts *gitlab.UpdateDraftNoteOptions, _ ...gitlab.RequestOptionFunc) (*gitlab.DraftNote, *gitlab.Response, error) {
75 assert.Equal(t, &gitlab.PositionOptions{
76 BaseSHA: new("base"),
77 StartSHA: new("start"),
78 HeadSHA: new("head"),
79 PositionType: new("text"),
80 NewPath: new("main.go"),
81 OldPath: new("main.go"),
82 NewLine: new(int64(42)),
83 }, opts.Position)
84 return &gitlab.DraftNote{ID: 501}, nil, nil
85 })
87 _, err := setupExec(t, tc)(`1 501 -m "new"`)
88 require.NoError(t, err)
89 })
91 t.Run("file-level comment re-sends a position without lines", func(t *testing.T) {
92 t.Parallel()
94 tc := setupMR(t)
95 mockGetDraft(tc, &gitlab.DraftNote{ID: 501, Note: "old", Position: &gitlab.NotePosition{
96 BaseSHA: "base",
97 StartSHA: "start",
98 HeadSHA: "head",
99 PositionType: "file",
100 NewPath: "main.go",
101 OldPath: "main.go",
102 }})
103 tc.MockDraftNotes.EXPECT().
104 UpdateDraftNote("OWNER/REPO", int64(1), int64(501), gomock.Any(), gomock.Any()).
105 DoAndReturn(func(_ any, _ int64, _ int64, opts *gitlab.UpdateDraftNoteOptions, _ ...gitlab.RequestOptionFunc) (*gitlab.DraftNote, *gitlab.Response, error) {
106 assert.Equal(t, &gitlab.PositionOptions{
107 BaseSHA: new("base"),
108 StartSHA: new("start"),
109 HeadSHA: new("head"),
110 PositionType: new("file"),
111 NewPath: new("main.go"),
112 OldPath: new("main.go"),
113 }, opts.Position)
114 return &gitlab.DraftNote{ID: 501}, nil, nil
115 })
117 _, err := setupExec(t, tc)(`1 501 -m "new"`)
118 require.NoError(t, err)
119 })
121 t.Run("multiline diff comment re-sends its line range", func(t *testing.T) {
122 t.Parallel()
124 tc := setupMR(t)
125 mockGetDraft(tc, &gitlab.DraftNote{ID: 501, Note: "old", Position: &gitlab.NotePosition{
126 BaseSHA: "base",
127 StartSHA: "start",
128 HeadSHA: "head",
129 PositionType: "text",
130 NewPath: "main.go",
131 OldPath: "main.go",
132 NewLine: 12,
133 OldLine: 11,
134 LineRange: &gitlab.LineRange{
135 StartRange: &gitlab.LinePosition{LineCode: "abc_0_10", Type: "new", NewLine: 10},
136 EndRange: &gitlab.LinePosition{LineCode: "abc_11_12", NewLine: 12, OldLine: 11},
137 },
138 }})
139 tc.MockDraftNotes.EXPECT().
140 UpdateDraftNote("OWNER/REPO", int64(1), int64(501), gomock.Any(), gomock.Any()).
141 DoAndReturn(func(_ any, _ int64, _ int64, opts *gitlab.UpdateDraftNoteOptions, _ ...gitlab.RequestOptionFunc) (*gitlab.DraftNote, *gitlab.Response, error) {
142 require.NotNil(t, opts.Position)
143 assert.Equal(t, new(int64(12)), opts.Position.NewLine)
144 assert.Equal(t, new(int64(11)), opts.Position.OldLine)
145 assert.Equal(t, &gitlab.LineRangeOptions{
146 Start: &gitlab.LinePositionOptions{LineCode: new("abc_0_10"), Type: new("new"), NewLine: new(int64(10))},
147 End: &gitlab.LinePositionOptions{LineCode: new("abc_11_12"), NewLine: new(int64(12)), OldLine: new(int64(11))},
148 }, opts.Position.LineRange)
149 return &gitlab.DraftNote{ID: 501}, nil, nil
150 })
152 _, err := setupExec(t, tc)(`1 501 -m "new"`)
153 require.NoError(t, err)
154 })
156 t.Run("comment on a removed line re-sends only the old side", func(t *testing.T) {
157 t.Parallel()
159 tc := setupMR(t)
160 mockGetDraft(tc, &gitlab.DraftNote{ID: 501, Note: "old", Position: &gitlab.NotePosition{
161 BaseSHA: "base",
162 StartSHA: "start",
163 HeadSHA: "head",
164 PositionType: "text",
165 OldPath: "gone.go",
166 NewPath: "gone.go",
167 OldLine: 7,
168 }})
169 tc.MockDraftNotes.EXPECT().
170 UpdateDraftNote("OWNER/REPO", int64(1), int64(501), gomock.Any(), gomock.Any()).
171 DoAndReturn(func(_ any, _ int64, _ int64, opts *gitlab.UpdateDraftNoteOptions, _ ...gitlab.RequestOptionFunc) (*gitlab.DraftNote, *gitlab.Response, error) {
172 require.NotNil(t, opts.Position)
173 assert.Equal(t, new(int64(7)), opts.Position.OldLine)
174 assert.Nil(t, opts.Position.NewLine)
175 assert.Nil(t, opts.Position.LineRange)
176 return &gitlab.DraftNote{ID: 501}, nil, nil
177 })
179 _, err := setupExec(t, tc)(`1 501 -m "new"`)
180 require.NoError(t, err)
181 })
183 t.Run("image comment is refused before reading a body", func(t *testing.T) {
184 t.Parallel()
186 tc := setupMR(t)
187 mockGetDraft(tc, &gitlab.DraftNote{ID: 501, Note: "old", Position: &gitlab.NotePosition{
188 PositionType: "image",
189 NewPath: "logo.png",
190 }})
192 _, err := setupExec(t, tc)(`1 501 -m "new"`)
193 require.EqualError(t, err, "pending review comment 501 is on an image and cannot be updated without losing its position")
194 })
196 t.Run("reads the body from stdin", func(t *testing.T) {
197 t.Parallel()
199 tc := setupMR(t)
200 mockGetDraft(tc, &gitlab.DraftNote{ID: 501, Note: "old"})
201 tc.MockDraftNotes.EXPECT().
202 UpdateDraftNote("OWNER/REPO", int64(1), int64(501), gomock.Any(), gomock.Any()).
203 DoAndReturn(func(_ any, _ int64, _ int64, opts *gitlab.UpdateDraftNoteOptions, _ ...gitlab.RequestOptionFunc) (*gitlab.DraftNote, *gitlab.Response, error) {
204 assert.Equal(t, "from stdin", *opts.Note)
205 return &gitlab.DraftNote{ID: 501}, nil, nil
206 })
208 _, err := setupExec(t, tc, cmdtest.WithStdin("from stdin\n"))(`1 501`)
209 require.NoError(t, err)
210 })
212 t.Run("--attach without --message appends to the existing body", func(t *testing.T) {
213 t.Parallel()
215 path := filepath.Join(t.TempDir(), "screenshot.png")
216 require.NoError(t, os.WriteFile(path, []byte("\x89PNG\r\n\x1a\nfake png body"), 0o600))
218 tc := setupMR(t)
219 mockGetDraft(tc, &gitlab.DraftNote{ID: 501, Note: "Renders wrong here."})
220 tc.MockProjectMarkdownUploads.EXPECT().
221 UploadProjectMarkdown("OWNER/REPO", gomock.Any(), "screenshot.png", gomock.Any()).
222 Return(&gitlab.ProjectMarkdownUploadedFile{Markdown: "![screenshot](/uploads/abc/screenshot.png)"}, nil, nil)
223 tc.MockDraftNotes.EXPECT().
224 UpdateDraftNote("OWNER/REPO", int64(1), int64(501), gomock.Any(), gomock.Any()).
225 DoAndReturn(func(_ any, _ int64, _ int64, opts *gitlab.UpdateDraftNoteOptions, _ ...gitlab.RequestOptionFunc) (*gitlab.DraftNote, *gitlab.Response, error) {
226 assert.Equal(t, "Renders wrong here.\n\n![screenshot](/uploads/abc/screenshot.png)", *opts.Note)
227 return &gitlab.DraftNote{ID: 501}, nil, nil
228 })
230 _, err := setupExec(t, tc)(`1 501 --attach ` + path)
231 require.NoError(t, err)
232 })
234 t.Run("--attach with a body piped on stdin replaces the existing body", func(t *testing.T) {
235 t.Parallel()
237 path := filepath.Join(t.TempDir(), "screenshot.png")
238 require.NoError(t, os.WriteFile(path, []byte("\x89PNG\r\n\x1a\nfake png body"), 0o600))
240 tc := setupMR(t)
241 mockGetDraft(tc, &gitlab.DraftNote{ID: 501, Note: "Renders wrong here."})
242 tc.MockProjectMarkdownUploads.EXPECT().
243 UploadProjectMarkdown("OWNER/REPO", gomock.Any(), "screenshot.png", gomock.Any()).
244 Return(&gitlab.ProjectMarkdownUploadedFile{Markdown: "![screenshot](/uploads/abc/screenshot.png)"}, nil, nil)
245 tc.MockDraftNotes.EXPECT().
246 UpdateDraftNote("OWNER/REPO", int64(1), int64(501), gomock.Any(), gomock.Any()).
247 DoAndReturn(func(_ any, _ int64, _ int64, opts *gitlab.UpdateDraftNoteOptions, _ ...gitlab.RequestOptionFunc) (*gitlab.DraftNote, *gitlab.Response, error) {
248 assert.Equal(t, "Replacement body.\n\n![screenshot](/uploads/abc/screenshot.png)", *opts.Note)
249 return &gitlab.DraftNote{ID: 501}, nil, nil
250 })
252 _, err := setupExec(t, tc, cmdtest.WithStdin("Replacement body.\n"))(`1 501 --attach ` + path)
253 require.NoError(t, err)
254 })
256 t.Run("empty body", func(t *testing.T) {
257 t.Parallel()
259 tc := setupMR(t)
260 mockGetDraft(tc, &gitlab.DraftNote{ID: 501, Note: "old"})
262 _, err := setupExec(t, tc, cmdtest.WithStdin(" \n"))(`1 501`)
263 require.EqualError(t, err, "aborted: comment has an empty message")
264 })
266 t.Run("a lone ID is the pending comment on the current branch's merge request", func(t *testing.T) {
267 t.Parallel()
269 tc := setupMR(t)
270 mockBranchMR(t, tc)
271 mockGetDraft(tc, &gitlab.DraftNote{ID: 501, Note: "old"})
272 tc.MockDraftNotes.EXPECT().
273 UpdateDraftNote("OWNER/REPO", int64(1), int64(501), gomock.Any(), gomock.Any()).
274 Return(&gitlab.DraftNote{ID: 501}, nil, nil)
276 output, err := setupExec(t, tc, cmdtest.WithBranch("feature"))(`501 -m "new"`)
277 require.NoError(t, err)
278 assert.Equal(t, "501\n", output.String())
279 })
281 t.Run("--message with --attach replaces the body and appends the upload", func(t *testing.T) {
282 t.Parallel()
284 path := filepath.Join(t.TempDir(), "screenshot.png")
285 require.NoError(t, os.WriteFile(path, []byte("\x89PNG\r\n\x1a\nfake png body"), 0o600))
287 tc := setupMR(t)
288 mockGetDraft(tc, &gitlab.DraftNote{ID: 501, Note: "old body"})
289 tc.MockProjectMarkdownUploads.EXPECT().
290 UploadProjectMarkdown("OWNER/REPO", gomock.Any(), "screenshot.png", gomock.Any()).
291 Return(&gitlab.ProjectMarkdownUploadedFile{Markdown: "![screenshot](/uploads/abc/screenshot.png)"}, nil, nil)
292 tc.MockDraftNotes.EXPECT().
293 UpdateDraftNote("OWNER/REPO", int64(1), int64(501), gomock.Any(), gomock.Any()).
294 DoAndReturn(func(_ any, _ int64, _ int64, opts *gitlab.UpdateDraftNoteOptions, _ ...gitlab.RequestOptionFunc) (*gitlab.DraftNote, *gitlab.Response, error) {
295 assert.Equal(t, "new body\n\n![screenshot](/uploads/abc/screenshot.png)", *opts.Note)
296 return &gitlab.DraftNote{ID: 501}, nil, nil
297 })
299 _, err := setupExec(t, tc)(`1 501 -m "new body" --attach ` + path)
300 require.NoError(t, err)
301 })
303 t.Run("unknown ID", func(t *testing.T) {
304 t.Parallel()
306 tc := setupMR(t)
307 tc.MockDraftNotes.EXPECT().
308 GetDraftNote("OWNER/REPO", int64(1), int64(999), gomock.Any()).
309 Return(nil, nil, gitlab.ErrNotFound)
311 _, err := setupExec(t, tc)(`1 999 -m "new"`)
312 require.EqualError(t, err, "pending review comment 999 not found in merge request !1")
313 })
315 t.Run("non-numeric ID is rejected before any API call", func(t *testing.T) {
316 t.Parallel()
318 tc := gitlabtesting.NewTestClient(t)
320 _, err := setupExec(t, tc)(`1 abc -m "new"`)
321 require.EqualError(t, err, `invalid pending review comment ID "abc": must be a number`)
322 })
324 t.Run("update error is wrapped", func(t *testing.T) {
325 t.Parallel()
327 tc := setupMR(t)
328 mockGetDraft(tc, &gitlab.DraftNote{ID: 501, Note: "old"})
329 tc.MockDraftNotes.EXPECT().
330 UpdateDraftNote("OWNER/REPO", int64(1), int64(501), gomock.Any(), gomock.Any()).
331 Return(nil, nil, errors.New("boom"))
333 _, err := setupExec(t, tc)(`1 501 -m "new"`)
334 require.EqualError(t, err, "failed to update pending review comment: boom")
335 })
338func mockGetDraft(tc *gitlabtesting.TestClient, draft *gitlab.DraftNote) {
339 tc.MockDraftNotes.EXPECT().
340 GetDraftNote("OWNER/REPO", int64(1), draft.ID, gomock.Any()).
341 Return(draft, nil, nil)
344func setupMR(t *testing.T) *gitlabtesting.TestClient {
345 t.Helper()
346 tc := gitlabtesting.NewTestClient(t)
347 tc.MockMergeRequests.EXPECT().
348 GetMergeRequest("OWNER/REPO", int64(1), gomock.Any()).
349 Return(&gitlab.MergeRequest{BasicMergeRequest: gitlab.BasicMergeRequest{ID: 1, IID: 1}}, nil, nil)
350 return tc
353// mockBranchMR resolves branch "feature" to merge request !1.
354func mockBranchMR(t *testing.T, tc *gitlabtesting.TestClient) {
355 t.Helper()
356 tc.MockMergeRequests.EXPECT().
357 ListProjectMergeRequests("OWNER/REPO", gomock.Any()).
358 DoAndReturn(func(_ any, opts *gitlab.ListProjectMergeRequestsOptions, _ ...gitlab.RequestOptionFunc) ([]*gitlab.BasicMergeRequest, *gitlab.Response, error) {
359 assert.Equal(t, "feature", *opts.SourceBranch)
360 return []*gitlab.BasicMergeRequest{{ID: 1, IID: 1}}, nil, nil
361 })
364func setupExec(t *testing.T, tc *gitlabtesting.TestClient, opts ...cmdtest.FactoryOption) cmdtest.CmdExecFunc {
365 t.Helper()
366 opts = append([]cmdtest.FactoryOption{
367 cmdtest.WithGitLabClient(tc.Client),
368 cmdtest.WithBaseRepo("OWNER", "REPO", ""),
369 cmdtest.WithConfig(config.NewFromString("editor: vi")),
370 }, opts...)
371 return cmdtest.SetupCmdForTest(t, NewCmd, false, opts...)
Diagnostics10 git calls · 388 ms
CallStatusSizeTime0388 ms
discover200185 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=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 · hit9 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=9
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=2
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 · 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
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:0200746 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=746
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=tree:0
git.fetch.wants=f3d413a22af5a9c2fe9aa49709b1cb36d1351a7f
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=746
git.pkt.payload.max=719
git.sideband.band1.bytes=719
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=719
git.pack.trailer=330baf80c59a4208b55120dff7dd824b7952b790
Open pack map
fetchtree:0200540 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=540
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=tree:0
git.fetch.wants=d1be7f980a856805fa31e30e01fff4db335cbe1b
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=540
git.pkt.payload.max=513
git.sideband.band1.bytes=513
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=513
git.pack.trailer=6c82398efd91c9e023d583b948fde889bd4991b2
Open pack map
fetchtree:0200259 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=259
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=tree:0
git.fetch.wants=17c60670b892d93213e07c56d27bf8c78b2f6eee
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=259
git.pkt.payload.max=232
git.sideband.band1.bytes=232
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=232
git.pack.trailer=a86d2eccaf7aae3b0fec29dbfe655131faf5a4ad
Open pack map
fetchtree:0200139 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=139
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=tree:0
git.fetch.wants=015a61e58c945c0dc30a4b51232d30449852384b
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=139
git.pkt.payload.max=112
git.sideband.band1.bytes=112
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=112
git.pack.trailer=df946d39b75737b8081fdceb7535c2acf63ff133
Open pack map
fetch2002.3 KiB365 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=365
git.response.bytes=2320
git.response.cache=MISS
git.response.duration_ms=365
git.fetch.wants=8502ea9164b7c6c551d9bf69b51e26d208f8ce8a
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=2320
git.pkt.payload.max=2293
git.sideband.band1.bytes=2293
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
a5e2c4242f5faedd
Request
dd7adc34…
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