1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-12 11:15:00 +02:00
Commit Graph

131 Commits

Author SHA1 Message Date
Jesse Duffield
ec7e9f9228 Fix confirmation view sizing
The proper fix is to actually have these two functions share code,
or for views to be able to manage their own heights based on their contents.

But I want to get this out for the sake of a Lazygit Anniversary release.
2023-08-05 16:09:02 +10:00
Jesse Duffield
92f0aa23cc Remove file watcher code
Now that we refresh upon focus, we can scrap this file watching code.
Stefan says few git UIs use file watching, and I understand why: the
reason this code was problematic in the first place is that watching
files is expensive and if you have too many open file handles that
can cause problems.

Importantly: this code that's being removed was _already_ dead.
2023-08-02 21:50:44 +10:00
Karl Heitmann
c7e6a73512 Wraps rebase func with WithWaitingStatus to show loader when rebasing 2023-07-31 19:46:59 -04:00
Jesse Duffield
b92c294059
Add automated demo recordings (#2853) 2023-07-31 22:43:36 +10:00
Jesse Duffield
9cc1d65280 Add demo test variant
We're piggybacking on our existing integration test framework to record  demos that we can include in our docs
2023-07-31 22:33:04 +10:00
Stefan Haller
be667682f0 Move IgnoreWhitespaceInDiffView to AppState, and persist it when it changes 2023-07-31 11:41:55 +02:00
Stefan Haller
d41a195ee6 Allow force-tagging if tag exists 2023-07-31 11:38:52 +02:00
Stefan Haller
66de981e91 Add a "Mark commit as base commit for rebase" command
This allows to do the equivalent of "git rebase --onto <target> <base>", by
first marking the <base> commit with the new command, and then selecting the
target branch and invoking the usual rebase command there.
2023-07-31 08:41:41 +02:00
Stefan Haller
6dc25d796b Visualize local branch heads in commits panel
We want to mark all local branch heads with a "*" in the local commits panel, to
make it easier to see how branches are stacked onto each other. In order to not
confuse users with "*" markers that they don't understand, do this only for the
case where users actually use stacked branches; those users are likely not going
to be confused by the display. This means we want to filter out a few branch
heads that shouldn't get the marker: the current branch, any main branch, and
any old branch that has been merged to master already.
2023-07-31 08:34:01 +02:00
Stefan Haller
092d5dd608 Add CheckedOutBranch to Model struct 2023-07-31 08:34:01 +02:00
Jesse Duffield
e33fe37a99 Standardise on using lo for slice functions
We've been sometimes using lo and sometimes using my slices package, and we need to pick one
for consistency. Lo is more extensive and better maintained so we're going with that.

My slices package was a superset of go's own slices package so in some places I've just used
the official one (the methods were just wrappers anyway).

I've also moved the remaining methods into the utils package.
2023-07-30 18:51:23 +10:00
Jesse Duffield
91909331b5 Fix flakey worktree tests
In the presentation layer, when showing branches, we'll show worktrees against branches if they're
associated. But there was a race condition: if the worktree model was refreshed after the branches model,
it wouldn't be used in the presentation layer when it came time to render the branches.

A better solution would be to have some way of signalling that a particular context needs to be refreshed
and after all the models are done being refreshed, we then refresh the contexts. This will prevent
double-renders
2023-07-30 18:35:36 +10:00
Jesse Duffield
eecf07cd12 Add more i18n for worktrees 2023-07-30 18:35:24 +10:00
Jesse Duffield
06be88aef7 Use fields rather than methods on worktrees
I would prefer to use methods to keep things immutable but I'd rather be consistent with the other
models and update them all at once
2023-07-30 18:35:24 +10:00
Jesse Duffield
4c5b1574f1 Centralise logic for obtaining repo paths
There are quite a few paths you might want to get e.g. the repo's path, the worktree's path,
the repo's git dir path, the worktree's git dir path. I want these all obtained once and
then used when needed rather than having to have IO whenever we need them. This is not so
much about reducing time spent on IO as it is about not having to care about errors every time
we want a path.
2023-07-30 18:35:24 +10:00
Jesse Duffield
de57cfd6ff Remove IO logic from presentation code for worktrees
We're doing all the IO in our workers loader method so that we don't need to do any
in our presentation code
2023-07-30 18:35:24 +10:00
Jesse Duffield
ae66f720f5 Update repo switch logic
We now always re-use the state of the repo if we're returning to it, and we always reset the windows to their default tabs.

We reset to default tabs because it's easy to implement. If people want to:
* have tab states be retained when switching
* have tab states specific to the current repo retained when switching back

Then we'll need to revisit this
2023-07-30 18:35:23 +10:00
Jesse Duffield
277142fc4b Add worktree integration tests 2023-07-30 18:35:23 +10:00
Jesse Duffield
cdfad864ae Remove worktree version guards
Our min required git version is 2.20 so there's no need to add guards
for worktrees because they were added in 2.5
2023-07-30 18:35:23 +10:00
Jesse Duffield
fb4453c18a Fix unit tests 2023-07-30 18:35:23 +10:00
Jesse Duffield
b5ff55e538 Show loader when switching worktrees 2023-07-30 18:35:23 +10:00
Jesse Duffield
81a9133261 Support older versions of git when fetching worktrees
Older versions of git don't support the -z flag in `git worktree list`.
So we're using newlines.

Also, we're not raising an error upon error because that triggers another refresh,
which gets us into an infinite loop
2023-07-30 18:35:23 +10:00
Jesse Duffield
3a7468ecac Support opening worktree in editor 2023-07-30 18:35:23 +10:00
Jesse Duffield
b73efb2c22 Better logic for knowing which repo we're in 2023-07-30 18:35:22 +10:00
Jesse Duffield
a06a5cadee Only show worktree in status panel if not the main worktree and worktrees are supported 2023-07-30 18:35:22 +10:00
Jesse Duffield
3cd2d6fa5c Hide worktree functionality on old git versions 2023-07-30 18:35:22 +10:00
Jesse Duffield
6f2f9f6677 Assume that the base of a worktree can be checked out 2023-07-30 18:35:22 +10:00
Jesse Duffield
2082fdf84a i18n for worktrees 2023-07-30 18:35:22 +10:00
Jesse Duffield
894485190b Don't quit on error 2023-07-30 18:35:22 +10:00
Jesse Duffield
2e68967e02 Show base ref suggestions when creating worktree 2023-07-30 18:35:22 +10:00
Jesse Duffield
9c69a5df69 Checkout worktree when creating from worktree view 2023-07-30 18:35:22 +10:00
Jesse Duffield
18ea68c23a Support creating worktrees from refs 2023-07-30 18:35:22 +10:00
Jesse Duffield
4b2622d93b Fix wording 2023-07-30 18:35:22 +10:00
Jesse Duffield
ae0193698e Log when directory is changed 2023-07-30 18:35:22 +10:00
Jesse Duffield
6b4a638415 Handle deleting branch attached to worktree 2023-07-30 18:35:22 +10:00
Jesse Duffield
6c69549ced Don't touch repo stack when switching worktrees
We shouldn't touch this cos we're doing a lateral move
2023-07-30 18:35:22 +10:00
Jesse Duffield
5868750aba Move status panel presentation logic into presentation package 2023-07-30 18:35:22 +10:00
Jesse Duffield
ab3052f642 Land in the same panel when switching to a worktree 2023-07-30 18:35:22 +10:00
Jesse Duffield
077ae99438 Prompt to switch to worktree when branch is checked out by other worktree 2023-07-30 18:35:22 +10:00
Jesse Duffield
fe8adf9eb8 Use git lingo 2023-07-30 18:35:22 +10:00
Jesse Duffield
c713d550c0 Improve name handling 2023-07-30 18:35:22 +10:00
Joel Baranick
db02c13bf6 Address PR comments 2023-07-30 18:35:21 +10:00
Joel Baranick
1ce9a87544 Basic support for adding a worktree 2023-07-30 18:35:21 +10:00
Joel Baranick
c679fd1924 Style missing worktree as red and display better error when trying to switch to them
Use a broken link icon for missing worktrees
2023-07-30 18:35:21 +10:00
Joel Baranick
60872c91e6 Update status to differentiate the main vs linked worktrees 2023-07-30 18:35:21 +10:00
Joel Baranick
f8ba899b87 Initial addition of support for worktrees 2023-07-30 18:35:21 +10:00
Jesse Duffield
39b77c0fca Have staging refresh wait for files to refresh first 2023-07-29 10:20:15 +10:00
Jesse Duffield
63e5790410 Speed up refresh using concurrency and wait groups
Previously our synchronous refreshes took far longer because nothing
was happening concurrently. We now run refresh functions concurrently
and use a wait group to ensure they're all done before returning
2023-07-29 10:04:11 +10:00
Jesse Duffield
09ce430240 Log duration of refresh 2023-07-29 09:39:10 +10:00
Jesse Duffield
7807b40322 Better tag creation UX
Previously we used a single-line prompt for a tag annotation. Now we're using the commit message
prompt.

I've had to update other uses of that prompt to allow the summary and description labels to
be passed in
2023-07-22 14:36:35 +10:00