jesseduffield.lazygit/pkg/commands/patch
Stefan Haller 33b8d497c2 Guard the patch builder against concurrent access
The custom-patch git operations (move/pull/delete patch, and their rebase
continuations) run on worker goroutines and call PatchBuilder.Reset when
they've consumed the patch, clearing To and the fileInfoMap. Meanwhile the
UI thread reads that state every layout — the options bar and the mode
indicator both call Active() — so the reset raced the render.

Add a mutex. The map's entries are only ever touched on the UI thread, so
the lock only has to serialize the To field and the fileInfoMap pointer:
readers snapshot the pointer under the lock and iterate the local, and
getFileInfo drops the lock across its git diff I/O rather than holding it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-17 12:35:54 +02:00
..
format.go Export PatchLine.isChange 2025-07-04 10:14:35 +02:00
hunk.go refactor patch code 2023-03-19 16:30:39 +11:00
parse.go refactor patch code 2023-03-19 16:30:39 +11:00
patch.go Fix selection after staging an added line 2026-03-19 16:57:53 +01:00
patch_builder.go Guard the patch builder against concurrent access 2026-07-17 12:35:54 +02:00
patch_line.go Fix selection after staging an added line 2026-03-19 16:57:53 +01:00
patch_test.go Show renamed files in the custom patch builder 2026-07-04 13:05:09 +02:00
transform.go Show renamed files in the custom patch builder 2026-07-04 13:05:09 +02:00