v0.1.0 5228465

stat_linux.go RawHistoryFolder

1// SPDX-License-Identifier: MIT
2
3//go:build linux && (amd64 || arm64)
4
5package git
6
7import (
8	"syscall"
9	"unsafe"
10)
11
12const atSymlinkNoFollow = 0x100
13
14// statNul is syscall.Stat and syscall.Lstat without their allocation: package
15// syscall copies the path into a new NUL-terminated byte slice at each call,
16// here the caller built it once. It makes the system call they make on this
17// platform, fstatat(AT_FDCWD, path, &stat, flags), into the same Stat_t.
18func statNul(nul []byte, lstat bool, st *fileStat) error {
19	var sys syscall.Stat_t
20	var flags uintptr
21	if lstat {
22		flags = atSymlinkNoFollow
23	}
24	atFDCWD := -100
25	var errno syscall.Errno
26	for {
27		_, _, errno = syscall.Syscall6(sysFstatat, uintptr(atFDCWD), uintptr(unsafe.Pointer(&nul[0])), uintptr(unsafe.Pointer(&sys)), flags, 0, 0)
28		if errno != syscall.EINTR {
29			break
30		}
31	}
32	var err error
33	if errno != 0 {
34		err = errno
35	}
36	return fillStat(st, &sys, nul, err)
37}
38
39const (
40	oRdonly  = 0
41	oCloexec = 0x80000
42)
43
44// openNul opens the file read-only with openat(AT_FDCWD, path, flags), the
45// system call syscall.Open makes, from a path that is already NUL-terminated.
46func openNul(nul []byte) (rawFile, error) {
47	atFDCWD := -100
48	for {
49		fd, _, errno := syscall.Syscall6(sysOpenat, uintptr(atFDCWD), uintptr(unsafe.Pointer(&nul[0])), oRdonly|oCloexec, 0, 0, 0)
50		if errno == syscall.EINTR {
51			continue
52		}
53		if errno != 0 {
54			return rawFile{}, errno
55		}
56		return rawFile{int(fd)}, nil
57	}
58}

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 1

Tags 2

↑↓ moveenter openesc close