mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-13 00:56:25 -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> |
||
|---|---|---|
| .. | ||
| app | ||
| cheatsheet | ||
| commands | ||
| common | ||
| config | ||
| constants | ||
| env | ||
| fakes | ||
| gocui | ||
| gui | ||
| i18n | ||
| integration | ||
| jsonschema | ||
| logs | ||
| snake | ||
| tasks | ||
| theme | ||
| updates | ||
| utils | ||