GitLabgitlab-org
cli
main
1package create
3import (
4 "context"
5 "errors"
6 "fmt"
7 "net/url"
8 "os"
9 "strconv"
10 "strings"
12 "charm.land/huh/v2"
13 "github.com/MakeNowJust/heredoc/v2"
14 "github.com/spf13/cobra"
16 gitlab "gitlab.com/gitlab-org/api/client-go/v3"
18 "gitlab.com/gitlab-org/cli/internal/api"
19 "gitlab.com/gitlab-org/cli/internal/cmdutils"
20 "gitlab.com/gitlab-org/cli/internal/commands/issue/issueutils"
21 "gitlab.com/gitlab-org/cli/internal/config"
22 "gitlab.com/gitlab-org/cli/internal/glrepo"
23 "gitlab.com/gitlab-org/cli/internal/iostreams"
24 "gitlab.com/gitlab-org/cli/internal/mcpannotations"
25 "gitlab.com/gitlab-org/cli/internal/recovery"
26 "gitlab.com/gitlab-org/cli/internal/text"
27 "gitlab.com/gitlab-org/cli/internal/utils"
28)
30var createIssue = func(client *gitlab.Client, projectID any, opts *gitlab.CreateIssueOptions) (*gitlab.Issue, error) {
31 issue, _, err := client.Issues.CreateIssue(projectID, opts)
32 if err != nil {
33 return nil, err
34 }
36 return issue, nil
37}
39type options struct {
40 Title string `json:"title,omitempty"`
41 Description string `json:"description,omitempty"`
42 Attach []string `json:"attach,omitempty"`
43 Labels []string `json:"labels,omitempty"`
44 Assignees []string `json:"assignees,omitempty"`
46 Weight int64 `json:"weight,omitempty"`
47 Milestone int64 `json:"milestone,omitempty"`
48 LinkedMR int64 `json:"linked_mr,omitempty"`
49 LinkedIssues []int `json:"linked_issues,omitempty"`
50 IssueLinkType string `json:"issue_link_type,omitempty"`
51 TimeEstimate string `json:"time_estimate,omitempty"`
52 TimeSpent string `json:"time_spent,omitempty"`
53 EpicID int64 `json:"epic_id,omitempty"`
54 DueDate string `json:"due_date,omitempty"`
56 MilestoneFlag string `json:"milestone_flag"`
58 IsConfidential bool `json:"is_confidential,omitempty"`
60 Template string `json:"template,omitempty"`
62 // Unexported, so a recovery file keeps the description the user wrote.
63 body string
65 noEditor bool
66 needsPrompt bool
67 yes bool
68 web bool
69 recover bool
71 io *iostreams.IOStreams
72 baseRepo func() (glrepo.Interface, error)
73 gitlabClient func() (*gitlab.Client, error)
74 remotes func() (glrepo.Remotes, error)
75 config func() config.Config
77 baseProject *gitlab.Project
78}
80func NewCmdCreate(f cmdutils.Factory) *cobra.Command {
81 opts := &options{
82 io: f.IO(),
83 baseRepo: f.BaseRepo,
84 gitlabClient: f.GitLabClient,
85 remotes: f.Remotes,
86 config: f.Config,
87 }
88 issueCreateCmd := &cobra.Command{
89 Use: "create [flags]",
90 Short: `Create an issue.`,
91 Long: heredoc.Docf(`
92 Opens an editor to draft the issue unless you pass a title and
93 description. Use %[1]s--web%[1]s to create the issue in your browser, or
94 %[1]s--template%[1]s to start from an issue template.
96 %[1]s--attach%[1]s uploads a file and references it at the end of the description. Repeat the flag for more than one file, or pass %[1]s-%[1]s to read the file from standard input. An attachment satisfies the description requirement, so %[1]s--title%[1]s with %[1]s--attach%[1]s completes without prompting.
97 %[2]s
98 The %[1]s--recover%[1]s flag is an experiment: it might be unstable or
99 removed at any time, and is not ready for production use. For more
100 information, see
101 https://docs.gitlab.com/policy/development_stages_support/.
102 `, "`", fmt.Sprintf(text.ExperimentalFlagString, "`--attach`")),
103 Aliases: []string{"new"},
104 Example: heredoc.Doc(`
105 glab issue create
106 glab issue new
107 glab issue create -m release-2.0.0 -t "we need this feature" --label important
108 glab issue new -t "Fix CVE-YYYY-XXXX" -l security --linked-mr 123
109 glab issue create -m release-1.0.1 -t "security fix" --label security --web --recover
110 glab issue create -t "Bug Report" --template bug
111 glab issue create -t "Feature Request" --template feature_proposal.md --yes
113 # Use a template file from outside the repository
114 glab issue create -t "Bug Report" --template ~/team-templates/bug.md
116 # Read the description from a file
117 glab issue create -t "we need this feature" --description-file description.md
119 # Read the description from standard input
120 cat description.md | glab issue create -t "we need this feature" --description-file -
122 # Attach a screenshot to the description
123 glab issue create -t "Login button misaligned" -d "See below." --attach ./screenshot.png`),
124 Args: cobra.NoArgs,
125 ValidArgsFunction: cobra.NoFileCompletions,
126 Annotations: map[string]string{
127 mcpannotations.Destructive: "true",
128 },
129 RunE: func(cmd *cobra.Command, args []string) error {
130 client, err := opts.gitlabClient()
131 if err != nil {
132 return err
133 }
135 repo, err := opts.baseRepo()
136 if err != nil {
137 return err
138 }
140 if err := cmdutils.ResolveDescriptionFile(opts.io, cmd); err != nil {
141 return err
142 }
144 hasTitle := cmd.Flags().Changed("title")
145 hasDescription := cmd.Flags().Changed("description")
146 hasTemplate := cmd.Flags().Changed("template")
147 hasAttachment := len(opts.Attach) > 0
149 // disable interactive mode if title and description (or template, or an
150 // attachment) are explicitly defined
151 opts.needsPrompt = !(hasTitle && (hasDescription || hasTemplate || hasAttachment))
153 if opts.needsPrompt && !opts.io.IsInteractive() {
154 return &cmdutils.FlagError{Err: errors.New("'--title' and '--description' (or '--template' or '--attach') required for non-interactive mode")}
155 }
157 // Remove this once --yes does more than just skip the prompts that --web happen to skip
158 // by design
159 if opts.yes && opts.web {
160 return &cmdutils.FlagError{Err: errors.New("'--web' already skips all prompts currently skipped by '--yes'")}
161 }
163 opts.baseProject, err = api.GetProject(client, repo.FullName())
164 if err != nil {
165 return err
166 }
168 if !opts.baseProject.IssuesEnabled { //nolint:staticcheck // Unlike IssuesAccessLevel, IssuesEnabled reflects the current user's access, which this check needs.
169 opts.io.LogErrorf("Issues are disabled for project %q or require project membership. ", opts.baseProject.PathWithNamespace)
170 opts.io.LogErrorf("Make sure issues are enabled for the %q project, and if required, you are a member of the project.\n",
171 opts.baseProject.PathWithNamespace)
172 return cmdutils.SilentError
173 }
175 if err := createRun(cmd.Context(), opts); err != nil {
176 // always save options to file
177 recoverErr := createRecoverSaveFile(repo.FullName(), opts)
178 if recoverErr != nil {
179 opts.io.LogErrorf("Could not create recovery file: %v", recoverErr)
180 }
182 return err
183 }
185 return nil
186 },
187 }
188 issueCreateCmd.Flags().StringVarP(&opts.Title, "title", "t", "", "Issue title.")
189 issueCreateCmd.Flags().StringVarP(&opts.Description, "description", "d", "", "Issue description. Set to \"-\" to open an editor.")
190 cmdutils.AddAttachFlag(issueCreateCmd, &opts.Attach, "description")
191 issueCreateCmd.Flags().StringSliceVarP(&opts.Labels, "label", "l", []string{}, "Add label by name. Multiple labels can be comma-separated or specified by repeating the flag.")
192 issueCreateCmd.Flags().StringSliceVarP(&opts.Assignees, "assignee", "a", []string{}, "Assign issue to people by their `usernames`. Multiple usernames can be comma-separated or specified by repeating the flag.")
193 issueCreateCmd.Flags().StringVarP(&opts.MilestoneFlag, "milestone", "m", "", "The global ID or title of a milestone to assign.")
194 issueCreateCmd.Flags().BoolVarP(&opts.IsConfidential, "confidential", "c", false, "Set an issue to be confidential.")
195 issueCreateCmd.Flags().Int64VarP(&opts.LinkedMR, "linked-mr", "", 0, "The IID of a merge request in which to resolve all issues.")
196 issueCreateCmd.Flags().Int64VarP(&opts.Weight, "weight", "w", 0, "Issue weight. Valid values are greater than or equal to 0.")
197 issueCreateCmd.Flags().BoolVarP(&opts.noEditor, "no-editor", "", false, "Don't open editor to enter a description. If set to true, uses prompt.")
198 issueCreateCmd.Flags().BoolVarP(&opts.yes, "yes", "y", false, "Don't prompt for confirmation to submit the issue.")
199 issueCreateCmd.Flags().BoolVar(&opts.web, "web", false, "Continue issue creation with web interface.")
200 issueCreateCmd.Flags().IntSliceVarP(&opts.LinkedIssues, "linked-issues", "", []int{}, "The IIDs of issues that this issue links to. Multiple IIDs can be comma-separated or specified by repeating the flag.")
201 issueCreateCmd.Flags().StringVarP(&opts.IssueLinkType, "link-type", "", "relates_to", "Type for the issue link.")
202 issueCreateCmd.Flags().StringVarP(&opts.TimeEstimate, "time-estimate", "e", "", "Set time estimate for the issue.")
203 issueCreateCmd.Flags().StringVarP(&opts.TimeSpent, "time-spent", "s", "", "Set time spent for the issue.")
204 issueCreateCmd.Flags().BoolVar(&opts.recover, "recover", false, "Save the options to a file if the issue fails to be created. If the file exists, the options will be loaded from the recovery file. (EXPERIMENTAL)")
205 issueCreateCmd.Flags().Int64VarP(&opts.EpicID, "epic", "", 0, "ID of the epic to add the issue to.")
206 issueCreateCmd.Flags().StringVarP(&opts.DueDate, "due-date", "", "", "A date in 'YYYY-MM-DD' format.")
207 issueCreateCmd.Flags().StringVar(&opts.Template, "template", "", "Template to pre-populate the description. A name is looked up in '.gitlab/issue_templates/' of the local repository, and the '.md' extension is optional. A value that is absolute or contains a path separator is read as a file path, for example '~/templates/bug.md'.")
208 cmdutils.AddDescriptionFileFlag(issueCreateCmd, "issue")
209 issueCreateCmd.MarkFlagsMutuallyExclusive("template", "description")
210 issueCreateCmd.MarkFlagsMutuallyExclusive("template", "description-file")
212 return issueCreateCmd
213}
215func (o *options) selectTemplate(ctx context.Context) (string, error) {
216 templateNames, err := cmdutils.ListGitLabTemplates(cmdutils.IssueTemplate)
217 if err != nil {
218 return "", fmt.Errorf("error getting templates: %w", err)
219 }
221 const blankIssueOption = "Open a blank issue"
222 templateNames = append(templateNames, blankIssueOption)
224 var selectedTemplate string
225 if err := o.io.Select(ctx, &selectedTemplate, "Choose a template", templateNames); err != nil {
226 return "", fmt.Errorf("could not prompt: %w", err)
227 }
229 if selectedTemplate == blankIssueOption {
230 return "", nil // Return empty string for blank issue
231 }
233 templateContents, err := cmdutils.LoadGitLabTemplate(cmdutils.IssueTemplate, selectedTemplate)
234 if err != nil {
235 return "", fmt.Errorf("failed to get template contents: %w", err)
236 }
238 return templateContents, nil
239}
241var createRun = func(ctx context.Context, opts *options) error {
242 apiClient, err := opts.gitlabClient()
243 if err != nil {
244 return err
245 }
247 repo, err := opts.baseRepo()
248 if err != nil {
249 return err
250 }
252 var templateContents string
254 issueCreateOpts := &gitlab.CreateIssueOptions{}
256 if opts.MilestoneFlag != "" {
257 opts.Milestone, err = cmdutils.ParseMilestone(apiClient, repo, opts.MilestoneFlag)
258 if err != nil {
259 return err
260 }
261 }
263 if opts.recover {
264 if err := recovery.FromFile(repo.FullName(), "issue.json", opts); err != nil {
265 // if the file to recover doesn't exist, we can just ignore the error and move on
266 if !errors.Is(err, os.ErrNotExist) {
267 opts.io.LogErrorf("Failed to recover from file: %v", err)
268 }
269 } else {
270 opts.io.LogInfo("Recovered create options from file.")
271 }
272 }
274 // Handle -d- flag: show template selection first, then open editor
275 err = cmdutils.HandleDescriptionEditor(ctx, &opts.Description, opts.io, opts.config, func(ctx context.Context) (string, error) {
276 return opts.selectTemplate(ctx)
277 })
278 if err != nil {
279 return err
280 }
282 if opts.Template != "" && opts.Description == "" {
283 content, err := cmdutils.LoadGitLabTemplate(cmdutils.IssueTemplate, opts.Template)
284 if err != nil {
285 return err
286 }
287 if content == "" {
288 return fmt.Errorf("template %q not found in .gitlab/issue_templates/", opts.Template)
289 }
290 opts.Description = content
291 }
293 if opts.needsPrompt {
294 // Step 1: Template selection (if not using --no-editor and description is empty)
295 if opts.Description == "" && !opts.noEditor {
296 templateContents, err = opts.selectTemplate(ctx)
297 if err != nil {
298 return err
299 }
300 }
302 // Step 2: Title and Description in a single form
303 needsTitle := opts.Title == ""
304 needsDescription := opts.Description == ""
306 if needsTitle || needsDescription {
307 var fields []huh.Field
309 // Add title field if needed
310 if needsTitle {
311 fields = append(fields, huh.NewInput().
312 Title("Title").
313 Value(&opts.Title).
314 Validate(func(s string) error {
315 if s == "" {
316 return fmt.Errorf("title is required")
317 }
318 return nil
319 }))
320 }
322 // Add description field if needed
323 if needsDescription {
324 if opts.noEditor {
325 // Use multiline text input
326 fields = append(fields, huh.NewText().
327 Title("Description").
328 Value(&opts.Description))
329 } else {
330 // Use editor with template contents
331 editor, err := cmdutils.GetEditor(opts.config)
332 if err != nil {
333 return err
334 }
336 // Set initial value from template
337 if templateContents != "" {
338 opts.Description = templateContents
339 }
341 textField := huh.NewText().
342 Title("Description").
343 Value(&opts.Description).
344 ExternalEditor(true).
345 EditorExtension(".md")
347 if editor != "" {
348 // Parse editor command to handle arguments properly
349 // huh.Editor() accepts variadic args: Editor(cmd, arg1, arg2, ...)
350 editorParts := utils.ParseEditorCommand(editor)
351 if len(editorParts) > 0 {
352 textField = textField.Editor(editorParts...)
353 }
354 }
356 fields = append(fields, textField)
357 }
358 }
360 // Run the combined form
361 if len(fields) > 0 {
362 err = opts.io.RunForm(ctx, fields...)
363 if err != nil {
364 return err
365 }
366 }
367 }
368 } else if opts.Title == "" {
369 return fmt.Errorf("title can't be blank")
370 }
372 var action cmdutils.Action
374 // submit without prompting for non interactive mode
375 if !opts.needsPrompt || opts.yes {
376 action = cmdutils.SubmitAction
377 }
379 if opts.web {
380 action = cmdutils.PreviewAction
381 }
383 if action == cmdutils.NoAction {
384 action, err = cmdutils.ConfirmSubmission(ctx, opts.io, true)
385 if err != nil {
386 return fmt.Errorf("unable to confirm: %w", err)
387 }
388 }
390 if action == cmdutils.AddMetadataAction {
391 var metadataActions []cmdutils.Action
393 metadataActions, err = cmdutils.PickMetadata(ctx, opts.io)
394 if err != nil {
395 return fmt.Errorf("failed to pick metadata to add: %w", err)
396 }
398 remotes, err := opts.remotes()
399 if err != nil {
400 return err
401 }
402 repoRemote, err := remotes.FindByRepo(repo.RepoOwner(), repo.RepoName())
403 if err != nil {
404 // when the base repo is overridden with --repo flag, it is likely it has no
405 // remote set for the current working git dir which will error.
406 // Init a new remote without actually adding a new git remote
407 repoRemote = &glrepo.Remote{
408 Repo: repo,
409 }
410 }
412 for _, x := range metadataActions {
413 if x == cmdutils.AddLabelAction {
414 err = cmdutils.LabelsPrompt(ctx, opts.io, &opts.Labels, apiClient, repoRemote)
415 if err != nil {
416 return err
417 }
419 }
420 if x == cmdutils.AddAssigneeAction {
421 // Involve only reporters and up, in the future this might be expanded to `guests`
422 // but that might hit the `100` limit for projects with large amounts of collaborators
423 err = cmdutils.UsersPrompt(ctx, &opts.Assignees, apiClient, repoRemote, opts.io, 20, "assignees")
424 if err != nil {
425 return err
426 }
427 }
428 if x == cmdutils.AddMilestoneAction {
429 err = cmdutils.MilestonesPrompt(ctx, &opts.Milestone, apiClient, repoRemote, opts.io)
430 if err != nil {
431 return err
432 }
434 }
435 }
437 // Ask the user again but don't permit AddMetadata a second time
438 action, err = cmdutils.ConfirmSubmission(ctx, opts.io, false)
439 if err != nil {
440 return err
441 }
442 }
444 if action == cmdutils.CancelAction {
445 opts.io.LogError("Discarded.")
446 return nil
447 }
449 // After the cancel check so a discarded issue uploads nothing, before the
450 // preview branch so --web carries the references too.
451 opts.body, err = cmdutils.AppendAttachments(ctx, opts.io, apiClient, repo.FullName(), opts.Description, opts.Attach)
452 if err != nil {
453 return err
454 }
456 if action == cmdutils.PreviewAction {
457 return previewIssue(opts)
458 }
460 if action == cmdutils.SubmitAction {
461 issueCreateOpts.Title = new(opts.Title)
462 issueCreateOpts.Labels = (*gitlab.LabelOptions)(&opts.Labels)
463 issueCreateOpts.Description = &opts.body
464 if opts.IsConfidential {
465 issueCreateOpts.Confidential = new(opts.IsConfidential)
466 }
467 if opts.Weight != 0 {
468 issueCreateOpts.Weight = new(opts.Weight)
469 }
470 if opts.LinkedMR != 0 {
471 issueCreateOpts.MergeRequestToResolveDiscussionsOf = new(opts.LinkedMR)
472 }
473 if opts.Milestone != 0 {
474 issueCreateOpts.MilestoneID = new(opts.Milestone)
475 }
476 if opts.EpicID != 0 {
477 issueCreateOpts.EpicID = new(opts.EpicID)
478 }
479 if opts.DueDate != "" {
480 dueDate, err := gitlab.ParseISOTime(opts.DueDate)
481 if err != nil {
482 return err
483 }
484 issueCreateOpts.DueDate = new(dueDate)
485 }
487 if len(opts.Assignees) > 0 {
488 users, err := api.UsersByNames(apiClient, opts.Assignees)
489 if err != nil {
490 return err
491 }
492 issueCreateOpts.AssigneeIDs = cmdutils.IDsFromUsers(users)
493 }
494 opts.io.LogError("- Creating issue in", repo.FullName())
495 issue, err := createIssue(apiClient, repo.FullName(), issueCreateOpts)
496 if err != nil {
497 return err
498 }
499 if err := postCreateActions(apiClient, issue, opts, repo); err != nil {
500 return err
501 }
503 opts.io.LogInfo(issueutils.DisplayIssue(opts.io.Color(), issue, opts.io.IsaTTY))
504 return nil
505 }
507 return errors.New("expected to cancel, preview in browser, add metadata, or submit")
508}
510func postCreateActions(apiClient *gitlab.Client, issue *gitlab.Issue, opts *options, repo glrepo.Interface) error {
511 if len(opts.LinkedIssues) > 0 {
512 for _, targetIssueIID := range opts.LinkedIssues {
513 opts.io.LogError("- Linking to issue ", targetIssueIID)
514 issueLink, _, err := apiClient.IssueLinks.CreateIssueLink(repo.FullName(), issue.IID, &gitlab.CreateIssueLinkOptions{
515 TargetIssueIID: new(strconv.Itoa(targetIssueIID)),
516 LinkType: new(opts.IssueLinkType),
517 })
518 if err != nil {
519 return err
520 }
521 issue = issueLink.SourceIssue
522 }
523 }
524 if opts.TimeEstimate != "" {
525 opts.io.LogError("- Adding time estimate ", opts.TimeEstimate)
526 _, _, err := apiClient.Issues.SetTimeEstimate(repo.FullName(), issue.IID, &gitlab.SetTimeEstimateOptions{Duration: new(opts.TimeEstimate)})
527 if err != nil {
528 return err
529 }
530 }
531 if opts.TimeSpent != "" {
532 opts.io.LogError("- Adding time spent ", opts.TimeSpent)
533 _, _, err := apiClient.Issues.AddSpentTime(repo.FullName(), issue.IID, &gitlab.AddSpentTimeOptions{Duration: new(opts.TimeSpent)})
534 if err != nil {
535 return err
536 }
537 }
538 return nil
539}
541func previewIssue(opts *options) error {
542 repo, err := opts.baseRepo()
543 if err != nil {
544 return err
545 }
547 cfg := opts.config()
549 openURL, err := generateIssueWebURL(opts)
550 if err != nil {
551 return err
552 }
554 if opts.io.IsOutputTTY() {
555 opts.io.LogErrorf("Opening %s in your browser.\n", utils.DisplayURL(openURL))
556 }
557 browser, _ := cfg.Get(repo.RepoHost(), "browser")
558 return utils.OpenInBrowser(openURL, browser)
559}
561func generateIssueWebURL(opts *options) (string, error) {
562 var description strings.Builder
563 description.WriteString(opts.body)
565 if len(opts.Labels) > 0 {
566 // this uses the slash commands to add labels to the description
567 // See https://docs.gitlab.com/user/project/quick_actions/
568 // See also https://gitlab.com/gitlab-org/gitlab-foss/-/issues/19731#note_32550046
569 description.WriteString("\n/label")
570 for _, label := range opts.Labels {
571 description.WriteString(fmt.Sprintf(" ~%q", label))
572 }
573 }
574 if len(opts.Assignees) > 0 {
575 // this uses the slash commands to add assignees to the description
576 description.WriteString(fmt.Sprintf("\n/assign %s", strings.Join(opts.Assignees, ", ")))
577 }
578 if opts.Milestone != 0 {
579 // this uses the slash commands to add milestone to the description
580 description.WriteString(fmt.Sprintf("\n/milestone %%%d", opts.Milestone))
581 }
582 if opts.Weight != 0 {
583 // this uses the slash commands to add weight to the description
584 description.WriteString(fmt.Sprintf("\n/weight %d", opts.Weight))
585 }
586 if opts.IsConfidential {
587 // this uses the slash commands to add confidential to the description
588 description.WriteString("\n/confidential")
589 }
591 u, err := url.Parse(opts.baseProject.WebURL)
592 if err != nil {
593 return "", err
594 }
595 u.Path += "/-/issues/new"
597 q := u.Query()
598 q.Set("issue[title]", opts.Title)
599 q.Add("issue[description]", description.String())
600 u.RawQuery = q.Encode()
602 return u.String(), nil
603}
605// createRecoverSaveFile will try save the issue create options to a file
606func createRecoverSaveFile(repoName string, opts *options) error {
607 recoverFile, err := recovery.CreateFile(repoName, "issue.json", opts)
608 if err != nil {
609 return err
610 }
612 opts.io.LogErrorf("Failed to create issue. Created recovery file: %s\nRun the command again with the '--recover' option to retry", recoverFile)
613 return nil
614}
Diagnostics8 git calls · 331 ms
CallStatusSizeTime0331 ms
discover200185 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch 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 · hit3 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=3 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 · hit2 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=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=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:02001.8 KiB · hit4 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=1857 git.response.cache=HIT git.response.duration_ms=4 git.fetch.filter=tree:0 git.fetch.wants=dce174ff8c632a19d17eea99c8a9b7c37fb2b592 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=4 git.pkt.data=3 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=1857 git.pkt.payload.max=1830 git.sideband.band1.bytes=1830 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=1830 git.pack.trailer=fb03183b7909876778f740d196d7516811003517Open pack map
fetchtree:0200492 B · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=18 git.response.bytes=492 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=tree:0 git.fetch.wants=409e7038e253494f94691a22a250deee77ba03bf 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=492 git.pkt.payload.max=465 git.sideband.band1.bytes=465 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=465 git.pack.trailer=c8a67aa26d573734cf0c8f302f8c1dd08e47d76aOpen pack map
fetchtree:0200241 B · hit18 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=299 git.response.bytes=241 git.response.cache=HIT git.response.duration_ms=18 git.fetch.filter=tree:0 git.fetch.wants=65456ca49a78f4c6f0b98ffad089d9ea28940f53 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=241 git.pkt.payload.max=214 git.sideband.band1.bytes=214 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=214 git.pack.trailer=3c6055d4ff8dc803acc935ee10d6f6301f2e5c6bOpen pack map
fetch2006.3 KiB299 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=6465 git.response.cache=MISS git.response.duration_ms=299 git.fetch.wants=0c8a8b4e14420005b99bde5c211875bfd6e6be1e 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=6465 git.pkt.payload.max=6438 git.sideband.band1.bytes=6438 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
- a5e2646589b0df63
- Request
- 6997fe6d…
- 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