v0.4.0 b6be3a8

syncfile_test.go RawHistoryFolder

1package syncfile
2
3import (
4	"context"
5	"errors"
6	"os"
7	"testing"
8	"time"
9)
10
11// A pipe stands in for a sync file: readable means signalled.
12func TestWaitReturnsWhenReadable(t *testing.T) {
13	r, w, err := os.Pipe()
14	if err != nil {
15		t.Fatal(err)
16	}
17	defer r.Close()
18	go func() {
19		time.Sleep(10 * time.Millisecond)
20		_, _ = w.Write([]byte{1})
21		w.Close()
22	}()
23	if err := Wait(context.Background(), r); err != nil {
24		t.Fatal(err)
25	}
26}
27
28func TestWaitStopsOnCancel(t *testing.T) {
29	r, w, err := os.Pipe()
30	if err != nil {
31		t.Fatal(err)
32	}
33	defer r.Close()
34	defer w.Close()
35	ctx, cancel := context.WithTimeout(context.Background(), 20*time.Millisecond)
36	defer cancel()
37	if err := Wait(ctx, r); !errors.Is(err, context.DeadlineExceeded) {
38		t.Fatalf("err %v", err)
39	}
40}
41
42// POLLERR alone (a write end whose reader is gone) is not a signal.
43func TestWaitReportsErrorEvents(t *testing.T) {
44	r, w, err := os.Pipe()
45	if err != nil {
46		t.Fatal(err)
47	}
48	defer w.Close()
49	r.Close()
50	if err := Wait(context.Background(), w); err == nil {
51		t.Fatal("POLLERR taken as signalled")
52	}
53}

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 25

Tags 10

↑↓ moveenter openesc close