GitLabgitlab-org

cli

main
ply8 git calls208 ms102 KiB6 cachedprotocol v2
485 lines16 KiBRaw
1package clone
3import (
4 "errors"
5 "fmt"
6 "path/filepath"
7 "slices"
8 "strconv"
9 "strings"
11 "github.com/MakeNowJust/heredoc/v2"
12 "github.com/spf13/cobra"
13 "github.com/spf13/pflag"
15 gitlab "gitlab.com/gitlab-org/api/client-go/v3"
17 "gitlab.com/gitlab-org/cli/internal/api"
18 "gitlab.com/gitlab-org/cli/internal/cmdutils"
19 "gitlab.com/gitlab-org/cli/internal/config"
20 "gitlab.com/gitlab-org/cli/internal/dbg"
21 "gitlab.com/gitlab-org/cli/internal/git"
22 "gitlab.com/gitlab-org/cli/internal/glrepo"
23 "gitlab.com/gitlab-org/cli/internal/iostreams"
24 "gitlab.com/gitlab-org/cli/internal/mcpannotations"
27type options struct {
28 groupName string
29 includeSubgroups bool
30 excludeSubgroups []string
31 preserveNamespace bool
32 withMREnabled bool
33 withIssuesEnabled bool
34 withShared bool
35 archived bool
36 archivedSet bool
37 active bool
38 activeSet bool
39 visibility string
40 owned bool
41 gitFlags []string
42 dir string
43 host string
44 protocol string
45 wiki bool
47 page int
48 perPage int
49 paginate bool
51 io *iostreams.IOStreams
52 apiClient *api.Client
54 currentUser *gitlab.User
57type ContextOpts struct {
58 Project *gitlab.Project
59 Repo string
60 repo glrepo.Interface
63func NewCmdClone(f cmdutils.Factory, runE func(*options, *ContextOpts) error) *cobra.Command {
64 opts := &options{
65 gitFlags: []string{},
66 io: f.IO(),
67 }
69 ctxOpts := &ContextOpts{}
71 repoCloneCmd := &cobra.Command{
72 Use: `clone [<repo> | -g <group>] [<dir>] [flags] [-- <gitflags>...]`,
73 Short: `Clone a GitLab repository or project.`,
74 Example: heredoc.Doc(`
75 # Clones repository into current directory
76 glab repo clone gitlab-org/cli
77 glab repo clone https://gitlab.com/gitlab-org/cli
79 # Clones repository into 'mydirectory'
80 glab repo clone gitlab-org/cli mydirectory
82 # Clones a project's wiki repository
83 glab repo clone --wiki gitlab-org/cli
85 # Clones repository 'glab' for current user
86 glab repo clone glab
88 # Finds the project by the ID provided and clones it
89 glab repo clone 4356677
91 # Clones a specific branch
92 glab repo clone gitlab-org/cli -- --branch development
94 # Clones with a shallow clone (depth 1)
95 glab repo clone gitlab-org/cli -- --depth 1
97 # Clones with multiple Git flags
98 glab repo clone gitlab-org/cli -- --branch main --single-branch --depth 1
100 # Clones all repos in a group
101 glab repo clone -g everyonecancontribute --paginate
103 # Clones all repos in a group, except those in one subgroup
104 glab repo clone -g mygroup --exclude-subgroup domain/backend --paginate
106 # Clones all non-archived repos in a group
107 glab repo clone -g everyonecancontribute --archived=false --paginate
109 # Clones only active projects in a group
110 glab repo clone -g everyonecancontribute --active=true --paginate
112 # Clones from a GitLab Self-Managed or GitLab Dedicated instance
113 GITLAB_HOST=salsa.debian.org glab repo clone myrepo`),
114 Long: heredoc.Docf(`
115 Clone a GitLab repository to your local machine. Specify the
116 repository by name, namespace/repo path, full URL, or project ID.
118 The command uses your configured protocol (SSH or HTTPS).
120 To pass Git clone flags, add them after %[1]s--%[1]s. For example:
121 %[1]sglab repo clone <repo> -- --branch <branch-name>%[1]s
123 When you clone a fork you own, the command adds an %[1]supstream%[1]s
124 remote that points to the parent project.
126 Use %[1]s--wiki%[1]s to clone the wiki repository associated with a project.
127 `, "`"),
128 Annotations: map[string]string{
129 mcpannotations.Destructive: "true",
130 },
131 RunE: func(cmd *cobra.Command, args []string) error {
132 // Move arguments after "--" to gitFlags
133 if dashPos := cmd.ArgsLenAtDash(); dashPos != -1 {
134 opts.gitFlags = args[dashPos:]
135 args = args[:dashPos]
136 }
137 dbg.Debug("Args:", strings.Join(args, " "))
138 dbg.Debug("GitFlags:", strings.Join(opts.gitFlags, " "))
139 if nArgs := len(args); nArgs > 0 {
140 if opts.groupName != "" {
141 opts.dir = args[0]
142 } else {
143 ctxOpts.Repo = args[0]
144 if nArgs > 1 {
145 opts.dir = args[1]
146 }
147 }
148 }
149 dbg.Debug("Dir:", opts.dir)
151 if ctxOpts.Repo == "" && opts.groupName == "" {
152 return &cmdutils.FlagError{Err: errors.New("specify repository argument, or use the --group flag to specify a group to clone all repos from the group")}
153 }
155 opts.archivedSet = cmd.Flags().Changed("archived")
156 opts.activeSet = cmd.Flags().Changed("active")
158 if runE != nil {
159 return runE(opts, ctxOpts)
160 }
162 cfg := f.Config()
163 opts.host = f.DefaultHostname()
165 // A full URL is handed to git as-is, so a plain clone needs no API
166 // client or authenticated user. Only --wiki resolves the repository
167 // through the API: it builds a client for the URL's host, which sends
168 // a configured or GITLAB_TOKEN credential to that host, the same as
169 // --wiki with -R <url>.
170 switch {
171 case git.IsValidURL(ctxOpts.Repo):
172 if opts.wiki {
173 repo, err := cloneRepo(ctxOpts.Repo, opts.host, cfg)
174 if err != nil {
175 return err
176 }
177 opts.host = repo.RepoHost()
178 ctxOpts.repo = repo
180 apiClient, err := f.ApiClient(opts.host)
181 if err != nil {
182 return err
183 }
184 opts.apiClient = apiClient
185 }
186 default:
187 apiClient, err := f.ApiClient(opts.host)
188 if err != nil {
189 return err
190 }
191 opts.apiClient = apiClient
193 opts.currentUser, _, err = apiClient.Lab().Users.CurrentUser()
194 if err != nil {
195 return err
196 }
197 }
199 opts.protocol, _ = cfg.Get(opts.host, "git_protocol")
201 if opts.groupName != "" {
202 return groupClone(opts, ctxOpts)
203 }
205 return cloneRun(opts, ctxOpts)
206 },
207 }
209 repoCloneCmd.Flags().StringVarP(&opts.groupName, "group", "g", "", "Specify the group to clone repositories from.")
210 repoCloneCmd.Flags().BoolVarP(&opts.preserveNamespace, "preserve-namespace", "p", false, "Clone the repository in a subdirectory based on namespace.")
211 repoCloneCmd.Flags().BoolVarP(&opts.active, "active", "", false, "Limit by project status. When true, returns active projects. When false, returns projects that are archived or marked for deletion. Used with the --group flag.")
212 repoCloneCmd.Flags().BoolVarP(&opts.archived, "archived", "a", false, "Limit by archived status. Use with '-a=false' to exclude archived repositories. Used with the --group flag.")
213 repoCloneCmd.Flags().BoolVarP(&opts.includeSubgroups, "include-subgroups", "G", true, "Include projects in subgroups of this group. Default is true. Used with the --group flag.")
214 repoCloneCmd.Flags().StringSliceVar(&opts.excludeSubgroups, "exclude-subgroup", nil, "Skip projects in this subgroup, as a path relative to the group, not a numeric ID. Repeat the flag, or separate values with commas, to skip more than one. Projects shared from other namespaces are not affected. Used with the --group flag.")
215 repoCloneCmd.Flags().BoolVarP(&opts.owned, "mine", "m", false, "Limit by projects in the group owned by the current authenticated user. Used with the --group flag.")
216 repoCloneCmd.Flags().StringVarP(&opts.visibility, "visibility", "v", "", "Limit by visibility: public, internal, private. Used with the --group flag.")
217 repoCloneCmd.Flags().BoolVarP(&opts.withIssuesEnabled, "with-issues-enabled", "I", false, "Limit by projects with the issues feature enabled. Default is false. Used with the --group flag.")
218 repoCloneCmd.Flags().BoolVarP(&opts.withMREnabled, "with-mr-enabled", "M", false, "Limit by projects with the merge request feature enabled. Default is false. Used with the --group flag.")
219 repoCloneCmd.Flags().BoolVarP(&opts.withShared, "with-shared", "S", true, "Include projects shared to this group. Default is true. Used with the --group flag.")
220 repoCloneCmd.Flags().BoolVarP(&opts.paginate, "paginate", "", false, "Make additional HTTP requests to fetch all pages of projects before cloning. Respects --per-page.")
221 repoCloneCmd.Flags().IntVarP(&opts.page, "page", "", 1, "Page number.")
222 repoCloneCmd.Flags().IntVarP(&opts.perPage, "per-page", "", 30, "Number of items to list per page.")
223 repoCloneCmd.Flags().BoolVarP(&opts.wiki, "wiki", "", false, "Clone the project's wiki repository.")
224 repoCloneCmd.MarkFlagsMutuallyExclusive("group", "wiki")
226 repoCloneCmd.Flags().SortFlags = false
227 repoCloneCmd.SetFlagErrorFunc(func(cmd *cobra.Command, err error) error {
228 if errors.Is(err, pflag.ErrHelp) {
229 return err
230 }
231 return &cmdutils.FlagError{Err: fmt.Errorf("%w\nseparate Git clone flags with '--'", err)}
232 })
234 return repoCloneCmd
237// cloneRepo parses a full URL argument into a repository. The result carries
238// both the URL's own host (so cloning from another instance does not target the
239// default one) and its project path with any configured subfolder stripped, so
240// a --wiki lookup reuses that path instead of parsing the URL a second time.
241func cloneRepo(repoArg, defaultHost string, cfg config.Config) (glrepo.Interface, error) {
242 u, err := git.ParseURL(repoArg)
243 if err != nil {
244 return nil, fmt.Errorf("invalid argument: %w", err)
245 }
246 repo, err := glrepo.FromURL(u, defaultHost, cfg)
247 if err != nil {
248 return nil, fmt.Errorf("invalid argument: %w", err)
249 }
250 return repo, nil
253// wikiProjectPath is the namespace/repo the wiki lookup queries. A full URL is
254// parsed once in RunE, so its path already has any configured subfolder
255// stripped; FullNameFromURL does not strip it, so it is only a fallback for
256// callers that reach cloneRun without a pre-parsed repository.
257func wikiProjectPath(ctxOpts *ContextOpts) (string, error) {
258 if ctxOpts.repo != nil {
259 return ctxOpts.repo.FullName(), nil
260 }
261 return glrepo.FullNameFromURL(ctxOpts.Repo)
264func groupClone(opts *options, ctxOpts *ContextOpts) error {
265 c := opts.io.Color()
266 listOpts := &gitlab.ListGroupProjectsOptions{}
267 if !opts.withShared {
268 listOpts.WithShared = new(false)
269 }
270 if opts.withMREnabled {
271 listOpts.WithMergeRequestsEnabled = new(true)
272 }
273 if opts.withIssuesEnabled {
274 listOpts.WithIssuesEnabled = new(true)
275 }
276 if opts.owned {
277 listOpts.Owned = new(true)
278 }
279 if opts.activeSet {
280 listOpts.Active = new(opts.active)
281 }
282 if opts.archivedSet {
283 listOpts.Archived = new(opts.archived)
284 }
285 if opts.includeSubgroups {
286 includeSubGroups := true
287 listOpts.IncludeSubGroups = &includeSubGroups
288 }
289 if opts.visibility != "" {
290 listOpts.Visibility = new(gitlab.VisibilityValue(opts.visibility))
291 }
293 listOpts.PerPage = 100
294 if opts.paginate {
295 listOpts.PerPage = 30
296 }
297 if opts.perPage != 0 {
298 listOpts.PerPage = int64(opts.perPage)
299 }
300 if opts.page != 0 {
301 listOpts.Page = int64(opts.page)
302 }
304 groupPath := opts.groupName
305 if _, parseErr := strconv.ParseInt(opts.groupName, 10, 64); parseErr == nil && len(opts.excludeSubgroups) > 0 {
306 group, _, err := opts.apiClient.Lab().Groups.GetGroup(opts.groupName, nil)
307 if err != nil {
308 return err
309 }
310 groupPath = group.FullPath
311 }
313 var projects []*gitlab.Project
314 var err error
315 if opts.paginate {
316 projects, err = gitlab.ScanAndCollect(func(p gitlab.PaginationOptionFunc) ([]*gitlab.Project, *gitlab.Response, error) {
317 return opts.apiClient.Lab().Groups.ListGroupProjects(opts.groupName, listOpts, p)
318 })
319 } else {
320 projects, _, err = opts.apiClient.Lab().Groups.ListGroupProjects(opts.groupName, listOpts)
321 }
322 if err != nil {
323 return err
324 }
325 if len(projects) == 0 {
326 opts.io.LogErrorf("Group %q does not have any projects.\n", opts.groupName)
327 return cmdutils.SilentError
328 }
330 if len(opts.excludeSubgroups) > 0 {
331 projects = slices.DeleteFunc(projects, func(p *gitlab.Project) bool {
332 return isExcludedSubgroup(p.PathWithNamespace, groupPath, opts.excludeSubgroups)
333 })
334 if len(projects) == 0 {
335 opts.io.LogErrorf("No projects left to clone in group %q after applying --exclude-subgroup.\n", opts.groupName)
336 return cmdutils.SilentError
337 }
338 }
340 var finalOutput []string
341 for _, project := range projects {
342 ctxOpt := *ctxOpts
343 ctxOpt.Project = project
344 ctxOpt.Repo = project.PathWithNamespace
345 err = cloneRun(opts, &ctxOpt)
346 if err != nil {
347 finalOutput = append(finalOutput, fmt.Sprintf("%s %s - Error: %q", c.RedCheck(), project.PathWithNamespace, err.Error()))
348 } else {
349 finalOutput = append(finalOutput, fmt.Sprintf("%s %s", c.GreenCheck(), project.PathWithNamespace))
350 }
351 }
353 // Print error/success msgs in human-readable formats
354 for _, out := range finalOutput {
355 opts.io.LogInfo(out)
356 }
357 if err != nil { // if any error came up
358 return cmdutils.SilentError
359 }
360 return nil
363func validateAPIPath(p string) error {
364 if p == "" || strings.HasPrefix(p, "/") || strings.HasPrefix(p, "-") || strings.ContainsAny(p, `\:`) {
365 return fmt.Errorf("invalid project path %q", p)
366 }
367 for seg := range strings.SplitSeq(p, "/") {
368 if seg == "" || seg == "." || seg == ".." {
369 return fmt.Errorf("invalid project path %q", p)
370 }
371 }
372 return nil
375func isExcludedSubgroup(pathWithNamespace, groupPath string, excludes []string) bool {
376 projectPath := strings.ToLower(pathWithNamespace)
377 groupPrefix := strings.ToLower(strings.Trim(groupPath, "/")) + "/"
378 for _, exclude := range excludes {
379 exclude = strings.ToLower(strings.Trim(exclude, "/"))
380 if exclude == "" {
381 continue
382 }
383 fullPath := exclude
384 if !strings.HasPrefix(exclude, groupPrefix) {
385 fullPath = groupPrefix + exclude
386 }
387 if projectPath == fullPath || strings.HasPrefix(projectPath, fullPath+"/") {
388 return true
389 }
390 }
391 return false
394func cloneRun(opts *options, ctxOpts *ContextOpts) error {
395 localDir := opts.dir
396 if !git.IsValidURL(ctxOpts.Repo) {
397 // Assuming that repo is a project ID if it is an integer
398 if _, err := strconv.ParseInt(ctxOpts.Repo, 10, 64); err != nil {
399 // Assuming that "/" in the project name means its owned by an organisation
400 if !strings.Contains(ctxOpts.Repo, "/") {
401 ctxOpts.Repo = fmt.Sprintf("%s/%s", opts.currentUser.Username, ctxOpts.Repo)
402 }
403 }
404 if ctxOpts.Project == nil {
405 p, err := api.GetProject(opts.apiClient.Lab(), ctxOpts.Repo)
406 if err != nil {
407 return err
408 }
409 ctxOpts.Project = p
410 }
411 repoURL, err := glrepo.RemoteURL(ctxOpts.Project, opts.protocol)
412 if err != nil {
413 return err
414 }
415 ctxOpts.Repo = repoURL
416 if opts.preserveNamespace {
417 if err := validateAPIPath(ctxOpts.Project.PathWithNamespace); err != nil {
418 return err
419 }
420 localDir = filepath.Join(opts.dir, filepath.FromSlash(ctxOpts.Project.PathWithNamespace))
421 } else if opts.dir != "" && opts.groupName != "" {
422 if err := validateAPIPath(ctxOpts.Project.Path); err != nil {
423 return err
424 }
425 localDir = filepath.Join(opts.dir, ctxOpts.Project.Path)
426 }
427 } else if !strings.HasSuffix(ctxOpts.Repo, ".git") {
428 ctxOpts.Repo += ".git"
429 }
430 if opts.wiki {
431 if ctxOpts.Project == nil {
432 projectPath, err := wikiProjectPath(ctxOpts)
433 if err != nil {
434 return err
435 }
436 ctxOpts.Project, err = api.GetProject(opts.apiClient.Lab(), projectPath)
437 if err != nil {
438 return err
439 }
440 }
441 if ctxOpts.Project.WikiAccessLevel == gitlab.DisabledAccessControl {
442 return fmt.Errorf("wiki is not enabled for %s", ctxOpts.Project.PathWithNamespace)
443 }
444 wikiURL, err := glrepo.WikiRemoteURL(ctxOpts.Project, opts.protocol)
445 if err != nil {
446 return err
447 }
448 ctxOpts.Repo = wikiURL
449 }
450 isUserFork := ctxOpts.Project != nil && ctxOpts.Project.ForkedFromProject != nil &&
451 opts.currentUser != nil &&
452 strings.Contains(ctxOpts.Project.PathWithNamespace, opts.currentUser.Username)
453 if isUserFork && localDir == "" {
454 if err := validateAPIPath(ctxOpts.Project.Path); err != nil {
455 return err
456 }
457 }
458 _, err := git.RunClone(ctxOpts.Repo, localDir, opts.gitFlags)
459 if err != nil {
460 return err
461 }
462 // Cloned project was a fork belonging to the user; user is
463 // treating fork's ssh/https url as origin. Add upstream as remote pointing
464 // to forked repo's ssh/https url depending on the users preferred protocol
465 if ctxOpts.Project != nil {
466 if isUserFork {
467 if localDir == "" {
468 localDir = "./" + ctxOpts.Project.Path
469 }
470 fProject, err := api.GetProject(opts.apiClient.Lab(), ctxOpts.Project.ForkedFromProject.PathWithNamespace)
471 if err != nil {
472 return err
473 }
474 repoURL, err := glrepo.RemoteURL(fProject, opts.protocol)
475 if err != nil {
476 return err
477 }
478 err = git.AddUpstreamRemote(repoURL, localDir)
479 if err != nil {
480 return err
481 }
482 }
483 }
484 return nil
Diagnostics8 git calls · 208 ms
CallStatusSizeTime0208 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=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: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=eb8250f8e8340ff2fafc22c5aba90db34fd906a9
Open pack map
fetchtree:0200179 B · hit6 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=6
git.response.bytes=179
git.response.cache=HIT
git.response.duration_ms=6
git.fetch.filter=tree:0
git.fetch.wants=157370d354379c59ce19f23f16d03a4e5a5fab91
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=179
git.pkt.payload.max=152
git.sideband.band1.bytes=152
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=152
git.pack.trailer=9d92c3ecac1aa3febd9d2b53a59a0ae7785a4a68
Open pack map
fetch2004.9 KiB194 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=193
git.response.bytes=5041
git.response.cache=MISS
git.response.duration_ms=194
git.fetch.wants=9b9867913ab07854abf28fdc6ac6cd537aae01d2
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=5041
git.pkt.payload.max=5014
git.sideband.band1.bytes=5014
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
a5ea567c0b8b7089
Request
02b55ebb…
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