1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-27 00:51:18 +02:00
Commit Graph

6381 Commits

Author SHA1 Message Date
ac9b830bf1 Remove double space between rebase todo and author columns (#4520)
- **PR Description**

In the commits list of an interactive rebase, the gap between the rebase
todo column and the author column was two instead of one. Remove the
extra space to make this gap the same as for all other columns.
2025-04-29 11:32:36 +02:00
6402c830d5 Remove space after rebase todo
This is very old; I can only guess that this was added at a time where today's
list column handling wasn't in place yet, so the space was needed to separate
columns. This now causes a gap of two spaces between the rebase todo column and
the author column, which I'm sure wasn't intended. Funny that I never noticed.
2025-04-29 11:30:37 +02:00
3ff1be0788 Disallow creating custom patches when the diff context size is 0 (#4522)
- **PR Description**

This is very similar to what we are doing for staging or discarding
hunks in the Files panel (see #4235). Git doesn't allow applying patches
with a zero context size (unless you use the --unidiff-zero option,
which is discouraged).

Fixes #4521.
2025-04-29 11:30:11 +02:00
0496e3af50 Disallow creating custom patches when the diff context size is 0
This is very similar to what we are doing for staging or discarding hunks in the
Files panel. Git doesn't allow applying patches with a zero context size (unless
you use the --unidiff-zero option, which is discouraged).
2025-04-29 10:21:18 +02:00
bb64e3ccb6 Fix nvim-remote commands for fish shell (#4506)
Fish shell does not support "&&" and "||" operators like
POSIX-compatible shells. Instead, it uses a different syntax structure
based on begin/end and if/else.

This caused existing lazygit nvim-remote integration templates to break
when fish was the user's default shell.

This commit adds explicit fish shell detection using the FISH_VERSION
environment variable, and provides fish-compatible templates that
correctly handle launching Neovim or sending remote commands via $NVIM.

Fixes behavior where edits would not open in a new Neovim tab or line
navigation would fail when $NVIM was set.

Ensures smoother editing experience for users running fish shell
(supported since Nov 2012 with FISH_VERSION).
2025-04-27 20:14:40 +02:00
4d0eaea6fc Fix nvim-remote commands for fish shell
Fish shell does not support "&&" and "||" operators like
POSIX-compatible shells. Instead, it uses a different syntax structure
based on begin/end and if/else.

This caused existing lazygit nvim-remote integration templates to break
when fish was the user's default shell.

This commit adds explicit fish shell detection using the FISH_VERSION
environment variable, and provides fish-compatible templates that
correctly handle launching Neovim or sending remote commands via $NVIM.

Fixes behavior where edits would not open in a new Neovim tab or line
navigation would fail when $NVIM was set.

Ensures smoother editing experience for users running fish shell
(supported since Nov 2012 with FISH_VERSION).
2025-04-27 20:12:11 +02:00
8bbfd4b9b9 Fix race condition when starting several command tasks in quick succession (#4518)
- **PR Description**

Fixes #4507, see there for an elaborate description of the problem.
2025-04-27 10:53:34 +02:00
3302a090f9 Fix race condition when starting several command tasks in quick succession
See https://github.com/jesseduffield/lazygit/issues/4507 for an elaborate
description.
2025-04-27 10:48:43 +02:00
829aa3c6af Allow closing issues via github actions (#4515)
- **PR Description**

As discussed, this'll allow @ChrisMcD1 to clean up any issues that have
already been resolved.

Basically if you want to close an issue just leave a comment saying
'/close'.

Tested this over in my [OK?](https://github.com/jesseduffield/OK) and
works like a charm.

- **Please check if the PR fulfills these requirements**

* [ ] Cheatsheets are up-to-date (run `go generate ./...`)
* [ ] Code has been formatted (see
[here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#code-formatting))
* [ ] Tests have been added/updated (see
[here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md)
for the integration test guide)
* [ ] Text is internationalised (see
[here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#internationalisation))
* [ ] If a new UserConfig entry was added, make sure it can be
hot-reloaded (see
[here](https://github.com/jesseduffield/lazygit/blob/master/docs/dev/Codebase_Guide.md#using-userconfig))
* [ ] Docs have been updated if necessary
* [ ] You've read through your own file changes for silly mistakes etc

<!--
Be sure to name your PR with an imperative e.g. 'Add worktrees view'
see https://github.com/jesseduffield/lazygit/releases/tag/v0.40.0 for
examples
-->
2025-04-26 14:46:16 +10:00
b353d2a55a Allow closing issues via github actions
This provides some basic admin permissions without needing to go all the
way up to a collaborator.
2025-04-26 14:42:21 +10:00
2b43f5b592 Add Debian installation instructions alongside Ubuntu (#4501)
**PR Description**

This PR updates the README to include installation instructions for
Debian.

* Renames the "Ubuntu" section to "Debian and Ubuntu"
* Adds the `sudo apt install lazygit` for Debian Trixie, Sid, and Ubuntu
25.10 and later
* Keeps the manual installation method for Debian Bookworm, Ubuntu 25.04
and earlier

This helps Debian and Ubuntu users install lazygit using either apt or
manual download, depending on the distribution version.

**Affected files**

* Documentation
* `README.md`: Renames the "Ubuntu" section to "Debian and Ubuntu" and
adds Debian installation instructions

**Requirements fulfilled by this PR**

* [x] Cheatsheets are up-to-date (run `go generate ./...`)
* [x] Code has been formatted (see
[here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#code-formatting))
* [x] Docs have been updated if necessary
* [x] You've read through your own file changes for silly mistakes etc
2025-04-23 19:51:02 +10:00
9e90d5ee62 Add Debian installation instructions alongside Ubuntu
Signed-off-by: Jongmin Kim <jmkim@debian.org>
2025-04-23 19:47:52 +10:00
7c2063c7a9 Allow changing diff context size and rename threshold when main view is focused (#4505)
- **PR Description**

Allow pressing `{`, `}`, `(`, and `)` to change the diff context size
and rename threshold when the main view is focused. This was forgotten
in #4429.
2025-04-23 11:26:21 +02:00
da24deb881 Allow changing diff context size and rename threshold when main view is focused 2025-04-23 08:38:46 +02:00
aa68885215 Add new command "Move commits to new branch" (#3876)
- **PR Description**

Add a new command "Move commits to new branch" (bound to `N` by
default), which is useful if you have just started some new work, you
already made some commits, and then you realize that you forgot to
create a new branch first, accidentally making those commits on main or
whichever other feature branch you happened to be on.

If you made those commits on main, you are prompted for a branch name
for the new branch, and then it creates the new branch right there and
hard-resets main to where it was. If you made them on another feature
branch though, you are first given the choice whether you want to create
the new branch from main, or keep it stacked on that other feature
branch. Then it prompts you for the name and proceeds as above.

Inspired by Magit's
[magit-branch-spinoff](https://magit.vc/manual/magit/Branch-Commands.html#index-b-s)
command.

The conditions under which the command is available are rather
restrictive: the current branch must have an upstream, it must not be
behind its upstream, but it must be ahead of it (otherwise there
wouldn't be any commits to move, and you might as well just create a new
branch normally).
2025-04-21 18:14:54 +02:00
f65166ae91 Update config docs and schema 2025-04-21 18:12:50 +02:00
30868eead8 Add new command "Move commits to new branch" 2025-04-21 18:12:50 +02:00
4bf11eae4b Add free-standing function IsWorkingTreeDirty
The long story: I want to call this function from RefsHelper; however, I can't
make WorkingTreeHelper a field of RefsHelper because RefsHelper is already a
field in WorkingTreeHelper, so that would be a circular dependency.

The shorter story: there's really little reason to have to instantiate a helper
object in order to call a simple function like this. Long term I would like to
get to a state where a lot more of these helper functions are free-standing, and
you pass in the data they need.

While at it, simplify the implementation of AnyStagedFiles and AnyTrackedFiles
to one-liners.
2025-04-21 18:12:50 +02:00
9d88d6a44e Remove MergeAndRebaseHelper's dependency on RefsHelper
We want to make MergeAndRebaseHelper a dependency of RefsHelper instead.
2025-04-21 18:12:50 +02:00
483195110a Use Model().Branches[0] instead of refsHelper.GetCheckedOutRef() in MergeAndRebaseHelper
It's the same, really, except that GetCheckedOutRef() does a check if any
branches exist and returns nil if not. Since we are accessing the returned
branch unconditionally without checking for nil, it seems this check is not
needed here. (The functions we are touching here are called from handlers that
are guarded with itemSelected or singleItemSelected, so we know that at least
one branch exists.)

The goal is to get rid of the dependency to refsHelper.
2025-04-21 18:12:50 +02:00
ecc70f4764 Cleanup: remove unnecessary indirection 2025-04-21 18:12:50 +02:00
bd1e34b39d Auto-forward main branches after fetching (#4493)
- **PR Description**

Add a new user config for auto-forwarding branches after fetching; by
default this is set to "onlyMainBranches", but it can be set to
"allBranches" to extend it to feature branches too, or to "none" to
disable it.

This is used both when fetching manually by pressing `f` in the files
panel, and for automatic background fetching.
2025-04-21 18:08:36 +02:00
7495854243 Add a breaking changes hint for the new auto-forward behavior 2025-04-21 18:06:09 +02:00
eaaa937315 Add config for auto-forwarding branches after fetching 2025-04-21 18:06:09 +02:00
2174762315 Inline fetchAux into call site
It's only called from this one place, and the call is a one-liner, so it makes
more sense to inline the code there.
2025-04-21 18:06:09 +02:00
3577808a14 Remove double Refresh
fetchAux already calls Refresh (and with a more targeted scope too), no need to
call it again here.
2025-04-21 18:06:09 +02:00
e4362eea60 Focus the main view (#4429)
- **PR Description**

This adds a new `0` keybinding to the side panels that focuses whatever
main view is currently displayed, with the goal of making it easier to
scroll the main view (using the normal navigation keys `,` `.` `<` `>`),
and being able to search the main view using `/`.

Alternatively to pressing `0` you can also click the main view to focus
it. Note that previously it was possible to go directly to the staging
panel by clicking in the main view when a file was selected; this now
takes a double click, because the first click just focuses the main
view, but you can go to staging from there by clicking again.

I'm reasonably happy with the overall behavior, but it takes some
getting used to, so we'll want to test this for a while to see if it
doesn't make the focus handling too confusing.

Fixes #3988.
2025-04-21 18:05:38 +02:00
4e21a096b9 Re-render focused main view on refresh if needed 2025-04-21 18:03:24 +02:00
98e4cb733f Allow clicking in the respective other main view to switch focus to it 2025-04-21 18:03:24 +02:00
fbb8b2e17e Allow clicking in focused main view to go to staging
Only works if a file is selected.
2025-04-21 18:03:24 +02:00
acfa024915 Allow clicking in main view to focus it 2025-04-21 18:03:24 +02:00
338064ac2c Read all lines from task when starting to search 2025-04-21 18:03:24 +02:00
ec51efc82c Make the main view searchable 2025-04-21 18:03:24 +02:00
2b399a3c36 Read all lines from task when jumping to bottom 2025-04-21 18:03:19 +02:00
60887eddd0 Use readLines channel only for command tasks
And only while the task is running.

This avoids accumulating lots of blocked goroutines when scrolling a view down
more than 1024 times (the capacity of the readLines channel).
2025-04-21 18:03:19 +02:00
7b17f33e9e Add navigation keybindings to focused main view 2025-04-21 18:03:19 +02:00
fa35f661d9 Update keybindings, config docs, and schema 2025-04-21 18:03:19 +02:00
1a93b2324b Allow focussing the main view
In this commit this is only possible by pressing '0' in a side panel; we'll add
mouse clicking later in the branch.

Also, you can't really do anything in the focused view except press escape to
leave it again. We'll add some more functionality in a following commit.
2025-04-21 18:03:19 +02:00
b7b7c65999 Add class MainContext
In this state of the code it isn't worth much because it's not any more than a
SimpleContext, but we'll add things to it later in the branch.
2025-04-21 18:03:18 +02:00
2a2705dcc3 Always render diffs to the main/secondary context pair, even for files
Previously we would render the diff for a directory to the main/secondary pair,
but a diff for a file to the staging/stagingSecondary pair. (And similar for
commit files: main/secondary for directories, but
patchBuilding/patchBuildingSecondary for files.)

I always found this confusing and couldn't really understand why we are doing
this; but now it gets in my way because I want to attach a controller to
main/secondary so that they can be focused. So change it to always use the main
context pair for everything we render from a side panel.
2025-04-21 18:03:18 +02:00
7b96615792 Add IGuiCommon.GetViewBufferManagerForView
So that we don't have to pass the map to controllers.
2025-04-21 18:03:18 +02:00
b97dd6bc3f Remove utils.Clamp, use lo.Clamp instead 2025-04-21 18:03:18 +02:00
6c0ee7df2b Bump gocui 2025-04-21 18:03:11 +02:00
548d486aee Section headers for rebase todos and actual commits (#4463)
- **PR Description**

During interactive rebase, or when stopping with conflicts in a
cherry-pick or revert, show section headers for the todo items and the
actual commits. This makes it much clearer where the current head commit
is. Get rid of the "<-- YOU ARE HERE" marker that we would previously
show; it is no longer needed. (We still show the "<-- CONFLICT" marker
though.)

For example:
```
╭─[4]─Commits - Reflog───────────────────────────╮
│--- Pending rebase todos ---                    │
│6562f903 pick  CI commit 03                     │
│--- Commits ---                                 │
│56a04448       CI ◯ commit 02                   │
│6d0c0e41       CI ◯ commit 01                   │
```
2025-04-20 16:09:40 +02:00
74054c9d70 Remove the "YOU ARE HERE" marker
Now that we have sections, it is no longer needed.

Keep the "<-- CONFLICTS" marker though.
2025-04-20 16:06:15 +02:00
6cbc1e0ace Add section headers for rebase todos, cherry-picks, reverts, and actual commits 2025-04-20 16:06:15 +02:00
98c19feccf Add new commit status StatusCherryPickingOrReverting
This is needed because we want to show different section headers for rebase
todos and cherry-pick/revert todos.
2025-04-20 16:06:15 +02:00
e90a3dc666 Fix view selection running out of sync with list selection when view isn't focused
When rerendering a view at the end of a refresh, we call HandleFocus only if the
view has the focus. This is so that we rerender the main view for the new
selection.

What was missing here is to update the view selection from the list selection if
the view doesn't have the focus, so that the selection is painted properly.
Normally this is not relevant because you don't see the selection if another
side panel has the focus; however, you do see it as an inactive selection when
e.g. a popup is shown, in which case it does matter.

This will become more important when we introduce section headers for commits,
because in that case the view selection needs to change when the working copy
state changes from normal to rebasing or vice versa, even if the list selection
stays the same.

The changed test submodule/reset.go shows how this was wrong before: when
entering the submodule again after resetting, there is a refresh which keeps the
same branch selected as before (master); however, since the branches panel is
not focused, the view didn't notice and kept thinking that the detached head is
selected (which it isn't, you can tell by running the test in sandbox mode and
focusing the branches panel at the end: you'll see that master is selected). So
the change in this commit fixes that.
2025-04-20 16:06:15 +02:00
0dab37a631 Allow reverting a range of commits (#4444)
- **PR Description**

This is part four of a four part series of PRs that improve the
cherry-pick and revert experience.

With this PR we support reverting a range selection of commits.

Fixes #3272
2025-04-20 16:05:27 +02:00
945b023eb5 Support range selection for reverting commits 2025-04-20 16:03:06 +02:00