1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-24 19:39:16 +02:00
Commit Graph

6816 Commits

Author SHA1 Message Date
Stefan Haller
da7121fa87 Don't append "Disabled: " to menu tooltip if disabled reason is empty
In some cases we set a disabled reason but leave the text empty, so that we
don't get an error toast when the item is invoked. In such a case it looks
awkward if there is a tooltip showing "Disabled: " with no following text.
2025-08-14 17:59:38 +02:00
Stefan Haller
0c0c32aec4 Show "Close/Cancel: <esc>" for menus like we do for confirmations
For many menus, just "Close" is fine, but some menus act more like confirmations
(e.g. the menu that appears when you cherry-pick and get conflicts); in this
case, it's good to make it more obvious that hitting esc cancels the whole
thing.
2025-08-14 17:59:38 +02:00
Stefan Haller
aeff986450 Show context-specific labels for <esc> in staging and patch building view
Dismissing a range selection is handled by the global escape handler for all
list views, but not for the staging and patch building views, so we need to make
the esc description dynamic for these, too.
2025-08-14 17:59:38 +02:00
Stefan Haller
51066b14b1 Show escape binding for staging and patch building in the status bar 2025-08-14 17:59:38 +02:00
Stefan Haller
5f91b1b48e Move global escape handler to before the keybindings menu handler
The main reason for this is that sometimes the escape key is handled by a local
binding, in which case it appears before the '?' binding in the options status
bar, and other times it is handled by the global controller, in which case it
appeared after. Moving it to before the keybindings menu handler makes it appear
before '?' in both cases.

Also, if the window is too narrow to show all keybindings, the ones that don't
fit will be truncated, and in this case it is more important to show the esc
binding because of its context sensitivity.

This also moves the esc entry up a few positions in the keybindings menu, but I
don't think this matters much.
2025-08-14 17:59:38 +02:00
Stefan Haller
a8e44dcea6 Show context-specific labels for the global <esc> binding
WHen several modes are active at the same time, it isn't totally obvious which
one will be cancelled first, so show this in the status bar.
2025-08-14 17:59:38 +02:00
Stefan Haller
d8ea83704f Rename ModeStatus.Description to InfoLabel
It is styled and includes a "(Reset)" button, so it's really not a
general-purpose description, but very specific to the Information view.
2025-08-14 17:59:38 +02:00
Stefan Haller
7bf05dfca4 Avoid showing <esc> in options map when it doesn't do anything
The code duplication between Escape and EscapeEnabled is unfortunate, but I
don't see a better way to solve this.
2025-08-14 17:59:38 +02:00
Stefan Haller
0af439ddf5 Cleanup: remove dead code
Cancelling searching (as opposed to filtering) is handled by gocui.
2025-08-14 17:59:38 +02:00
Stefan Haller
4961c4b678 Avoid duplicate key bindings in options map
Sometimes there is a local and a global keybinding for the same key; if both are
configured to be shown in the options map, we should only show the local one
because it takes precedence. This happens for example for <esc> in a popup, or
for <esc> in the focused main view.

Note that this is also a problem in the keybindings menu, and we don't solve
that here.
2025-08-14 17:59:38 +02:00
Stefan Haller
f2c2e80a5c Show "Exit back to side panel" in options status bar for focused main view
It's maybe not totally obvious, so let's show it.

Esc now appears twice in the status bar, because the global controller also
appends its generic "Cancel". We'll fix this in the next commit.
2025-08-14 17:59:38 +02:00
Stefan Haller
d50e58559e Support Azure DevOps vs-ssh.visualstudio.com SSH remotes as hosting provider (#4822)
**PR Description**  
This PR adds support for parsing **legacy Azure DevOps SSH remotes**
that use the
`vs-ssh.visualstudio.com` host, which is still common in older
repositories or corporate setups.

This PR fixes issue #2667.

Previously, even if users mapped this host to the Azure DevOps provider
via
`configServiceDomains`, URL generation failed with:
```
Failed to parse repo information from url
```
because the Azure DevOps `ServiceDefinition` regex set did not include
this SSH format.

### Changes
- Added a new regex to `azdoServiceDef.regexStrings` to match:
  ```
  git@vs-ssh.visualstudio.com:v3/<org>/<project>/<repo>
  ```
- This allows `getRepoURLFromRemoteURL` to correctly extract `org`,
`project`, and `repo`
  for these remotes.
- Added a test case to `TestGetPullRequestURL` verifying that mapping  
`vs-ssh.visualstudio.com` → `azuredevops:dev.azure.com` produces the
correct PR URL.

### Example
With this config:
```yaml
services:
  'vs-ssh.visualstudio.com': 'azuredevops:dev.azure.com'
```
and remote:
```
git@vs-ssh.visualstudio.com:v3/myorg/myproject/myrepo
```
`GetPullRequestURL("feature/new", "")` now returns:
```
https://dev.azure.com/myorg/myproject/_git/myrepo/pullrequestcreate?sourceRef=feature%2Fnew
```

### Why
- Many users still have remotes in this legacy format.
- This change is **backward-compatible** and does not affect existing
supported remotes.
- It unblocks URL generation for PRs and commits without requiring users
to change their remotes.
- Fixes #2667
2025-08-14 15:23:38 +02:00
🚀 Niklas Arens
a44af0685c fix(hosting_service): support Azure DevOps vs-ssh.visualstudio.com SSH remotes 2025-08-14 15:20:56 +02:00
🚀 Niklas Arens
8276d4a50a test: TDD - support Azure DevOps vs-ssh.visualstudio.com SSH remotes 2025-08-14 15:20:56 +02:00
Stefan Haller
0c0f53fa31 Allow filtering the keybindings menu by keybinding (#4821)
- **PR Description**

When filtering the keybindings menu using `/`, typing `@` filters by
keybinding.

Closes #4739.
2025-08-14 15:04:56 +02:00
Stefan Haller
a08799ac15 Allow filterable contexts to customize the filter label 2025-08-14 15:02:48 +02:00
Stefan Haller
2ed11336b5 Allow filtering for keybindings by prepending filter string with '@' 2025-08-14 15:02:48 +02:00
Stefan Haller
d52d5e6a9e Allow filtered lists to preprocess the filter string
An example for this can be seen in the next commit.

We make this a setter rather than an added constructor argument so that we don't
have to change all those contexts that don't want to make use of this.
2025-08-14 15:02:48 +02:00
Stefan Haller
f1c07b3aed Strengthen text expectation
This assertion didn't test anything useful, given that the filtered view already
has two lines. This should have been adapted in 9f0b4d0000 when we added
section headers while filtering.
2025-08-14 15:02:48 +02:00
Stefan Haller
389ff29871 Fix right-alignment of divergence from base branch for branch checked out in a worktree (#4824)
- **PR Description**

We didn't take the worktree icon into account properly, so the
divergence indication was offset to the left by two characters in this
case.

I haven't used worktrees myself so far, so I didn't notice this before.
2025-08-14 14:30:51 +02:00
Stefan Haller
e54a8b2ee7 Fix right-alignment of divergence from base branch for branch checked out in a worktree
We didn't take the worktree icon into account properly, so the divergence
indication was offset to the left by two characters in this case.
2025-08-14 14:28:11 +02:00
Stefan Haller
1e75aee37e Add installation with gah (#4820)
- **PR Description**

This PR adds to the documentation a way of installation using
[gah](https://github.com/marverix/gah/).

> gah is an GitHub Releases app installer, that does not require sudo.
It is a simple bash script that downloads the latest release of an app
from GitHub and installs it in `~/.local/bin`. It is designed to be used
with apps that are distributed as a single binary file.
2025-08-13 18:30:47 +02:00
Marek Sierociński
08db9b43be docs: Add installation with gah 2025-08-13 11:35:24 +02:00
Stefan Haller
28ef4a13d2 Pass only Git-tracked Go files to gofumpt (#4809)
## **PR Description**
The below error message is shown when executing `make format` when
`test/_results/demo/worktree_create_from_branches/actual/repo/src/shims.go`
exists (maybe executing integration test produces this file?).

```sh
$ make format
gofumpt -l -w .
test/_results/demo/worktree_create_from_branches/actual/repo/src/shims.go:1:20: expected 'package', found 'EOF'
make: *** [format] Error 2
```

I have confirmed it works without above error when I run `make format`
on this PR's branch.
2025-08-12 11:46:02 +02:00
kyu08
e9cc07d4d3 Pass only Git-tracked Go files to gofumpt 2025-08-12 09:05:08 +02:00
Stefan Haller
b1382da9ec Fix delay with flicking through files or commits when git diff is very slow (#4803)
One reason why git diff can be very slow is when "diff.algorithm =
histogram" is being used. In this case, showing a very long single-file
diff can take seconds to load, and you'll see the "loading..." message
in the main view until we got the first lines of the diff to show.
There's nothing really we can do about this delay; however, when
switching to another, shorter file (or commit) while the "loading..."
message is still showing, this switch should be instantaneous. And it
was before 0.54.0, but we broke this in 0.54.0 with 8d7740a5ac
(#4782); now users have to wait for the slow git diff command to output
more text before the switch occurs. To fix this, don't block waiting for
the process to terminate if we just stopped it.

In addition, improve CPU usage by terminating git processes gracefully
(by sending them a TERM signal); this helps keep CPU usage low when
flicking through several of these huge diffs with "diff.algorithm =
histogram", because it avoids having several git processes running in
the background, calculating expensive diffs that we are never going to
show. Unfortunately this is only possible on Linux and Mac, so Windows
users will have to live with the higher CPU usage. The recommended
workaround is to not use "diff.algorithm = histogram".

Fixes #4798.
v0.54.2
2025-08-11 18:13:42 +02:00
Stefan Haller
e056e33da5 Improve CPU usage when flicking through large diffs
The previous commit already fixed the user-visible lag, but there's still a
problem with multiple background git processes consuming resources calculating
diffs that we are never going to show. Improve this by terminating those
processes (by sending them a TERM signal).

Unfortunately this is only possible on Linux and Mac, so Windows users will have
to live with the higher CPU usage. The recommended workaround is to not use
"diff.algorithm = histogram".
2025-08-11 18:07:21 +02:00
Stefan Haller
898f565116 Fix delay with flicking through files or commits when git diff is very slow
One reason why git diff can be very slow is when "diff.algorithm = histogram" is
being used. In this case, showing a very long single-file diff can take seconds
to load, and you'll see the "loading..." message in the main view until we got
the first lines of the diff to show. There's nothing really we can do about this
delay; however, when switching to another, shorter file (or commit) while the
"loading..." message is still showing, this switch should be instantaneous. And
it was before 0.54.0, but we broke this in 0.54.0 with 8d7740a5ac (#4782); now
users have to wait for the slow git diff command to output more text before the
switch occurs.

To fix this, don't block waiting for the process to terminate if we just stopped
it.
2025-08-11 18:07:21 +02:00
Stefan Haller
e5acbed848 Cleanup: move UpdateWindowTitle to platform-specific source files
No need to do a runtime check if we already have the platform-specific files.
2025-08-11 18:07:21 +02:00
Stefan Haller
77a9207f9e Update the badges of golangci-lint and homebrew in README.md (#4807) 2025-08-11 13:56:20 +02:00
Stefan Haller
985013718d Change color of github tag and homebrew badges to blue
Both of these badges have the coloring logic to show stable releases in blue,
and prereleases in orange. The criterion for a prerelease is that the major
version is 0. Now it is debatable whether we consider lazygit "stable", but I
don't feel we are in a preliminary state of the project, working towards the
first final 1.0 release, so I feel blue expresses the state of the project
better.
2025-08-11 13:42:19 +02:00
Stefan Haller
39b4f16e1a Update github tag badge
It doesn't really seem to make a difference, but this is what I get from
shields.io's builder (no idea where the previous .svg extension came from).
2025-08-11 13:37:53 +02:00
Stefan Haller
2864eecd37 Update homebrew link
The old link was broken, it would have to be "Formula/l/lazygit.rb" instead of
"Formula/lazygit.rb".

However, I don't find it very useful to link to the raw formula file, so I
decided to change the link to point to the homebrew web page for lazygit.
2025-08-11 13:36:05 +02:00
kyu08
649f9cd56f Update the badge of golangci-lint in README.md 2025-08-10 10:35:33 +02:00
Stefan Haller
0da27604e4 Update CONTRIBUTING.md to clarify translation contribution process (#4806) 2025-08-10 10:01:43 +02:00
kyu08
c4a684ce53 Update CONTRIBUTING.md to clarify translation contribution process 2025-08-10 09:59:54 +02:00
Stefan Haller
26db25be34 Fix scrollbar in certain popup panels (e.g. the intro message for new users) (#4804)
When showing a confirmation whose text ends with a line feed, we would
make the popup panel one line less tall than it needs to be, so it would
show a scroll bar. One example where this occurred is the very first
popup that users ever see (the "seriously you rock" message for new
users); that's a pretty bad first impression.

This happens because our code to suppress trailing newlines in views
doesn't work for styled text, and the text in confirmations is bold.
This code checks if the last character of the text is a line feed, and
in this case it isn't; the escape sequence for turning bold off comes
after it.

We should really fix this by improving that mechanism, but this would
require some tricky logic, so as a quick fix, trim trailing (and
leading) linefeeds from the text that we display in a confirmation,
before making it bold.
2025-08-09 11:52:04 +02:00
Stefan Haller
09e2bfaf99 Trim trailing newlines when showing confirmations
When showing a confirmation whose text ended with a line feed, we would make the
popup panel one line less tall than it needs to be, so it would show a scroll
bar. One example where this occurred is the very first popup that users ever see
(the "seriously you rock" message for new users); that's a pretty bad first
impression.

This happens because our code to suppress trailing newlines in views doesn't
work for styled text, and the text in confirmations is bold. This code checks if
the last character of the text is a line feed, and in this case it isn't; the
escape sequence for turning bold off comes after it.

We should really fix this by improving that mechanism, but this would require
some tricky logic, so as a quick fix, trim trailing (and leading) linefeeds from
the text that we display in a confirmation, before making it bold.
2025-08-08 20:37:44 +02:00
Stefan Haller
a364ee53a8 Cleanup: remove duplicate test case
This is identical to the one right before.
2025-08-08 11:24:43 +02:00
Stefan Haller
c0dcf7d0ad Fix the useHunkModeInStagingView hint in the breaking changes message (#4800)
`useHunkSelectionMode` must have been a left-over from an earlier
iteration of the branch where the config had a different name.
2025-08-06 19:31:18 +02:00
Stefan Haller
d869c23c1a Fix the useHunkModeInStagingView hint in the breaking changes message 2025-08-06 19:26:00 +02:00
Stefan Haller
0262a8de69 Stop bumping our homebrew formula (#4799)
It is being auto-bumped by homebrew, like most formulae these days, so
no reason for us to do that explicitly; and it actually fails with an
error message, so stop trying.
2025-08-06 19:24:46 +02:00
Stefan Haller
04c2be826b Stop bumping our homebrew formula
It is being auto-bumped by homebrew, like most formulae these days, so no reason
for us to do that explicitly; and it actually fails with an error message, so
stop trying.
2025-08-06 14:02:23 +02:00
Stefan Haller
c08903e3ad Stop updating Jesse's homebrew tap (#4797)
The tap is being retired, see
https://github.com/jesseduffield/homebrew-lazygit/pull/3.
v0.54.1
2025-08-06 13:30:43 +02:00
Stefan Haller
5a654b1d56 Stop updating Jesse's homebrew tap
The tap is being retired, see
https://github.com/jesseduffield/homebrew-lazygit/pull/3.
2025-08-06 13:28:07 +02:00
Stefan Haller
525edfbc4d Fix temp dir permission problem on multi-user machines (#4796)
In 3a9dbf7341 we created a global /tmp/lazygit/ folder that contains
the temp directories of each running instance, to avoid polluting /tmp
with multiple folders. The problem with that approach was that the
folder was created with 700 permissions, so if multiple users were using
lazygit on the same machine (e.g. a server), all users except the first
one would get fatal errors on startup.

Fix this by creating temp folders containing the user's uid.

Fixes #4793.
2025-08-06 09:48:14 +02:00
Stefan Haller
71813fdda5 Create a user-specific temp dir to avoid permission problems on multi-user machines
In 3a9dbf7341 we created a global /tmp/lazygit/ folder that contains the temp
directories of each running instance, to avoid polluting /tmp with multiple
folders. The problem with that approach was that the folder was created with 700
permissions, so if multiple users were using lazygit on the same machine (e.g. a
server), all users except the first one would get fatal errors on startup.

Fix this by creating temp folders containing the user's uid.
2025-08-05 22:50:22 +02:00
Stefan Haller
bcb95bd211 Update Fedora section of the README.md file (#4792)
After discussion from the following PR (
https://github.com/jesseduffield/lazygit/pull/4362 ) I have finally
found time to make a PR to update the Fedora section of the README.md
file. I actually use those instructions myself from few different Fedora
and Amazon Linux 2023 machines.

Here is an example of installing lazygit from the Copr:

```
» sudo dnf install lazygit
Updating and loading repositories:
Repositories loaded.
Package                                                              Arch        Version                                                              Repository                                                  Size
Installing:
 lazygit                                                             x86_64      0.48.0-1.fc41                                                        copr:copr.fedorainfracloud.org:dejan:lazygit            21.5 MiB

Transaction Summary:
 Installing:         1 package

Total size of inbound packages is 6 MiB. Need to download 6 MiB.
After this operation, 22 MiB extra will be used (install 22 MiB, remove 0 B).
Is this ok [y/N]: y
[1/1] lazygit-0:0.48.0-1.fc41.x86_64                                                                                                                                          100% |   3.7 MiB/s |   5.7 MiB |  00m02s
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[1/1] Total                                                                                                                                                                   100% |   3.7 MiB/s |   5.7 MiB |  00m02s
Running transaction
[1/3] Verify package files                                                                                                                                                    100% |  52.0   B/s |   1.0   B |  00m00s
[2/3] Prepare transaction                                                                                                                                                     100% |   3.0   B/s |   1.0   B |  00m00s
[3/3] Installing lazygit-0:0.48.0-1.fc41.x86_64                                                                                                                               100% |  44.9 MiB/s |  21.5 MiB |  00m00s
Complete!
```
2025-08-05 12:39:03 +02:00
Dejan Lekić
2e0d66ca24 Updated Fedora section in the README.md file. 2025-08-03 16:58:37 +01:00
Stefan Haller
5175798cb1 README.md: Update Sponsors (#4710)
Automated changes by
[create-pull-request](https://github.com/peter-evans/create-pull-request)
GitHub action
2025-08-02 10:34:01 +02:00