GitLabgitlab-org

cli

main
ply7 git calls212 ms102 KiB5 cachedprotocol v2
511 lines16 KiBRaw
1package pm
3import (
4 "encoding/xml"
5 "errors"
6 "fmt"
7 "io/fs"
8 "iter"
9 "net/url"
10 "os"
11 "path/filepath"
12 "regexp"
13 "runtime"
14 "slices"
15 "strconv"
16 "strings"
18 "gitlab.com/gitlab-org/cli/internal/dbg"
19 "gitlab.com/gitlab-org/cli/internal/dependencyfirewall/proxy"
22// mavenUserSettingsFile returns the settings.xml mvn would read, or "" when
23// there is none, following Maven's own precedence.
24func mavenUserSettingsFile(environ []string, dir string, args []string) string {
25 cli := append(strings.Fields(lookupEnv(environ, "MAVEN_ARGS")), args...)
26 cli = append(cli, mavenConfigArgs(dir)...)
28 if path, ok := mavenOption(cli, "-s", "--settings", true); ok {
29 if path == "" {
30 return ""
31 }
32 if !filepath.IsAbs(path) {
33 path = filepath.Join(dir, path)
34 }
35 return path
36 }
38 home := javaUserHome(environ, mavenProperties(environ, cli))
39 if home == "" {
40 return ""
41 }
42 return filepath.Join(home, ".m2", "settings.xml")
45// mavenSystemRCFiles are the rc files Maven's Unix launcher sources from
46// fixed paths, unless MAVEN_SKIP_RC is set.
47var mavenSystemRCFiles = []string{"/usr/local/etc/mavenrc", "/etc/mavenrc"}
49// mavenGlobalSettingsFile returns the global settings.xml the caller means
50// mvn to read: an explicit -gs or --global-settings, found the way -s is, or
51// else the conf/settings.xml of the install that mvnPath, the resolved mvn
52// binary, belongs to. glab then hands Maven that file with its own -gs, so an
53// error here means the caller's choice is unclear, or the launcher could put
54// a -gs ahead of glab's.
55func mavenGlobalSettingsFile(environ []string, dir string, args []string, mvnPath string) (string, error) {
56 if mvnPath == "" {
57 return "", errors.New("mvn not found")
58 }
59 home, rcFiles, err := mavenHome(mvnPath)
60 if err != nil {
61 return "", err
62 }
63 if err := mavenRCOverride(environ, rcFiles); err != nil {
64 return "", err
65 }
66 cli := append(strings.Fields(lookupEnv(environ, "MAVEN_ARGS")), args...)
67 cli = append(cli, mavenConfigArgs(dir)...)
68 // The launcher then reads .mvn/maven.config from a directory glab doesn't.
69 if lookupEnv(environ, "MAVEN_BASEDIR") != "" || slices.Contains(cli, "-f") || slices.Contains(cli, "--file") {
70 return "", errors.New("mvn may use another project base directory")
71 }
72 // Maven strips the quotes around an argument, so glab could miss a -gs.
73 if slices.ContainsFunc(cli, func(a string) bool { return strings.ContainsAny(a, `"'`) }) {
74 return "", errors.New("quoted maven arguments")
75 }
76 if path, ok := mavenOption(cli, "-gs", "--global-settings", false); ok {
77 if path == "" {
78 return "", errors.New("empty -gs value")
79 }
80 if !filepath.IsAbs(path) {
81 path = filepath.Join(dir, path)
82 }
83 // Maven fails on a -gs file that doesn't exist, and should say so.
84 if _, err := os.Stat(path); errors.Is(err, fs.ErrNotExist) {
85 return "", errors.New("the -gs file doesn't exist")
86 }
87 return path, nil
88 }
89 // Pinning the install's settings would override a conf directory the
90 // caller moved.
91 if mavenConfMoved(environ, mavenProjectBaseDir(dir), cli) {
92 return "", errors.New("maven.conf is set")
93 }
94 return filepath.Join(home, "conf", "settings.xml"), nil
97// mavenConfMoved reports whether the JVM options, the Maven arguments or the
98// project's .mvn/jvm.config set maven.conf. It keeps such a build as it was
99// rather than guarding the firewall: Maven reads glab's -gs either way.
100func mavenConfMoved(environ []string, base string, cli []string) bool {
101 jvm, _, err := readConfigFile(filepath.Join(base, ".mvn", "jvm.config"))
102 if err != nil {
103 dbg.Debugf("dependency firewall: %v; not checking it for maven.conf", err)
104 }
105 sources := append([]string{string(jvm)}, cli...)
106 for _, name := range []string{"MAVEN_OPTS", "MAVEN_DEBUG_OPTS", "JAVA_TOOL_OPTIONS", "JDK_JAVA_OPTIONS", "_JAVA_OPTIONS"} {
107 sources = append(sources, lookupEnv(environ, name))
108 }
109 return slices.ContainsFunc(sources, mavenConfOption)
112// mavenConfOption reports whether options set the maven.conf property. The
113// JVM drops quotes inside an option, so they're dropped here too.
114func mavenConfOption(options string) bool {
115 options = strings.NewReplacer(`"`, "", `'`, "").Replace(options)
116 return slices.ContainsFunc(strings.Fields(options), mavenConfProperty.MatchString)
119// mavenConfProperty matches -Dmaven.conf=x, --define=maven.conf=x, and
120// maven.conf=x after a separate -D.
121var mavenConfProperty = regexp.MustCompile(`^(?:-D|--define=)?maven\.conf(?:=|$)`)
123// mavenProjectBaseDir returns the nearest ancestor of dir with a .mvn
124// directory, or dir when there is none.
125func mavenProjectBaseDir(dir string) string {
126 for d := range ancestors(dir) {
127 if isDir(filepath.Join(d, ".mvn")) {
128 return d
129 }
130 }
131 return dir
134// mavenHome returns the Maven 3 install that mvnPath launches, which has
135// bin/m2.conf, and the fixed-path rc files its launcher sources. Homebrew's
136// mvn is a wrapper that runs libexec/bin/mvn, patched to source Homebrew's
137// own etc/mavenrc.
138func mavenHome(mvnPath string) (string, []string, error) {
139 resolved, err := filepath.EvalSymlinks(mvnPath)
140 if err != nil {
141 return "", nil, err
142 }
143 home := filepath.Dir(filepath.Dir(resolved))
144 rcFiles := mavenSystemRCFiles
145 if !exists(filepath.Join(home, "bin", "m2.conf")) {
146 brew := filepath.Join(home, "libexec")
147 if !exists(filepath.Join(brew, "bin", "m2.conf")) {
148 return "", nil, errors.New("the mvn on PATH isn't in a Maven installation")
149 }
150 // <prefix>/Cellar/maven/<version>/libexec
151 prefix := filepath.Dir(filepath.Dir(filepath.Dir(home)))
152 rcFiles = append(slices.Clone(rcFiles), filepath.Join(prefix, "etc", "mavenrc"))
153 home = brew
154 }
155 if err := mavenCheckInstall(home); err != nil {
156 return "", nil, err
157 }
158 return home, rcFiles, nil
161var mavenCoreJar = regexp.MustCompile(`^maven-core-3\.(\d+)\..*\.jar$`)
163// mavenCheckInstall returns an error unless home is Maven 3.9 or a later 3.x,
164// whose launcher passes MAVEN_ARGS on, and its bin/m2.conf keeps maven.conf
165// at the default. Maven 4 also reads project and installation settings.
166func mavenCheckInstall(home string) error {
167 entries, err := os.ReadDir(filepath.Join(home, "lib"))
168 if err != nil {
169 return err
170 }
171 if !slices.ContainsFunc(entries, func(e fs.DirEntry) bool {
172 m := mavenCoreJar.FindStringSubmatch(e.Name())
173 if len(m) != 2 {
174 return false
175 }
176 minor, err := strconv.Atoi(m[1])
177 return err == nil && minor >= 9
178 }) {
179 return errors.New("the mvn on PATH isn't Maven 3.9 or a later 3.x")
180 }
181 m2, err := os.ReadFile(filepath.Join(home, "bin", "m2.conf"))
182 if err != nil {
183 return err
184 }
185 for line := range strings.SplitSeq(string(m2), "\n") {
186 f := strings.Fields(line)
187 if len(f) > 0 && f[0] == "set" && !slices.Equal(f, []string{"set", "maven.conf", "default", "${maven.home}/conf"}) {
188 return errors.New("the install's bin/m2.conf changes its properties")
189 }
190 }
191 return nil
194// mavenRCOverride returns an error when an rc file mvn's launcher runs could
195// change the arguments glab passes it. Shell rc files are read; a Windows
196// one counts whenever it exists.
197func mavenRCOverride(environ []string, rcFiles []string) error {
198 if lookupEnv(environ, "MAVEN_SKIP_RC") != "" {
199 return nil
200 }
201 // The launcher reads "$HOME/.mavenrc", which is /.mavenrc without HOME.
202 for _, rc := range append(slices.Clone(rcFiles), lookupEnv(environ, "HOME")+"/.mavenrc") {
203 if err := mavenShellRCOverride(rc); err != nil {
204 return err
205 }
206 }
207 if profile := lookupEnv(environ, "USERPROFILE"); profile != "" {
208 for _, name := range []string{"mavenrc_pre.bat", "mavenrc_pre.cmd"} {
209 if rc := filepath.Join(profile, name); exists(rc) {
210 return fmt.Errorf("mvn runs %s", rc)
211 }
212 }
213 }
214 return nil
217// mavenRCAssignment matches an rc file line that sets M2_HOME, which the
218// launcher ignores, JAVA_HOME or MAVEN_OPTS to a literal value.
219var mavenRCAssignment = regexp.MustCompile(`^(?:export\s+)?(?:M2_HOME|JAVA_HOME|MAVEN_OPTS)=(?:"[^"$` + "`" + `\\]*"|'[^']*'|[^\s"'$` + "`" + `\\;&|<>(){}]*)$`)
221// mavenShellRCOverride returns an error when the shell rc file at path exists
222// and does more than mavenRCAssignment allows. Alpine's package ships an
223// /etc/mavenrc that only sets M2_HOME.
224func mavenShellRCOverride(path string) error {
225 data, ok, err := readConfigFile(path)
226 if err != nil {
227 return err
228 }
229 if !ok {
230 return nil
231 }
232 for line := range strings.SplitSeq(string(data), "\n") {
233 line = strings.TrimSpace(line)
234 if line == "" || strings.HasPrefix(line, "#") {
235 continue
236 }
237 if _, value, _ := strings.Cut(line, "="); !mavenRCAssignment.MatchString(line) || mavenConfOption(value) {
238 return fmt.Errorf("mvn sources %s, which could change its arguments", path)
239 }
240 }
241 return nil
244// mavenMirror is a <mirror> entry from a settings file.
245type mavenMirror struct {
246 id, url, mirrorOf, layouts string
247 blocked bool
250// mavenMirrorsIn returns the <mirror> entries of a settings document, in order.
251func mavenMirrorsIn(raw []byte) ([]mavenMirror, error) {
252 var doc struct {
253 Mirrors []struct {
254 ID *string `xml:"id"`
255 URL string `xml:"url"`
256 MirrorOf string `xml:"mirrorOf"`
257 Layouts string `xml:"mirrorOfLayouts"`
258 Blocked string `xml:"blocked"`
259 } `xml:"mirrors>mirror"`
260 }
261 if err := xml.Unmarshal(raw, &doc); err != nil {
262 return nil, err
263 }
264 mirrors := make([]mavenMirror, 0, len(doc.Mirrors))
265 for _, m := range doc.Mirrors {
266 // Maven's id for a mirror without an <id>.
267 id := "default"
268 if m.ID != nil {
269 id = strings.TrimSpace(*m.ID)
270 }
271 mirrors = append(mirrors, mavenMirror{
272 id: id,
273 url: strings.TrimSpace(m.URL),
274 mirrorOf: strings.TrimSpace(m.MirrorOf),
275 layouts: strings.TrimSpace(m.Layouts),
276 blocked: strings.EqualFold(strings.TrimSpace(m.Blocked), "true"),
277 })
278 }
279 return mirrors, nil
282// mavenMirrorsDefaultLayout reports whether a mirror's mirrorOfLayouts
283// covers the default repository layout, as DefaultMirrorSelector.matchesType
284// decides it.
285func mavenMirrorsDefaultLayout(layouts string) bool {
286 if layouts == "" || layouts == "*" || layouts == "default" {
287 return true
288 }
289 covered := false
290 for layout := range strings.SplitSeq(layouts, ",") {
291 switch layout {
292 case "!default":
293 return false
294 case "default":
295 return true
296 case "*":
297 covered = true
298 }
299 }
300 return covered
303// mavenKnownMirrors returns the URLs of every mirror in the user and global
304// settings when one of them is a catch-all, so that every repository download
305// goes through a URL in the list. Maven picks a mirror whose mirrorOf names
306// the repository's id before trying patterns, so a mirror listed after the
307// catch-all can still be used: every mirror must be known, or ok is false.
308// externalOnly reports a catch-all of external:*, which Maven doesn't apply
309// to repositories on localhost.
310func mavenKnownMirrors(user, global []byte) ([]*url.URL, bool, bool) {
311 var mirrors []mavenMirror
312 for _, raw := range [][]byte{user, global} {
313 if raw == nil {
314 continue
315 }
316 ms, err := mavenMirrorsIn(raw)
317 if err != nil {
318 return nil, false, false
319 }
320 mirrors = append(mirrors, ms...)
321 }
322 var urls []*url.URL
323 seen := map[string]struct{}{}
324 catchAll, externalOnly := false, true
325 for _, m := range mirrors {
326 // Maven keeps the first mirror with each id, user settings first, and
327 // compares interpolated ids, so an id with ${ can't be matched here.
328 if strings.Contains(m.id, "${") {
329 return nil, false, false
330 }
331 _, dropped := seen[m.id]
332 seen[m.id] = struct{}{}
333 // Maven never contacts a blocked mirror.
334 if m.blocked {
335 continue
336 }
337 u, err := url.Parse(m.url)
338 if err != nil || strings.Contains(m.url, "${") || (u.Scheme != "http" && u.Scheme != "https") || u.Hostname() == "" {
339 return nil, false, false
340 }
341 // An extra URL only adds readings, so a mirror Maven drops stays known.
342 urls = append(urls, u)
343 // Maven doesn't mirror a repository whose layout the mirror leaves out.
344 if dropped || !mavenMirrorsDefaultLayout(m.layouts) {
345 continue
346 }
347 switch m.mirrorOf {
348 case "*":
349 catchAll, externalOnly = true, false
350 case "external:*":
351 // Local repositories bypass it, so a mirror on localhost shares
352 // its host with repositories it doesn't cover.
353 if !proxy.IsLoopbackHost(u.Hostname()) {
354 catchAll = true
355 }
356 }
357 }
358 if !catchAll {
359 return nil, false, false
360 }
361 return urls, externalOnly, true
364// mavenOption returns the value of the first short or long option in args,
365// in the forms commons-cli accepts: "-s file", "-s=file", "--settings file"
366// and "--settings=file", and "-sfile" when concatenated is set.
367func mavenOption(args []string, short, long string, concatenated bool) (string, bool) {
368 for i, a := range args {
369 switch {
370 case a == short || a == long:
371 if i+1 < len(args) {
372 return args[i+1], true
373 }
374 return "", false
375 case strings.HasPrefix(a, short+"="):
376 return a[len(short)+1:], true
377 case strings.HasPrefix(a, long+"="):
378 return a[len(long)+1:], true
379 case concatenated && len(a) > len(short) && strings.HasPrefix(a, short) && !strings.HasPrefix(a, "--"):
380 return a[len(short):], true
381 }
382 }
383 return "", false
386// mavenProperties returns the -D system properties from MAVEN_OPTS and the
387// Maven command line, which Maven applies last.
388func mavenProperties(environ []string, cli []string) map[string]string {
389 props := map[string]string{}
390 set := func(kv string) {
391 k, v, ok := strings.Cut(kv, "=")
392 if !ok {
393 v = "true"
394 }
395 props[k] = v
396 }
397 for a := range strings.FieldsSeq(lookupEnv(environ, "MAVEN_OPTS")) {
398 if kv, ok := strings.CutPrefix(a, "-D"); ok {
399 set(kv)
400 }
401 }
402 for i := 0; i < len(cli); i++ {
403 switch a := cli[i]; {
404 case (a == "-D" || a == "--define") && i+1 < len(cli):
405 i++
406 set(cli[i])
407 case strings.HasPrefix(a, "--define="):
408 set(a[len("--define="):])
409 case strings.HasPrefix(a, "-D") && len(a) > 2:
410 set(a[2:])
411 }
412 }
413 return props
416// mavenConfigArgs returns the arguments in the nearest ancestor .mvn/maven.config.
417func mavenConfigArgs(dir string) []string {
418 for d := range ancestors(dir) {
419 if !isDir(filepath.Join(d, ".mvn")) {
420 continue
421 }
422 data, ok, err := readConfigFile(filepath.Join(d, ".mvn", "maven.config"))
423 if err != nil {
424 dbg.Debugf("dependency firewall: %v; not merging .mvn/maven.config", err)
425 return nil
426 }
427 if !ok {
428 return nil
429 }
430 var args []string
431 for line := range strings.SplitSeq(string(data), "\n") {
432 // Maven skips a line that starts with #.
433 if strings.HasPrefix(line, "#") {
434 continue
435 }
436 if line = strings.TrimSpace(line); line != "" {
437 args = append(args, line)
438 }
439 }
440 return args
441 }
442 return nil
445// javaUserHome returns Java's user.home, which the JVM reads from the
446// password database rather than HOME.
447func javaUserHome(environ []string, props map[string]string) string {
448 if home, ok := props["user.home"]; ok {
449 return home
450 }
451 u, err := currentUser()
452 if err != nil {
453 dbg.Debugf("dependency firewall: could not look up the current user: %v; using HOME for maven's user.home", err)
454 } else if u.HomeDir != "" {
455 return u.HomeDir
456 }
457 return homeDir(environ)
460// readConfigFile returns path's contents, and false when it doesn't exist;
461// any other failure is an error rather than silent.
462func readConfigFile(path string) ([]byte, bool, error) {
463 data, err := os.ReadFile(path)
464 switch {
465 case err == nil:
466 return data, true, nil
467 case errors.Is(err, fs.ErrNotExist):
468 return nil, false, nil
469 default:
470 return nil, false, fmt.Errorf("failed to read %s: %w", path, err)
471 }
474func isDir(path string) bool {
475 info, err := os.Stat(path)
476 return err == nil && info.IsDir()
479// exists reports whether path may exist: only a not-exist error rules it out.
480func exists(path string) bool {
481 _, err := os.Stat(path)
482 return !errors.Is(err, fs.ErrNotExist)
485// ancestors yields dir and each of its parents up to the filesystem root.
486func ancestors(dir string) iter.Seq[string] {
487 return func(yield func(string) bool) {
488 for {
489 if !yield(dir) {
490 return
491 }
492 parent := filepath.Dir(dir)
493 if parent == dir {
494 return
495 }
496 dir = parent
497 }
498 }
501// homeDir returns the user's home directory as the package managers read it
502// from environ, or "" when environ does not name one.
503func homeDir(environ []string) string {
504 if home := lookupEnv(environ, "HOME"); home != "" {
505 return home
506 }
507 if runtime.GOOS == "windows" {
508 return lookupEnv(environ, "USERPROFILE")
509 }
510 return ""
Diagnostics7 git calls · 212 ms
CallStatusSizeTime0212 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 · 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=2
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=3
git.response.bytes=4273
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=combine:blob:none+tree:2
git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9
git.fetch.haves.count=0
git.fetch.deepen=1
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=7
git.pkt.data=5
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=4273
git.pkt.payload.max=4173
git.sideband.band1.bytes=4173
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=11
git.pack.bytes=4173
git.fetch.wide.objects=11
git.fetch.wide.extra_bytes=3930
git.fetch.wide.blobs=0
fetchtree:0 · deepen 1020032 KiB · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=32926
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=tree:0
git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=22
git.pkt.data=20
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=32926
git.pkt.payload.max=32046
git.sideband.band1.bytes=32046
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=80
git.pack.bytes=32046
git.pack.ofs_delta=36
git.pack.ref_delta=0
git.pack.chain.max=2
git.pack.trailer=cb0bad5d7ffc514895d8b21c4dd470327f90bc91
git.pack.full=44
Open pack map
fetchtree: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=26d32585a3a474717e00a318584ccd16918c9d32
Open pack map
fetchtree:02001.3 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=1327
git.response.cache=HIT
git.response.duration_ms=3
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=c83fc6004a9a1360845513c0fb16272b5c14a3e4
Open pack map
fetch2005.4 KiB196 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=195
git.response.bytes=5567
git.response.cache=MISS
git.response.duration_ms=196
git.fetch.wants=048a5934420aa0f1bbf8257f36380ead7eedcd74
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=5567
git.pkt.payload.max=5540
git.sideband.band1.bytes=5540
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
a5e2c7618c2b4afc
Request
c58636c0…
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