1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-04 10:34:55 +02:00
lazygit/docs
Jesse Duffield 14ecc15e71 Use first class task objects instead of global counter
The global counter approach is easy to understand but it's brittle and depends on implicit behaviour that is not very discoverable.

With a global counter, if any goroutine accidentally decrements the counter twice, we'll think lazygit is idle when it's actually busy.
Likewise if a goroutine accidentally increments the counter twice we'll think lazygit is busy when it's actually idle.
With the new approach we have a map of tasks where each task can either be busy or not. We create a new task and add it to the map
when we spawn a worker goroutine (among other things) and we remove it once the task is done.

The task can also be paused and continued for situations where we switch back and forth between running a program and asking for user
input.

In order for this to work with `git push` (and other commands that require credentials) we need to obtain the task from gocui when
we create the worker goroutine, and then pass it along to the commands package to pause/continue the task as required. This is
MUCH more discoverable than the old approach which just decremented and incremented the global counter from within the commands package,
but it's at the cost of expanding some function signatures (arguably a good thing).

Likewise, whenever you want to call WithWaitingStatus or WithLoaderPanel the callback will now have access to the task for pausing/
continuing. We only need to actually make use of this functionality in a couple of places so it's a high price to pay, but I don't
know if I want to introduce a WithWaitingStatusTask and WithLoaderPanelTask function (open to suggestions).
2023-07-09 21:30:19 +10:00
..
dev Use first class task objects instead of global counter 2023-07-09 21:30:19 +10:00
keybindings Differentiate between different filter modes 2023-07-03 12:54:14 +10:00
Config.md Color view frame differently when searching/filtering 2023-07-03 12:54:14 +10:00
Custom_Command_Keybindings.md Support authors and tags in custom command suggestions preset 2023-06-07 10:18:01 +10:00
Custom_Pagers.md remove 24 bit color delta arg from docs 2021-04-06 19:34:32 +10:00
README.md Add dev doc for busy/idle tracking 2023-07-09 20:57:18 +10:00
Searching.md Add filtering docs 2023-07-03 12:54:14 +10:00
Undoing.md Limitations Section sentence mixup corrected 2020-10-01 17:41:32 +10:00