Archived
- On startup, after the local state is shown, fetch the superproject and every initialized submodule (all remotes, prune, at most 8 at once). Fetches never prompt; failures show git's message. --no-fetch skips it, f fetches again. - The header shows "fetching n/m", then the fetch age and failures; the detail pane shows each submodule's last fetch and fetch errors. - The git provider polls each repository's metadata (refs, HEAD, index, .gitmodules) every 2 s and reports changes. The app reloads only what changed, keeping old values, expansion and cursor; loads are single-flight with coalesced reruns. Refresh is driven by the repositories, so a fetch in another shell updates the view like ours. - r reloads everything (worktree edits are not watched). - Docs: F50-F53, N1/N8 rewritten, D18-D20 (D12 superseded). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
32 lines
639 B
Go
32 lines
639 B
Go
package tui
|
|
|
|
import "testing"
|
|
|
|
func TestReloader(t *testing.T) {
|
|
r := newReloader()
|
|
if !r.start("a") {
|
|
t.Fatal("first start: want true")
|
|
}
|
|
if r.start("a") || r.start("a") {
|
|
t.Fatal("start while running: want false")
|
|
}
|
|
if !r.start("b") {
|
|
t.Fatal("other key: want true")
|
|
}
|
|
if !r.done("a") {
|
|
t.Fatal("done after requests while running: want again")
|
|
}
|
|
if r.done("a") {
|
|
t.Fatal("second done: requests were coalesced into one rerun")
|
|
}
|
|
if r.done("b") {
|
|
t.Fatal("done without requests: want no rerun")
|
|
}
|
|
if r.busy() {
|
|
t.Fatal("busy after all done")
|
|
}
|
|
if !r.start("a") {
|
|
t.Fatal("start after done: want true")
|
|
}
|
|
}
|