v0.28.0 fca9155

convert.go RawHistoryFolder

1// SPDX-License-Identifier: AGPL-3.0-or-later
2
3package rpc
4
5import (
6	"encoding/base64"
7	"fmt"
8	"slices"
9	"time"
10
11	"google.golang.org/protobuf/types/known/timestamppb"
12
13	pb "bnema.dev/ermite-api/gen/ermite"
14	"bnema.dev/ermite/internal/domain"
15	"bnema.dev/ermite/internal/ports"
16)
17
18// This file maps domain values to the messages of the contract and back.
19// Messages are DTOs: the domain never leaks into them, nor they into the
20// domain.
21
22func timestamp(t time.Time) *timestamppb.Timestamp {
23	if t.IsZero() {
24		return nil
25	}
26	return timestamppb.New(t)
27}
28
29func goTime(ts *timestamppb.Timestamp) time.Time {
30	if ts == nil {
31		return time.Time{}
32	}
33	return ts.AsTime()
34}
35
36func visibilityToPB(v domain.Visibility) pb.Visibility {
37	switch v {
38	case domain.VisibilityPublic:
39		return pb.Visibility_VISIBILITY_PUBLIC
40	case domain.VisibilityPrivate:
41		return pb.Visibility_VISIBILITY_PRIVATE
42	}
43	return pb.Visibility_VISIBILITY_UNSPECIFIED
44}
45
46// visibilityFromPB maps a visibility of a request. Unspecified is the empty
47// domain.Visibility, which the use cases treat as "default".
48func visibilityFromPB(v pb.Visibility) (domain.Visibility, error) {
49	switch v {
50	case pb.Visibility_VISIBILITY_UNSPECIFIED:
51		return "", nil
52	case pb.Visibility_VISIBILITY_PUBLIC:
53		return domain.VisibilityPublic, nil
54	case pb.Visibility_VISIBILITY_PRIVATE:
55		return domain.VisibilityPrivate, nil
56	}
57	return "", fmt.Errorf("%w: %v", domain.ErrInvalidVisibility, v)
58}
59
60func repoToPB(v ports.RepoView) *pb.Repo {
61	settings := v.EffectiveSettings()
62	return &pb.Repo{
63		Name:          v.Name.String(),
64		Description:   v.Description,
65		Topics:        v.Topics,
66		Visibility:    visibilityToPB(v.Visibility),
67		DefaultBranch: v.DefaultBranch,
68		CreatedAt:     timestamp(v.CreatedAt),
69		PushedAt:      timestamp(v.PushedAt),
70		Settings:      settingsToPB(settings),
71	}
72}
73
74func settingsToPB(s domain.RepoSettings) *pb.RepoSettings {
75	out := &pb.RepoSettings{FailingChecksBlock: s.FailingChecksBlock, Issues: issuesModeToPB(s.Issues)}
76	for _, m := range s.AllowedMergeModes {
77		out.AllowedMergeModes = append(out.AllowedMergeModes, mergeModeToPB(m))
78	}
79	return out
80}
81
82func mergeModeToPB(m domain.MergeMode) pb.MergeMode {
83	switch m {
84	case domain.MergeModeFastForward:
85		return pb.MergeMode_MERGE_MODE_FAST_FORWARD
86	case domain.MergeModeSquash:
87		return pb.MergeMode_MERGE_MODE_SQUASH
88	case domain.MergeModeMerge:
89		return pb.MergeMode_MERGE_MODE_MERGE_COMMIT
90	}
91	return pb.MergeMode_MERGE_MODE_UNSPECIFIED
92}
93
94// mergeModeFromPB maps a mode of a merge request: unspecified is the empty
95// domain.MergeMode, which the use case reads as fast-forward.
96func mergeModeFromPB(m pb.MergeMode) (domain.MergeMode, error) {
97	switch m {
98	case pb.MergeMode_MERGE_MODE_UNSPECIFIED:
99		return "", nil
100	case pb.MergeMode_MERGE_MODE_FAST_FORWARD:
101		return domain.MergeModeFastForward, nil
102	case pb.MergeMode_MERGE_MODE_SQUASH:
103		return domain.MergeModeSquash, nil
104	case pb.MergeMode_MERGE_MODE_MERGE_COMMIT:
105		return domain.MergeModeMerge, nil
106	}
107	return "", fmt.Errorf("%w: merge mode %v", domain.ErrInvalid, m)
108}
109
110// mergeModesFromPB maps the allowed modes of the settings, where unspecified
111// is rejected.
112func mergeModesFromPB(in []pb.MergeMode) ([]domain.MergeMode, error) {
113	out := make([]domain.MergeMode, 0, len(in))
114	for _, m := range in {
115		mode, err := mergeModeFromPB(m)
116		if err != nil {
117			return nil, err
118		}
119		if mode == "" {
120			return nil, fmt.Errorf("%w: MERGE_MODE_UNSPECIFIED is not a merge mode", domain.ErrInvalid)
121		}
122		out = append(out, mode)
123	}
124	return out, nil
125}
126
127var scopeToPB = map[domain.Scope]pb.Scope{
128	domain.ScopeMRReview:       pb.Scope_SCOPE_MR_REVIEW,
129	domain.ScopeRepoRead:       pb.Scope_SCOPE_REPO_READ,
130	domain.ScopeRepoWrite:      pb.Scope_SCOPE_REPO_WRITE,
131	domain.ScopeRepoAdmin:      pb.Scope_SCOPE_REPO_ADMIN,
132	domain.ScopeMRWrite:        pb.Scope_SCOPE_MR_WRITE,
133	domain.ScopeMRMerge:        pb.Scope_SCOPE_MR_MERGE,
134	domain.ScopeCIWrite:        pb.Scope_SCOPE_CI_WRITE,
135	domain.ScopeSecretsWrite:   pb.Scope_SCOPE_SECRETS_WRITE,
136	domain.ScopeRunnerRegister: pb.Scope_SCOPE_RUNNER_REGISTER,
137	domain.ScopeTokenAdmin:     pb.Scope_SCOPE_TOKEN_ADMIN,
138	domain.ScopeIssueWrite:     pb.Scope_SCOPE_ISSUE_WRITE,
139}
140
141func scopeFromPB(s pb.Scope) (domain.Scope, error) {
142	for d, p := range scopeToPB {
143		if p == s {
144			return d, nil
145		}
146	}
147	return "", fmt.Errorf("%w: %v", domain.ErrInvalidScope, s)
148}
149
150func tokenToPB(t domain.Token) *pb.Token {
151	out := &pb.Token{
152		Id:         t.ID,
153		Label:      t.Label,
154		ExpiresAt:  timestamp(t.ExpiresAt),
155		CreatedAt:  timestamp(t.CreatedAt),
156		LastUsedAt: timestamp(t.LastUsedAt),
157	}
158	for _, s := range t.Scopes {
159		out.Scopes = append(out.Scopes, scopeToPB[s])
160	}
161	for _, r := range t.Repos {
162		out.Repos = append(out.Repos, r.String())
163	}
164	out.BranchPrefixes = slices.Clone(t.BranchPrefixes)
165	return out
166}
167
168func refKindToPB(k domain.RefKind) pb.RefKind {
169	switch k {
170	case domain.RefKindBranch:
171		return pb.RefKind_REF_KIND_BRANCH
172	case domain.RefKindTag:
173		return pb.RefKind_REF_KIND_TAG
174	case domain.RefKindHead:
175		return pb.RefKind_REF_KIND_HEAD
176	}
177	return pb.RefKind_REF_KIND_UNSPECIFIED
178}
179
180func refKindFromPB(k pb.RefKind) (domain.RefKind, error) {
181	switch k {
182	case pb.RefKind_REF_KIND_BRANCH:
183		return domain.RefKindBranch, nil
184	case pb.RefKind_REF_KIND_TAG:
185		return domain.RefKindTag, nil
186	case pb.RefKind_REF_KIND_HEAD:
187		return domain.RefKindHead, nil
188	}
189	return "", fmt.Errorf("%w: %v", domain.ErrInvalidRefKind, k)
190}
191
192func refToPB(r domain.Ref) *pb.Ref {
193	return &pb.Ref{
194		Name:      r.Name,
195		ShortName: r.ShortName,
196		Kind:      refKindToPB(r.Kind),
197		Id:        r.ID.String(),
198		CommitId:  r.CommitID.String(),
199	}
200}
201
202func entryKindToPB(k domain.EntryKind) pb.EntryKind {
203	switch k {
204	case domain.EntryFile:
205		return pb.EntryKind_ENTRY_KIND_FILE
206	case domain.EntryExecutable:
207		return pb.EntryKind_ENTRY_KIND_EXECUTABLE
208	case domain.EntryDirectory:
209		return pb.EntryKind_ENTRY_KIND_DIRECTORY
210	case domain.EntrySymlink:
211		return pb.EntryKind_ENTRY_KIND_SYMLINK
212	case domain.EntrySubmodule:
213		return pb.EntryKind_ENTRY_KIND_SUBMODULE
214	}
215	return pb.EntryKind_ENTRY_KIND_UNSPECIFIED
216}
217
218func signatureToPB(s domain.Signature) *pb.Signature {
219	return &pb.Signature{Name: s.Name, Email: s.Email, Time: timestamp(s.Time)}
220}
221
222func commitToPB(c domain.Commit) *pb.Commit {
223	out := &pb.Commit{
224		Id:        c.ID.String(),
225		Author:    signatureToPB(c.Author),
226		Committer: signatureToPB(c.Committer),
227		Summary:   c.Summary,
228		Message:   c.Message,
229	}
230	for _, p := range c.Parents {
231		out.ParentIds = append(out.ParentIds, p.String())
232	}
233	if c.Verification.Status != domain.StatusUnchecked {
234		out.Verification = verificationToPB(c.Verification)
235	}
236	return out
237}
238
239func verificationToPB(v domain.CommitVerification) *pb.CommitVerification {
240	return &pb.CommitVerification{
241		Format:      signatureFormatToPB(v.Format),
242		Status:      signatureStatusToPB(v.Status),
243		Fingerprint: v.Fingerprint,
244		KeyId:       v.KeyID,
245		KeyTitle:    v.KeyTitle,
246	}
247}
248
249func signatureFormatToPB(f domain.SignatureFormat) pb.SignatureFormat {
250	switch f {
251	case domain.FormatSSH:
252		return pb.SignatureFormat_SIGNATURE_FORMAT_SSH
253	case domain.FormatGPG:
254		return pb.SignatureFormat_SIGNATURE_FORMAT_GPG
255	case domain.FormatX509:
256		return pb.SignatureFormat_SIGNATURE_FORMAT_X509
257	case domain.FormatNone:
258		return pb.SignatureFormat_SIGNATURE_FORMAT_UNSPECIFIED
259	}
260	return pb.SignatureFormat_SIGNATURE_FORMAT_UNSPECIFIED
261}
262
263// signatureFormatFromPB maps the format of a key to add: only SSH and GPG keys
264// can be trusted.
265func signatureFormatFromPB(f pb.SignatureFormat) (domain.SignatureFormat, error) {
266	switch f {
267	case pb.SignatureFormat_SIGNATURE_FORMAT_SSH:
268		return domain.FormatSSH, nil
269	case pb.SignatureFormat_SIGNATURE_FORMAT_GPG:
270		return domain.FormatGPG, nil
271	case pb.SignatureFormat_SIGNATURE_FORMAT_UNSPECIFIED, pb.SignatureFormat_SIGNATURE_FORMAT_X509:
272	}
273	return domain.FormatNone, fmt.Errorf("%w: key format must be ssh or gpg", domain.ErrInvalid)
274}
275
276func signatureStatusToPB(s domain.SignatureStatus) pb.SignatureStatus {
277	switch s {
278	case domain.StatusUnsigned:
279		return pb.SignatureStatus_SIGNATURE_STATUS_UNSIGNED
280	case domain.StatusVerified:
281		return pb.SignatureStatus_SIGNATURE_STATUS_VERIFIED
282	case domain.StatusUnknownKey:
283		return pb.SignatureStatus_SIGNATURE_STATUS_UNKNOWN_KEY
284	case domain.StatusBadSignature:
285		return pb.SignatureStatus_SIGNATURE_STATUS_BAD_SIGNATURE
286	case domain.StatusEmailMismatch:
287		return pb.SignatureStatus_SIGNATURE_STATUS_EMAIL_MISMATCH
288	case domain.StatusExpired:
289		return pb.SignatureStatus_SIGNATURE_STATUS_EXPIRED
290	case domain.StatusRevoked:
291		return pb.SignatureStatus_SIGNATURE_STATUS_REVOKED
292	case domain.StatusUnsupported:
293		return pb.SignatureStatus_SIGNATURE_STATUS_UNSUPPORTED
294	case domain.StatusUnchecked:
295		return pb.SignatureStatus_SIGNATURE_STATUS_UNSPECIFIED
296	}
297	return pb.SignatureStatus_SIGNATURE_STATUS_UNSPECIFIED
298}
299
300func trustedKeyToPB(k domain.TrustedKey) *pb.TrustedKey {
301	return &pb.TrustedKey{
302		Id:        k.ID,
303		Format:    signatureFormatToPB(k.Format),
304		Title:     k.Title,
305		PublicKey: k.PublicKey,
306		Emails:    slices.Clone(k.Emails),
307		CreatedAt: timestamp(k.CreatedAt),
308		Builtin:   k.Builtin,
309	}
310}
311
312func treeEntryToPB(e domain.TreeEntry) *pb.TreeEntry {
313	out := &pb.TreeEntry{
314		Name: e.Name,
315		Path: e.Path,
316		Kind: entryKindToPB(e.Kind),
317		Mode: e.Mode,
318		Id:   e.ID.String(),
319		Size: e.Size,
320	}
321	if e.LastCommit != nil {
322		out.LastCommit = commitToPB(*e.LastCommit)
323	}
324	return out
325}
326
327func blobInfoToPB(b domain.BlobInfo) *pb.BlobInfo {
328	return &pb.BlobInfo{
329		Id:        b.ID.String(),
330		Path:      b.Path,
331		Size:      b.Size,
332		Binary:    b.Binary,
333		MediaType: b.MediaType,
334		Mode:      b.Mode,
335	}
336}
337
338func fileStatusToPB(s domain.FileStatus) pb.FileStatus {
339	switch s {
340	case domain.FileAdded:
341		return pb.FileStatus_FILE_STATUS_ADDED
342	case domain.FileDeleted:
343		return pb.FileStatus_FILE_STATUS_DELETED
344	case domain.FileModified:
345		return pb.FileStatus_FILE_STATUS_MODIFIED
346	case domain.FileRenamed:
347		return pb.FileStatus_FILE_STATUS_RENAMED
348	case domain.FileCopied:
349		return pb.FileStatus_FILE_STATUS_COPIED
350	case domain.FileTypeChanged:
351		return pb.FileStatus_FILE_STATUS_TYPE_CHANGED
352	}
353	return pb.FileStatus_FILE_STATUS_UNSPECIFIED
354}
355
356func lineKindToPB(k domain.LineKind) pb.LineKind {
357	switch k {
358	case domain.LineContext:
359		return pb.LineKind_LINE_KIND_CONTEXT
360	case domain.LineAddition:
361		return pb.LineKind_LINE_KIND_ADDITION
362	case domain.LineDeletion:
363		return pb.LineKind_LINE_KIND_DELETION
364	}
365	return pb.LineKind_LINE_KIND_UNSPECIFIED
366}
367
368func hunkToPB(h domain.Hunk) *pb.Hunk {
369	out := &pb.Hunk{
370		OldStart: int32(h.OldStart), OldLines: int32(h.OldLines),
371		NewStart: int32(h.NewStart), NewLines: int32(h.NewLines),
372		Header: h.Header,
373		Lines:  make([]*pb.Line, 0, len(h.Lines)),
374	}
375	for _, l := range h.Lines {
376		out.Lines = append(out.Lines, &pb.Line{
377			Kind:           lineKindToPB(l.Kind),
378			OldNumber:      int32(l.OldNumber),
379			NewNumber:      int32(l.NewNumber),
380			Text:           l.Text,
381			NoNewlineAtEof: l.NoNewlineAtEOF,
382		})
383	}
384	return out
385}
386
387func fileDiffToPB(f domain.FileDiff) *pb.FileDiff {
388	out := &pb.FileDiff{
389		OldPath: f.OldPath, NewPath: f.NewPath,
390		Status:  fileStatusToPB(f.Status),
391		OldMode: f.OldMode, NewMode: f.NewMode,
392		OldId: f.OldID.String(), NewId: f.NewID.String(),
393		Binary:     f.Binary,
394		Additions:  int32(f.Additions),
395		Deletions:  int32(f.Deletions),
396		Similarity: int32(f.Similarity),
397		Truncated:  f.Truncated,
398	}
399	for _, h := range f.Hunks {
400		out.Hunks = append(out.Hunks, hunkToPB(h))
401	}
402	return out
403}
404
405func diffStatsToPB(s domain.DiffStats) *pb.DiffStats {
406	return &pb.DiffStats{
407		FilesChanged: int32(s.FilesChanged),
408		Additions:    int32(s.Additions),
409		Deletions:    int32(s.Deletions),
410	}
411}
412
413func diffToPB(d domain.Diff) *pb.Diff {
414	out := &pb.Diff{Truncated: d.Truncated}
415	for _, f := range d.Files {
416		out.Files = append(out.Files, fileDiffToPB(f))
417	}
418	return out
419}
420
421func commitDetailToPB(d domain.CommitDetail) *pb.GetCommitResponse {
422	return &pb.GetCommitResponse{
423		Commit: commitToPB(d.Commit),
424		Stats:  diffStatsToPB(d.Stats),
425		Diff:   diffToPB(d.Diff),
426	}
427}
428
429// oidToPB turns the zero object id of a ref update (no object) into "".
430func oidToPB(oid string) string {
431	if oid == domain.ZeroOID {
432		return ""
433	}
434	return oid
435}
436
437func refUpdatesToPB(updates []domain.RefUpdate) []*pb.RefUpdate {
438	out := make([]*pb.RefUpdate, 0, len(updates))
439	for _, u := range updates {
440		out = append(out, &pb.RefUpdate{Ref: u.Ref, OldId: oidToPB(u.Old), NewId: oidToPB(u.New)})
441	}
442	return out
443}
444
445// watchEventToPB maps one item of a watch; nil when the event has no
446// representation in the contract.
447func watchEventToPB(we ports.WatchEvent) *pb.Event {
448	if we.Gap {
449		return &pb.Event{Kind: &pb.Event_Gap{Gap: &pb.Gap{}}}
450	}
451	out := &pb.Event{Id: we.ID}
452	switch ev := we.Event.(type) {
453	case domain.RepoCreated:
454		out.Time = timestamp(ev.At)
455		out.Kind = &pb.Event_RepoCreated{RepoCreated: &pb.RepoCreated{Repo: repoOrName(we, ev.Repo, ev.Visibility)}}
456	case domain.RepoUpdated:
457		out.Time = timestamp(ev.At)
458		out.Kind = &pb.Event_RepoUpdated{RepoUpdated: &pb.RepoUpdated{Repo: repoOrName(we, ev.Repo, "")}}
459	case domain.RepoDeleted:
460		out.Time = timestamp(ev.At)
461		out.Kind = &pb.Event_RepoDeleted{RepoDeleted: &pb.RepoDeleted{Repo: ev.Repo.String()}}
462	case domain.PushEvent:
463		out.Time = timestamp(ev.At)
464		out.Kind = &pb.Event_Pushed{Pushed: &pb.Pushed{Repo: ev.Repo.String(), RefUpdates: refUpdatesToPB(ev.Updates)}}
465	case domain.MergeRequestOpened:
466		out.Time = timestamp(ev.At)
467		out.Kind = &pb.Event_MergeRequestOpened{MergeRequestOpened: &pb.MergeRequestOpened{MergeRequest: mergeRequestToPB(ev.MergeRequest)}}
468	case domain.MergeRequestMerged:
469		out.Time = timestamp(ev.At)
470		out.Kind = &pb.Event_MergeRequestMerged{MergeRequestMerged: &pb.MergeRequestMerged{MergeRequest: mergeRequestToPB(ev.MergeRequest)}}
471	case domain.MergeRequestClosed:
472		out.Time = timestamp(ev.At)
473		out.Kind = &pb.Event_MergeRequestClosed{MergeRequestClosed: &pb.MergeRequestClosed{MergeRequest: mergeRequestToPB(ev.MergeRequest)}}
474	case domain.CommentAdded:
475		out.Time = timestamp(ev.At)
476		out.Kind = &pb.Event_CommentAdded{CommentAdded: &pb.CommentAdded{Repo: ev.Repo.String(), Number: ev.Number, Comment: commentToPB(ev.Comment)}}
477	case domain.IssueOpened:
478		out.Time = timestamp(ev.At)
479		out.Kind = &pb.Event_IssueOpened{IssueOpened: &pb.IssueOpened{Issue: issueToPB(ev.Issue)}}
480	case domain.IssueClosed:
481		out.Time = timestamp(ev.At)
482		out.Kind = &pb.Event_IssueClosed{IssueClosed: &pb.IssueClosed{Issue: issueToPB(ev.Issue)}}
483	case domain.IssueReopened:
484		out.Time = timestamp(ev.At)
485		out.Kind = &pb.Event_IssueReopened{IssueReopened: &pb.IssueReopened{Issue: issueToPB(ev.Issue)}}
486	case domain.IssueCommented:
487		out.Time = timestamp(ev.At)
488		out.Kind = &pb.Event_IssueCommented{IssueCommented: &pb.IssueCommented{Repo: ev.Repo.String(), Number: ev.Number, Comment: issueCommentToPB(ev.Comment)}}
489	case domain.IssueSubmitted:
490		out.Time = timestamp(ev.At)
491		out.Kind = &pb.Event_IssueSubmitted{IssueSubmitted: &pb.IssueSubmitted{Repo: ev.Repo.String(), Id: ev.ID.String()}}
492	case domain.CommentEdited:
493		out.Time = timestamp(ev.At)
494		out.Kind = &pb.Event_CommentEdited{CommentEdited: &pb.CommentEdited{Repo: ev.Repo.String(), Number: ev.Number, Comment: commentToPB(ev.Comment)}}
495	case domain.CommentDeleted:
496		out.Time = timestamp(ev.At)
497		out.Kind = &pb.Event_CommentDeleted{CommentDeleted: &pb.CommentDeleted{Repo: ev.Repo.String(), Number: ev.Number, Comment: commentToPB(ev.Comment)}}
498	case domain.CommentResolved:
499		out.Time = timestamp(ev.At)
500		out.Kind = &pb.Event_CommentResolved{CommentResolved: &pb.CommentResolved{Repo: ev.Repo.String(), Number: ev.Number, Comment: commentToPB(ev.Comment)}}
501	case domain.MergeRequestMergeability:
502		out.Time = timestamp(ev.At)
503		out.Kind = &pb.Event_MergeRequestMergeability{MergeRequestMergeability: &pb.MergeRequestMergeability{Repo: ev.Repo.String(), Number: ev.Number, Mergeability: mergeabilityToPB(ev.Mergeability)}}
504	case domain.RunUpdated:
505		out.Time = timestamp(ev.At)
506		out.Kind = runEventToPB(ev)
507	case domain.JobUpdated:
508		out.Time = timestamp(ev.At)
509		out.Kind = jobEventToPB(ev)
510	default:
511		// Web-only events, such as domain.IssuePendingRemoved (the API has
512		// no message for it; watchers list pending issues on demand).
513		return nil
514	}
515	return out
516}
517
518func repoOrName(we ports.WatchEvent, name domain.RepoName, vis domain.Visibility) *pb.Repo {
519	if we.Repo != nil {
520		return repoToPB(*we.Repo)
521	}
522	return &pb.Repo{Name: name.String(), Visibility: visibilityToPB(vis)}
523}
524
525// passkeysToPB converts passkeys; the credential id is base64url without
526// padding, the form RemovePasskey takes back. Key material never leaves.
527func passkeysToPB(list []domain.Passkey) []*pb.Passkey {
528	out := make([]*pb.Passkey, 0, len(list))
529	for _, p := range list {
530		out = append(out, &pb.Passkey{
531			Id:         base64.RawURLEncoding.EncodeToString(p.ID),
532			Name:       p.Name,
533			CreatedAt:  timestamp(p.CreatedAt),
534			LastUsedAt: timestamp(p.LastUsedAt),
535			Synced:     p.BackupState,
536		})
537	}
538	return out
539}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 2

Tags 45

↑↓ moveenter openesc close