mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
The refreshes on focus-in, right after a repo switch, and after returning from a subprocess are full foreground refreshes, so their tasks kept Busy() true for as long as the slowest scope took — and any switch attempt in that window was refused with the "can't switch" toast. The focus-in one is particularly annoying: focusing lazygit is often precisely what the user does in order to switch repos, and right after regaining focus is when a refresh takes longest. Blocking the switch bought nothing there. The refusal exists for user operations, whose follow-up work (e.g. a Then callback reading the model) isn't covered by the switch-safety guards; but these refreshes merely reload state, and a refresh by itself is now switch-safe: its git commands run against the repo it was started for, and the generation guard drops its updates when the repo changed. We can't just mark them Background, because that flag also decides whether the files refresh lets git take optional locks to persist its refreshed stat cache — worth doing for an attended refresh, and the focus-in refresh (typically running right after external changes) is the case that profits most. So split the two meanings: a new DontBlockRepoSwitch option dispatches the refresh's tasks as background tasks (excluded from Busy()) while keeping the attended optional-locks behavior. Combining it with Then panics, since Then is not generation-guarded. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| common.go | ||
| common_commands.go | ||
| context.go | ||
| keybindings.go | ||
| modes.go | ||
| ref_range.go | ||
| refresh.go | ||
| rendering.go | ||
| search_state.go | ||
| suggestion.go | ||
| version_number.go | ||
| version_number_test.go | ||
| views.go | ||