mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 15:46:26 -04:00
PostFetchRefresh's refresh is the only background refresh carrying a Then callback, and Then callbacks are not generation-guarded: when the background fetch's refresh crossed a repo switch, the callback still ran — in the new repo — and auto-forwarded the new repo's branches because the old repo's fetch had completed. That was harmless in practice (the update-ref call compares against the expected old value, and it only does what the next fetch's auto-forward would do anyway), but mutating refs in a repo whose fetch never happened is not an action the user took. Skip the auto-forward when the repo generation changed since the fetch started. The generation is captured by the fetch's callers before the fetch runs, not by PostFetchRefresh itself: the background fetch doesn't block repo switching and is a network call, so by the time PostFetchRefresh runs a switch may already have happened — a capture there (or the one the refresh itself takes) would compare against the new repo's generation and let the auto-forward through. For the manual fetch the capture point makes no difference, since a foreground operation blocks repo switching for its entire duration. This deliberately guards only this call site rather than making Then callbacks generation-guarded in general: a Then is an arbitrary callback, and whether it is safe to skip on a repo switch is a decision for the author of the call site. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| amend_helper.go | ||
| app_status_helper.go | ||
| bisect_helper.go | ||
| branches_helper.go | ||
| cherry_pick_helper.go | ||
| commits_helper.go | ||
| commits_helper_test.go | ||
| confirmation_helper.go | ||
| credentials_helper.go | ||
| diff_helper.go | ||
| files_helper.go | ||
| fixup_helper.go | ||
| fixup_helper_test.go | ||
| gpg_helper.go | ||
| helpers.go | ||
| host_helper.go | ||
| inline_status_helper.go | ||
| menu_key.go | ||
| merge_and_rebase_helper.go | ||
| merge_conflicts_helper.go | ||
| mode_helper.go | ||
| patch_building_helper.go | ||
| record_directory_helper.go | ||
| refresh_helper.go | ||
| refresh_helper_test.go | ||
| refs_helper.go | ||
| repos_helper.go | ||
| search_helper.go | ||
| signal_handling.go | ||
| signal_handling_windows.go | ||
| snake_helper.go | ||
| staging_helper.go | ||
| sub_commits_helper.go | ||
| suggestions_helper.go | ||
| suspend_resume_helper.go | ||
| tags_helper.go | ||
| update_helper.go | ||
| upstream_helper.go | ||
| upstream_helper_test.go | ||
| view_helper.go | ||
| window_arrangement_helper.go | ||
| window_arrangement_helper_test.go | ||
| window_helper.go | ||
| working_tree_helper.go | ||
| worktree_helper.go | ||
| worktree_helper_test.go | ||