summaryrefslogtreecommitdiffstats
path: root/pkg/gui/controllers/branches_controller.go
AgeCommit message (Collapse)Author
2023-07-10Use an interface for tasks instead of a concrete structJesse Duffield
By using an interface for tasks we can use a fake implementation in tests with extra methods
2023-07-09Use first class task objects instead of global counterJesse Duffield
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-05-25Use sentence case everywhereJesse Duffield
We have not been good at consistent casing so far. Now we use 'Sentence case' everywhere. EVERYWHERE. Also Removing 'Lc' prefix from i18n field names: the 'Lc' stood for lowercase but now that everything is in 'Sentence case' there's no need for the distinction. I've got a couple lower case things I've kept: namely, things that show up in parentheses.
2023-04-30lots of changesJesse Duffield
2023-04-30standardise controller helper methodsJesse Duffield
2023-04-30Begin refactoring guiJesse Duffield
This begins a big refactor of moving more code out of the Gui struct into contexts, controllers, and helpers. We also move some code into structs in the gui package purely for the sake of better encapsulation
2023-02-19feat: support to create tag on branchRyooooooga
2022-11-14fix: fix ambiguous branch nameRyooooooga
test: add an integration test for checkout branch by name fix: fix full ref name of detached head refactor: refactor current branch loader chore: use field name explicitly
2022-06-01Fetch the correct remote branchLuka Markušić
2022-05-08rename displayString to label for menu itemsJesse Duffield
2022-04-13Refresh BRANCHES and COMMITS after (un)staging upstreamLuka Markušić
2022-04-13There's gotta be a better way for initial contentLuka Markušić
2022-04-11Add option to (un)set upstream for a local branchLuka Markušić
2022-03-30pkg/gui: Rename IPopupHandler::Ask() to Confirm()Moritz Haase
Follow the JavaScript naming scheme for user interaction (alert, prompt, confirm) as discussed in #1832.
2022-03-19update lintersJesse Duffield
2022-03-17move keybindingsJesse Duffield
2022-03-17add remote branches controllerJesse Duffield
2022-03-17refactor controllersJesse Duffield