mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
A background refresh's model writes are dropped by the generation guard when the repo is switched mid-flight, but its git commands kept running — and because the refresh read the live git instance at each step, any command issued after the switch ran against the new repo. Now that git commands are pinned to the directory of the instance they were built from, capture the instance once when the refresh starts and run every scope's git work through it, so a switch-crossing refresh keeps addressing the repo it was started for. The instance is captured together with the repo generation, on the UI thread (where repo switches run), so the pair can't straddle a switch: an old instance paired with the new generation would compute data from the old repo and write it into the new repo's model unguarded. This also removes the refresh workers' unsynchronized reads of the live instance pointer, which raced its reassignment on the UI thread when a background refresh crossed a repo switch (foreground refreshes can't cross one: they keep Busy() true, which refuses the switch). Two reads keyed app-state by the live instance's repo path on a worker and now use the captured instance, fixing which repo they file under when crossing a switch: the pull-request cache, and the "user dismissed the base-remote prompt" flag. The base-remote menu's handlers keep reading the live instance: a switch dismisses any open popup, so they can't run against the wrong repo (and the OnPress body runs under a foreground task, which blocks switching anyway). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| helpers | ||
| attach.go | ||
| base_controller.go | ||
| basic_commits_controller.go | ||
| bisect_controller.go | ||
| branches_controller.go | ||
| command_log_controller.go | ||
| commit_description_controller.go | ||
| commit_message_controller.go | ||
| commits_files_controller.go | ||
| common.go | ||
| confirmation_controller.go | ||
| context_lines_controller.go | ||
| custom_patch_options_menu_action.go | ||
| diffing_menu_action.go | ||
| edit_config_action.go | ||
| files_controller.go | ||
| filter_controller.go | ||
| filtering_menu_action.go | ||
| git_flow_controller.go | ||
| global_controller.go | ||
| jump_to_side_window_controller.go | ||
| list_controller.go | ||
| list_controller_trait.go | ||
| local_commits_controller.go | ||
| local_commits_controller_test.go | ||
| main_view_controller.go | ||
| menu_controller.go | ||
| menu_key.go | ||
| merge_conflicts_controller.go | ||
| options_menu_action.go | ||
| patch_building_controller.go | ||
| patch_explorer_controller.go | ||
| patch_explorer_controller_test.go | ||
| prompt_controller.go | ||
| quit_actions.go | ||
| reflog_commits_controller.go | ||
| remote_branches_controller.go | ||
| remotes_controller.go | ||
| remotes_controller_test.go | ||
| rename_similarity_threshold_controller.go | ||
| screen_mode_actions.go | ||
| scroll_off_margin.go | ||
| scroll_off_margin_test.go | ||
| search_controller.go | ||
| search_prompt_controller.go | ||
| shell_command_action.go | ||
| side_window_controller.go | ||
| snake_controller.go | ||
| staging_controller.go | ||
| stash_controller.go | ||
| status_controller.go | ||
| sub_commits_controller.go | ||
| submodules_controller.go | ||
| suggestions_controller.go | ||
| switch_to_diff_files_controller.go | ||
| switch_to_focused_main_view_controller.go | ||
| switch_to_sub_commits_controller.go | ||
| sync_controller.go | ||
| tags_controller.go | ||
| toggle_whitespace_action.go | ||
| undo_controller.go | ||
| vertical_scroll_controller.go | ||
| view_selection_controller.go | ||
| workspace_reset_controller.go | ||
| worktrees_controller.go | ||