GitLabgitlab-org
cli
main
1//go:build !integration
3package pm
5import (
6 "encoding/xml"
7 "errors"
8 "io/fs"
9 "os"
10 "path/filepath"
11 "strings"
12 "testing"
14 "github.com/stretchr/testify/assert"
15 "github.com/stretchr/testify/require"
17 "gitlab.com/gitlab-org/cli/internal/testing/cmdtest"
18)
20const userSettingsXML = `<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0">
21 <mirrors>
22 <mirror>
23 <id>corp</id>
24 <mirrorOf>*</mirrorOf>
25 <url>https://nexus.example.com/repository/central</url>
26 </mirror>
27 </mirrors>
28 <servers>
29 <server>
30 <id>corp</id>
31 <username>svc</username>
32 <password>secret</password>
33 </server>
34 </servers>
35</settings>
36`
38// complexSettingsXML is a representative settings.xml (servers, mirrors,
39// profiles, repositories, pluginRepositories together), not modeled on any
40// specific customer's configuration.
41const complexSettingsXML = `<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
42 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
43 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
45 <!-- <localRepository>D:\maven\repository</localRepository> -->
47 <servers>
48 <server>
49 <id>corporate</id>
50 <username>*********</username>
51 <password>*********</password>
52 </server>
53 </servers>
55 <mirrors>
56 <mirror>
57 <id>corporate</id>
58 <url>https://nexus.example-corp.internal/repository/public/</url>
59 <mirrorOf>*</mirrorOf>
60 </mirror>
61 </mirrors>
63 <profiles>
64 <profile>
65 <id>corporate</id>
66 <properties>
67 <corp.artifact.deploy.repository.id>corporate</corp.artifact.deploy.repository.id> <corp.artifact.deploy.repository.url>https://nexus.example-corp.internal/repository/corporate/</corp.artifact.deploy.repository.url>
68 </properties>
69 <repositories>
70 <repository>
71 <id>corporate</id>
72 <url>https://nexus.example-corp.internal/repository/public/</url>
73 </repository>
74 </repositories>
75 <pluginRepositories>
76 <pluginRepository>
77 <id>corporate</id>
78 <url>https://nexus.example-corp.internal/repository/public/</url>
79 </pluginRepository>
80 </pluginRepositories>
81 </profile>
82 </profiles>
83 <activeProfiles>
84 <activeProfile>corporate</activeProfile>
85 </activeProfiles>
86</settings>
87`
89// mavenRun is what the manager hands to mvn: the MAVEN_ARGS it emits, the
90// settings file it points at, and that file's contents.
91type mavenRun struct {
92 args string
93 settingsPath string
94 settings string
95}
97// mavenWithoutInstall returns the Maven manager with the machine's own Maven
98// install kept out of the global settings.
99func mavenWithoutInstall(t *testing.T) PackageManager {
100 t.Helper()
101 m := Maven()
102 mm, ok := m.(*mavenManager)
103 require.True(t, ok)
104 mm.lookPath = func(string) (string, error) { return "", errors.New("no mvn in tests") }
105 return m
106}
108// mavenSettingsFor runs the manager's CA-trust wiring the way Run does.
109func mavenSettingsFor(t *testing.T, args []string) mavenRun {
110 t.Helper()
112 ca := selfSignedTestCA(t)
113 caPath := filepath.Join(t.TempDir(), "ca.pem")
114 require.NoError(t, os.WriteFile(caPath, caPEM(t, ca), 0o600))
116 m := mavenWithoutInstall(t)
117 if a, ok := m.(argsManager); ok {
118 a.SetArgs(args)
119 }
120 m.Environment("http://127.0.0.1:52999")
121 var mavenArgs string
122 for _, e := range m.CATrustEnviron(caPath) {
123 if v, ok := strings.CutPrefix(e, "MAVEN_ARGS="); ok {
124 mavenArgs = v
125 }
126 }
127 require.NotEmpty(t, mavenArgs, "MAVEN_ARGS must carry the -s that routes mvn through the proxy")
129 settingsPath := caPath + ".settings.xml"
130 raw, err := os.ReadFile(settingsPath)
131 require.NoError(t, err)
132 return mavenRun{args: mavenArgs, settingsPath: settingsPath, settings: string(raw)}
133}
135// assertFirewallSettingsWin checks that the firewall's settings file is the
136// one Maven will read first.
137func assertFirewallSettingsWin(t *testing.T, r mavenRun, userPath string) {
138 t.Helper()
139 ours := strings.Index(r.args, r.settingsPath)
140 require.NotEqual(t, -1, ours, "MAVEN_ARGS must name the firewall's settings file: %q", r.args)
141 if theirs := strings.Index(r.args, userPath); theirs != -1 {
142 assert.Less(t, ours, theirs,
143 "the firewall's -s must precede the caller's, or Maven reads theirs: %q", r.args)
144 }
145}
147// assertFirewallProxyActive checks the firewall's proxy is a child of
148// <proxies>, not merely present in the file.
149func assertFirewallProxyActive(t *testing.T, settings string, wantPort string) {
150 t.Helper()
151 var doc struct {
152 Proxies struct {
153 Proxy []struct {
154 Host string `xml:"host"`
155 Port string `xml:"port"`
156 } `xml:"proxy"`
157 } `xml:"proxies"`
158 }
159 require.NoError(t, xml.Unmarshal([]byte(settings), &doc), "the merged settings must parse")
160 require.NotEmpty(t, doc.Proxies.Proxy, "the firewall proxy must be inside <proxies>:\n%s", settings)
161 assert.Equal(t, "127.0.0.1", doc.Proxies.Proxy[0].Host)
162 if wantPort != "" {
163 assert.Equal(t, wantPort, doc.Proxies.Proxy[0].Port)
164 } else {
165 assert.NotEmpty(t, doc.Proxies.Proxy[0].Port)
166 }
167}
169// assertProxyAndUserContent checks the merge keeps the user's settings while
170// still routing through the firewall.
171func assertProxyAndUserContent(t *testing.T, settings string, wantPort string) {
172 t.Helper()
173 assertFirewallProxyActive(t, settings, wantPort)
174 assert.Contains(t, settings, "nexus.example.com", "the user's mirror must survive the merge")
175 assert.Contains(t, settings, "<username>svc</username>", "the user's server credentials must survive the merge")
176}
178func writeUserSettings(t *testing.T, body string) string {
179 t.Helper()
180 path := filepath.Join(t.TempDir(), "settings.xml")
181 require.NoError(t, os.WriteFile(path, []byte(body), 0o600))
182 return path
183}
185// TestRunMergesSettingsNamedOnTheCommandLine goes through Run itself, since
186// that's what makes a command-line -s visible to the manager at all.
187func TestRunMergesSettingsNamedOnTheCommandLine(t *testing.T) {
188 t.Setenv("GITLAB_CI", "") // honor fake mode even when the suite runs in CI
189 t.Setenv("GLAB_DF_FAKE_DEFAULT", "allow")
190 isolateUserConfig(t, t.TempDir())
191 userPath := writeUserSettings(t, userSettingsXML)
192 ios, _, _, _ := cmdtest.TestIOStreams()
193 exec := &fakeExecutor{}
194 // Run removes the generated settings file once the child exits, so read it
195 // from the hook that stands in for the child.
196 var merged string
197 exec.onExec = func() {
198 for _, e := range exec.env {
199 v, ok := strings.CutPrefix(e, "MAVEN_ARGS=")
200 if !ok {
201 continue
202 }
203 path, ok := mavenOption(strings.Fields(v), "-s", "--settings", false)
204 require.True(t, ok, "MAVEN_ARGS %q has no -s", v)
205 data, err := os.ReadFile(path)
206 require.NoError(t, err)
207 merged = string(data)
208 }
209 }
211 require.NoError(t, Run(t.Context(), mavenWithoutInstall(t), RunOptions{
212 IO: ios,
213 Executor: exec,
214 BaseDir: t.TempDir(),
215 ProjectID: "group/proj",
216 Args: []string{"-s", userPath, "verify"},
217 }))
219 require.NotEmpty(t, merged, "Run must pass mvn a settings file: %v", exec.env)
220 assertProxyAndUserContent(t, merged, "")
221}
223// plainHTTPSettings returns a settings file whose only repository is the
224// mirror at url, with credentials alongside.
225func plainHTTPSettings(url string) string {
226 return `<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0">
227 <mirrors>
228 <mirror>
229 <id>corp</id>
230 <mirrorOf>*</mirrorOf>
231 <url>` + url + `</url>
232 </mirror>
233 </mirrors>
234 <servers>
235 <server>
236 <id>corp</id>
237 <username>svc</username>
238 <password>secret</password>
239 </server>
240 </servers>
241</settings>
242`
243}
245func TestMavenExpandEnvURLs(t *testing.T) {
246 environ := []string{
247 "CI_API_V4_URL=https://gitlab.example.com/api/v4",
248 "HOST=nexus.example.com",
249 "QUERY=https://nexus.example.com/r?a=1&b=<2>",
250 "NESTED=${env.HOST}",
251 "EMPTY=",
252 }
253 for _, tc := range []struct{ name, url, want string }{
254 {name: "when the URL comes from a variable", url: "${env.CI_API_V4_URL}/virtual_registries/packages/maven/42", want: "https://gitlab.example.com/api/v4/virtual_registries/packages/maven/42"},
255 {name: "when only the host does", url: "https://${env.HOST}/repository/public/", want: "https://nexus.example.com/repository/public/"},
256 {name: "when the URL is padded", url: "\n https://${env.HOST}/repository/public/\n ", want: "https://nexus.example.com/repository/public/"},
257 {name: "when the value needs escaping", url: "${env.QUERY}", want: "https://nexus.example.com/r?a=1&b=<2>"},
258 {name: "when the variable is unset", url: "https://${env.MISSING}/repository/public/"},
259 {name: "when the variable is empty", url: "https://${env.EMPTY}/repository/public/"},
260 {name: "when the value holds an expression", url: "https://${env.NESTED}/repository/public/"},
261 {name: "when another property is mixed in", url: "https://${env.HOST}/${repo.path}/"},
262 {name: "when a comment splits the URL", url: "https://${env.HOST}<!-- old -->/repository/public/"},
263 {name: "when the URL has no expression", url: "\n https://nexus.example.com/repository/public/\n "},
264 } {
265 t.Run(tc.name, func(t *testing.T) {
266 raw := plainHTTPSettings(tc.url)
267 want := raw
268 if tc.want != "" {
269 want = strings.Replace(raw, "<url>"+tc.url+"</url>", "<url>"+tc.want+"</url>", 1)
270 }
272 assert.Equal(t, want, string(mavenExpandEnvURLs([]byte(raw), environ)))
273 })
274 }
276 t.Run("when profile repositories come from a variable too", func(t *testing.T) {
277 raw := strings.ReplaceAll(complexSettingsXML, "<url>https://nexus.example-corp.internal/", "<url>https://${env.CORP_HOST}/")
278 require.Equal(t, 3, strings.Count(raw, "${env.CORP_HOST}"), "a mirror, a repository and a plugin repository")
280 got := mavenExpandEnvURLs([]byte(raw), []string{"CORP_HOST=nexus.example-corp.internal"})
282 assert.Equal(t, complexSettingsXML, string(got), "the rest of the file, the deploy URL property included, is copied as it is")
283 })
285 t.Run("when a variable sits outside a repository URL", func(t *testing.T) {
286 raw := strings.NewReplacer(
287 "<id>corp</id>\n <mirrorOf>", "<id>${env.HOST}</id>\n <mirrorOf>",
288 "<password>secret</password>", "<password>${env.HOST}</password><configuration><url>https://${env.HOST}/</url></configuration>",
289 ).Replace(plainHTTPSettings("https://nexus.example.com/repository/public/"))
290 require.Equal(t, 3, strings.Count(raw, "${env.HOST}"))
292 assert.Equal(t, raw, string(mavenExpandEnvURLs([]byte(raw), environ)), "Maven still interpolates everything glab doesn't check")
293 })
295 t.Run("when the settings don't parse", func(t *testing.T) {
296 raw := "<settings><mirrors><mirror><url>https://${env.HOST}/</url></mirrors></settings>"
298 assert.Equal(t, raw, string(mavenExpandEnvURLs([]byte(raw), environ)), "glab's own parse of the file reports the error")
299 })
301 t.Run("when the caller's mirror URL comes from an environment variable", func(t *testing.T) {
302 t.Setenv("MAVEN_ARGS", "")
303 t.Setenv("CI_API_V4_URL", "https://gitlab.example.com/api/v4")
304 userPath := writeUserSettings(t, plainHTTPSettings("${env.CI_API_V4_URL}/virtual_registries/packages/maven/42"))
306 r := mavenSettingsFor(t, []string{"-s", userPath, "verify"})
308 assert.Contains(t, r.settings, "<url>https://gitlab.example.com/api/v4/virtual_registries/packages/maven/42</url>",
309 "Maven must fetch from the URL glab checked")
310 })
311}
313// TestMavenPlainHTTPMirrorIsMerged pins that a plain-HTTP mirror survives the
314// merge, now that the proxy serves absolute-form http:// requests itself.
315func TestMavenPlainHTTPMirrorIsMerged(t *testing.T) {
316 t.Setenv("MAVEN_ARGS", "")
317 userPath := writeUserSettings(t, strings.Replace(userSettingsXML, "https://nexus.example.com", "http://nexus.example.com", 1))
319 r := mavenSettingsFor(t, []string{"-s", userPath, "verify"})
321 assertProxyAndUserContent(t, r.settings, "52999")
322 assert.Contains(t, r.settings, "<url>http://nexus.example.com/repository/central</url>")
323}
325// TestMergeMavenProxiesReportsTheCause pins that each way a merge can fail
326// keeps its cause, so the debug log says why the caller's file was dropped.
327func TestMergeMavenProxiesReportsTheCause(t *testing.T) {
328 t.Run("when the file doesn't exist", func(t *testing.T) {
329 _, err := mergeMavenProxies(filepath.Join(t.TempDir(), "missing.xml"), "")
330 assert.ErrorIs(t, err, fs.ErrNotExist)
331 })
333 t.Run("when the XML is malformed", func(t *testing.T) {
334 _, err := mergeMavenProxies(writeUserSettings(t, "<settings><mirrors></settings>"), "")
335 assert.ErrorContains(t, err, "XML syntax error")
336 })
338 t.Run("when the settings element is self-closed", func(t *testing.T) {
339 _, err := mergeMavenProxies(writeUserSettings(t, "<settings/>"), "")
340 assert.ErrorContains(t, err, "self-closed <settings/>")
341 })
343 t.Run("when there is no settings element", func(t *testing.T) {
344 _, err := mergeMavenProxies(writeUserSettings(t, "<!-- nothing here -->"), "")
345 assert.ErrorContains(t, err, "no <settings> element")
346 })
347}
349func TestMavenUserSettings(t *testing.T) {
350 t.Run("when the user passes -s on the command line", func(t *testing.T) {
351 t.Setenv("HOME", t.TempDir())
352 t.Setenv("MAVEN_ARGS", "")
353 userPath := writeUserSettings(t, userSettingsXML)
355 r := mavenSettingsFor(t, []string{"-s", userPath, "verify"})
357 assertProxyAndUserContent(t, r.settings, "52999")
358 assertFirewallSettingsWin(t, r, userPath)
359 })
361 t.Run("when the user passes --settings= on the command line", func(t *testing.T) {
362 t.Setenv("HOME", t.TempDir())
363 t.Setenv("MAVEN_ARGS", "")
364 userPath := writeUserSettings(t, userSettingsXML)
366 r := mavenSettingsFor(t, []string{"--settings=" + userPath, "verify"})
368 assertProxyAndUserContent(t, r.settings, "52999")
369 })
371 t.Run("when the user sets -s through MAVEN_ARGS", func(t *testing.T) {
372 t.Setenv("HOME", t.TempDir())
373 userPath := writeUserSettings(t, userSettingsXML)
374 t.Setenv("MAVEN_ARGS", "-s "+userPath)
376 r := mavenSettingsFor(t, []string{"verify"})
378 assertProxyAndUserContent(t, r.settings, "52999")
379 assertFirewallSettingsWin(t, r, userPath)
380 })
382 t.Run("when -s is set on the command line and MAVEN_ARGS disagree", func(t *testing.T) {
383 // MAVEN_ARGS wins: Maven expands it before the command line and
384 // takes the first occurrence of a repeated option.
385 fromEnv := writeUserSettings(t, userSettingsXML)
386 fromCLI := writeUserSettings(t, `<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0">
387 <mirrors>
388 <mirror>
389 <id>ignored</id>
390 <mirrorOf>*</mirrorOf>
391 <url>https://ignored.example.com/</url>
392 </mirror>
393 </mirrors>
394</settings>
395`)
396 t.Setenv("MAVEN_ARGS", "-s "+fromEnv)
398 r := mavenSettingsFor(t, []string{"-s", fromCLI, "verify"})
400 assertProxyAndUserContent(t, r.settings, "52999")
401 assert.NotContains(t, r.settings, "ignored.example.com",
402 "the command-line -s loses to MAVEN_ARGS, so its file must not be the one merged")
403 })
405 t.Run("when the user has no -s but a default settings.xml in .m2", func(t *testing.T) {
406 // Maven reads user.home from the password database, not HOME.
407 home := t.TempDir()
408 t.Setenv("MAVEN_ARGS", "")
409 require.NoError(t, os.MkdirAll(filepath.Join(home, ".m2"), 0o700))
410 require.NoError(t, os.WriteFile(filepath.Join(home, ".m2", "settings.xml"), []byte(userSettingsXML), 0o600))
412 r := mavenSettingsFor(t, []string{"-Duser.home=" + home, "verify"})
414 assertProxyAndUserContent(t, r.settings, "52999")
415 })
417 t.Run("when a project sets -s in .mvn/maven.config", func(t *testing.T) {
418 t.Setenv("MAVEN_ARGS", "")
419 userPath := writeUserSettings(t, userSettingsXML)
420 dir := t.TempDir()
421 require.NoError(t, os.MkdirAll(filepath.Join(dir, ".mvn"), 0o700))
422 // maven.config holds one argument per line, not "-s <path>".
423 require.NoError(t, os.WriteFile(filepath.Join(dir, ".mvn", "maven.config"), []byte("-s\n"+userPath+"\n"), 0o600))
424 t.Chdir(dir)
426 r := mavenSettingsFor(t, []string{"verify"})
428 assertProxyAndUserContent(t, r.settings, "52999")
429 })
431 t.Run("when the user has no settings at all", func(t *testing.T) {
432 // Maven takes user.home from the password database; HOME alone
433 // doesn't steer it.
434 t.Setenv("MAVEN_ARGS", "")
436 r := mavenSettingsFor(t, []string{"-Duser.home=" + t.TempDir(), "verify"})
438 assertFirewallProxyActive(t, r.settings, "52999")
439 assert.NotContains(t, r.settings, "<mirrors>", "no settings to merge means the firewall's own file")
440 })
442 t.Run("when the user settings define their own active proxy", func(t *testing.T) {
443 t.Setenv("HOME", t.TempDir())
444 t.Setenv("MAVEN_ARGS", "")
445 userPath := writeUserSettings(t, `<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0">
446 <proxies>
447 <proxy>
448 <id>corp-proxy</id>
449 <active>true</active>
450 <protocol>https</protocol>
451 <host>proxy.example.com</host>
452 <port>8080</port>
453 </proxy>
454 </proxies>
455</settings>
456`)
458 r := mavenSettingsFor(t, []string{"-s", userPath})
460 assertFirewallProxyActive(t, r.settings, "52999")
461 assert.Contains(t, r.settings, "proxy.example.com",
462 "the caller's proxy must survive: the merge is not allowed to be destructive")
463 assert.Less(t, strings.Index(r.settings, "<host>127.0.0.1</host>"), strings.Index(r.settings, "proxy.example.com"),
464 "the firewall proxy must come first: Maven uses the first active proxy per protocol")
465 })
467 t.Run("when the user attaches the path to the short option", func(t *testing.T) {
468 t.Setenv("HOME", t.TempDir())
469 t.Setenv("MAVEN_ARGS", "")
470 userPath := writeUserSettings(t, userSettingsXML)
472 r := mavenSettingsFor(t, []string{"-s" + userPath, "verify"})
474 assertProxyAndUserContent(t, r.settings, "52999")
475 })
477 t.Run("when the user settings hold a self-closed proxies element", func(t *testing.T) {
478 t.Setenv("HOME", t.TempDir())
479 t.Setenv("MAVEN_ARGS", "")
480 userPath := writeUserSettings(t, `<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0">
481 <proxies/>
482 <mirrors>
483 <mirror>
484 <id>corp</id>
485 <mirrorOf>*</mirrorOf>
486 <url>https://nexus.example.com/repository/central</url>
487 </mirror>
488 </mirrors>
489</settings>
490`)
492 r := mavenSettingsFor(t, []string{"-s", userPath})
494 assertFirewallProxyActive(t, r.settings, "52999")
495 assert.Contains(t, r.settings, "nexus.example.com", "an empty proxies element must not cost the caller their file")
496 })
498 t.Run("when the user settings cannot be read", func(t *testing.T) {
499 t.Setenv("HOME", t.TempDir())
500 t.Setenv("MAVEN_ARGS", "")
502 r := mavenSettingsFor(t, []string{"-s", filepath.Join(t.TempDir(), "missing.xml")})
504 assertFirewallProxyActive(t, r.settings, "52999")
505 })
507 t.Run("when the user passes -gs (global settings) instead of -s", func(t *testing.T) {
508 // -gs names global settings, which glab reads but doesn't merge its
509 // proxy into, so the proxy still goes in glab's own user settings.
510 t.Setenv("MAVEN_ARGS", "")
511 globalPath := writeUserSettings(t, complexSettingsXML)
513 r := mavenSettingsFor(t, []string{"-gs", globalPath, "-Duser.home=" + t.TempDir(), "verify"})
515 assertFirewallProxyActive(t, r.settings, "52999")
516 assert.NotContains(t, r.settings, "nexus.example-corp.internal",
517 "glab does not read -gs, so its own generated settings should not pick up the global file's content")
518 })
520 t.Run("when the user's settings file has servers, mirrors, profiles, repositories and pluginRepositories together", func(t *testing.T) {
521 // A complex, representative settings.xml, not a simplified fixture:
522 // proves the byte-for-byte merge survives that complexity untouched.
523 t.Setenv("HOME", t.TempDir())
524 t.Setenv("MAVEN_ARGS", "")
525 userPath := writeUserSettings(t, complexSettingsXML)
527 r := mavenSettingsFor(t, []string{"-s", userPath, "verify"})
529 assertFirewallProxyActive(t, r.settings, "52999")
530 assert.Contains(t, r.settings, "nexus.example-corp.internal",
531 "the mirror, profile, and deploy-repository properties must survive the merge")
532 assert.Contains(t, r.settings, "<pluginRepositories>",
533 "pluginRepositories is not a <proxies> sibling the merge should touch, and must pass through untouched")
534 assertFirewallSettingsWin(t, r, userPath)
535 })
536}
Diagnostics7 git calls · 325 ms
CallStatusSizeTime0325 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 KiB2 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=1 git.response.bytes=59849 git.response.cache=UPDATING 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
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=3 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
fetchcombine:blob:none+tree:2 · deepen 12004.2 KiB · hit4 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=4 git.response.bytes=4273 git.response.cache=HIT git.response.duration_ms=4 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:0200361 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=361 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=tree:0 git.fetch.wants=506cba622ceda1473ee3cde63969809c144b7247 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=361 git.pkt.payload.max=334 git.sideband.band1.bytes=334 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=334 git.pack.trailer=26d32585a3a474717e00a318584ccd16918c9d32Open pack map
fetchtree:02001.3 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=1327 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=tree:0 git.fetch.wants=2758711b27b3e124482ce287b5df86092bb20d62 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=1327 git.pkt.payload.max=1300 git.sideband.band1.bytes=1300 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=1300 git.pack.trailer=c83fc6004a9a1360845513c0fb16272b5c14a3e4Open pack map
fetch2005.1 KiB315 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=315 git.response.bytes=5190 git.response.cache=MISS git.response.duration_ms=315 git.fetch.wants=31aca00ba6dc320149ec50ff8496ec5a92071180 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=5190 git.pkt.payload.max=5163 git.sideband.band1.bytes=5163 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
- a5e1bb7e6fc56c75
- Request
- b3c7f6ed…
- 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