1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-21 04:25:53 +03:00

6339 Commits

Author SHA1 Message Date
Wayne Bowie
aad3dc42a7 Allow on prem Azure DevOps Server pull request 2025-01-02 15:10:02 +11:00
Stefan Haller
f884cc2af9
Allow to switch branches in Commit View (#4115) (#4117)
- **PR Description**

When the user checks out a commit which has a local branch ref attached
to it, they can select between checking out the branch or checking out
the commit as detached head. If no local branch is attached to the
commit, the behavior is like before: They are asked to confirm, if they
want to checkout the commit as detached head.

Requested in #4115.

Note: I tried also to consider remote branches, but because I wasn't
able to correlate remote branches to their commits, I deferred it and
leave it open for later improvement.
2025-01-01 14:59:20 +01:00
Sebastian Flügge
f4c8287143 Allow to switch branches in Commit View
When the user checks out a commit which has a local branch ref attached
to it, they can select between checking out the branch or checking out
the commit as detached head.
2025-01-01 14:55:12 +01:00
Jesse Duffield
03d7bc854e
Bump kill package (#4137)
Closes https://github.com/jesseduffield/lazygit/issues/3008

This should reduce the instances of killing random processes on windows.

See https://github.com/jesseduffield/kill/pull/1

- **PR Description**

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

* [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))
* [ ] Tests have been added/updated (see
[here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md)
for the integration test guide)
* [x] Text is internationalised (see
[here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#internationalisation))
* [x] 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))
* [x] Docs have been updated if necessary
* [x] 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-01-01 23:56:58 +11:00
Jesse Duffield
fdf1643f63 Bump kill package
This should reduce the instances of killing random processes on windows.

See https://github.com/jesseduffield/kill/pull/1
2025-01-01 23:45:53 +11:00
Stefan Haller
d93be027b6
docs: Stylize and correct the NixOS section in README.md (#4135)
- **PR Description**

configuration.nix is a file, and most files in the README.md are
stylized as code blocks. `environment.systemPackages` is actually just a
code block, and should be stylized as such.
2025-01-01 13:11:15 +01:00
wadsaek
fd5be11370 Stylize and correct the NixOS section in README.md
configuration.nix is a file, and most files in the README.md are
stylized as code blocks. `environment.systemPackages` is actually just a
code block, and should be stylized as such
2025-01-01 12:48:19 +02:00
Jesse Duffield
1e1fba4ce6
Add vision and design principles doc (#4053)
I want to spell out the design principles behind Lazygit so that our
priorities are clear and it's easier to make UX decisions (especially
for early contributors).

It's not possible to codify this in a way that will resolve all disputes
but I think it's worthwhile to enumerate some of the things that keep
coming up in our discussions about X or Y feature.

This is a very rough draft (effectively a brain-dump). So I expect
plenty of feedback :)

CC @stefanhaller @karimkhaleel @mark2185 @afhoffman @AzraelSec

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

* [ ] Docs have been updated if necessary
2024-12-31 16:53:23 +11:00
Jesse Duffield
b174791490 Add vision and design principles doc
I want to spell out the design principles behind lazygit so that our priorities are clear
and it's easier to make UX decisions
2024-12-31 16:50:06 +11:00
Stefan Haller
a4ecd293f9
Fix hang when returning from shell command (#4126)
- **PR Description**

In #3793 we changed the execution of shell commands to use an
interactive shell (-i), because this allows users to use aliases or
shell functions, which is a nice convenience.

Since then, however, many users have reported problems with lazygit not
coming back to the foreground after executing a shell command. Some
users report that appending "; exit" to the end of the command line
solves this. I don't really understand what the cause of this problem
was, or why appending "; exit" solves it, but if it helps, let's do it.

Fixes #3903, #3923, #3937.

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

* [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))
* [ ] 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
* [x] You've read through your own file changes for silly mistakes etc
2024-12-28 14:56:54 +01:00
Stefan Haller
5fac40c129 Fix hang when returning from shell command
In 5a3049485c we changed the execution of shell commands to use an interactive
shell (-i), because this allows users to use aliases or shell functions, which
is a nice convenience.

Since then, however, many users have reported problems with lazygit not coming
back to the foreground after executing a shell command. Some users report that
appending "; exit" to the end of the command line solves this. I don't really
understand what the cause of this problem was, or why appending "; exit" solves
it, but if it helps, let's do it.
2024-12-28 14:53:57 +01:00
Stefan Haller
ec410b2ae6
Don't preserve commit message when it's unchanged from initial message (#4110)
- **PR Description**

Sometimes we populate the commit message panel with a pre-created commit
message. The two cases where this happens is:
- you type `w` to commit, in which case we put the skipHookPrefix in the subject
- you have a commitPrefix pattern, in which case we match it against the branch
  name and populate the subject with the replacement string if it matches

In either case, if you have a preserved commit message, we use that.

Now, when you use either of these and then cancel, we preserve that initial,
unchanged message and reuse it the next time you commit. This has two problems:
it strips spaces, which is a problem for the commitPrefix patterns, which often
end with a space. And also, when you change your config to experiment with
commitPrefix patterns, the change seemingly doesn't take effect, which can be
very confusing.

To fix both of these problems, only preserve the commit message when it is not
identical to the initial message.

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

* [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] 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
* [x] You've read through your own file changes for silly mistakes etc
2024-12-23 12:32:12 +01:00
Stefan Haller
3a30211099 Don't preserve commit message when it's unchanged from initial message
Sometimes we populate the commit message panel with a pre-created commit
message. The two cases where this happens is:
- you type `w` to commit, in which case we put the skipHookPrefix in the subject
- you have a commitPrefix pattern, in which case we match it against the branch
  name and populate the subject with the replacement string if it matches

In either case, if you have a preserved commit message, we use that.

Now, when you use either of these and then cancel, we preserve that initial,
unchanged message and reuse it the next time you commit. This has two problems:
it strips spaces, which is a problem for the commitPrefix patterns, which often
end with a space. And also, when you change your config to experiment with
commitPrefix patterns, the change seemingly doesn't take effect, which can be
very confusing.

To fix both of these problems, only preserve the commit message when it is not
identical to the initial message.
2024-12-23 12:28:52 +01:00
Stefan Haller
ec92d92bf4 Extend commitPrefix test to cancel without changing the commmit message
The test shows that we lose a space when cancelling and committing again.
2024-12-23 12:28:52 +01:00
Stefan Haller
87d5da511e Cleanup: reformat to make the test setup code easier to read
- break it to separate lines
- use backticks for pattern so we need less quoting
- don't unnecessarily quote forward slash in pattern
2024-12-23 12:28:52 +01:00
Stefan Haller
e29ddf46d2
Wrap lines in staging view (#4098)
- **PR Description**

Add a user config (on by default) to turn on line wrapping in the
staging view (and custom patch building view).

Fixes #3558.

This is a bit of a longer PR because I had to fix a bunch of things to
make this possible, and because it takes much more than just turning on
`Wrap` on the staging view.

Usually when I make changes to gocui I include them in the lazygit PR
for easier review; this time, however, the changes required touching
gocui's tests, which are not included in our vendored copy, so I made a
[PR in gocui](https://github.com/jesseduffield/gocui/pull/67) to be
reviewed there, and only included the squashed changes here.

Hot-reloading of the new user config is not perfect: if the staging view
is focused, you need to escape out of it and enter it again for the
change to take affect. I wasn't sure it's worth adding code to fix this.

As for tests: I didn't find a way to add an integration test for this,
as the view geometry is not fixed when you run them locally. But I
didn't look into this very deeply.

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

* [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] Tests have been added/updated (see
[here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md)
for the integration test guide)
* [x] Text is internationalised (see
[here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#internationalisation))
* [x] 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
* [x] You've read through your own file changes for silly mistakes etc
2024-12-23 12:27:34 +01:00
Stefan Haller
15288b7bf4 Add user config to enable line wrapping in the staging view
It is enabled by default, because I think it's often helpful, and rarely in the
way. I bet most user won't even notice.
2024-12-23 12:24:09 +01:00
Stefan Haller
2828fb94fb Rewrap patch when view width changes
This makes it so that when the staging view is resized, we keep the same patch
line selected (as opposed to the same view line, which may correspond to a
different patch line after resizing). It doesn't seem like a terribly important
feature for resizing the window, but it is essential when initially entering the
staging view: we select the first line of the first hunk in this case, but we do
that before layout runs. At layout time the view is then split into
unstaged/staged changes, and if this split is horizontal, the view gets narrower
and may be wrapped in a different way. With this commit we ensure that the first
line of the first hunk is still selected after that.
2024-12-23 12:24:09 +01:00
Stefan Haller
5213a9de32 Handle wrapped lines in patch explorer state
So far, lines in the view corresponded 1:1 to lines in the patch. Once we turn
on wrapping for the staging view (which we don't do yet), this is no longer
true, so we need to convert from view lines to patch lines or vice versa all
over the place.
2024-12-23 12:24:09 +01:00
Stefan Haller
b7444b9a49 Return arrays with line indices from WrapViewLinesToWidth
This makes it easy to convert an original line index to a wrapped line index, or
vice versa.
2024-12-23 12:24:09 +01:00
Stefan Haller
5d3b3c6656 Extract helper function
This doesn't improve the code much in the current state, but we'll add some more
code to this helper function in the next commit, which makes it worth it.
2024-12-23 12:24:09 +01:00
Stefan Haller
65a28c4c3b Convert tabs to spaces in WrapViewLinesToWidth
We haven't needed this before since we were only using the function for text in
confirmations and menus, which is unlikely to contain tabs. We are going to use
it for patches in the staging view though, which often do.
2024-12-23 12:24:09 +01:00
Stefan Haller
1f2cb35cc9 Refactor: move wrapMessageToWidth to utils/lines.go
to make it more generally usable by clients other than ConfirmationHelper, which
we will do later in this branch. Rename it to WrapViewLinesToWidth while we're
at it.

Add tests; in particular, add a sanity check that we wrap lines the same way as
gocui does. The tests that are added here are the same ones as in gocui for its
lineWrap function, but we'll extend them a bit in later commits in this branch.
2024-12-23 12:24:09 +01:00
Stefan Haller
2b49865d0d Fix: set state to nil when patch building view loses focus
This is also what we do in the staging controller, and it makes it so that when
you exit the patch building view and then enter it again (for another file, or
the same one) we select the first hunk again.
2024-12-23 12:24:09 +01:00
Stefan Haller
da47498066 Cleanup: remove unused log parameter of patch_exploring.NewState 2024-12-23 12:24:09 +01:00
Stefan Haller
2f1564d288 Cleanup: remove unused method RangeStartLineIdx 2024-12-23 12:24:09 +01:00
Stefan Haller
3610f13418 Fix several bugs in wrapMessageToWidth
This corresponds to the following fixes in gocui's lineWrap function:
- https://github.com/jesseduffield/gocui/pull/67/commits/86cf561ef493
- https://github.com/jesseduffield/gocui/pull/67/commits/24746d5cd6ee
- https://github.com/jesseduffield/gocui/pull/67/commits/4b97941c4ec6
2024-12-23 12:24:09 +01:00
Stefan Haller
2417b70acd Bump gocui 2024-12-23 12:24:09 +01:00
Stefan Haller
b61c395278
Fix moving a commit across a branch boundary in a stack of branches (#4096)
- **PR Description**

When moving the first commit of the second branch in a stack down by one
(across the branch head of the first branch), the current behavior is
broken: we move the commit only past the update-ref todo of branch1,
which means the order of commits stays the same and only the branch head
icon moves up by one. However, we move the selection down by one, so the
wrong commit is selected now. This is especially bad if you type a bunch
of ctrl-j quickly in a row, because now you are moving the wrong commit.

There would be two possible ways to fix this:
1) keep the moving behavior the same, but don't change the selection
2) change the behavior so that we move the commit not only past the
update-ref, but also past the next real commit.

You could argue that 1) is the more desirable fix, as it gives you more
control over where exactly the moved commit goes; however, it is much
trickier to implement, so we go with 2) for now. If users need more
fine-grained control, they can always enter an interactive rebase first.

While we're at it, also fix moving a commit across an exec todo in an
interactive rebase, which is currently broken (it moves the commit one
too far).

Fixes #4040.

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

* [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] 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
* [x] You've read through your own file changes for silly mistakes etc
2024-12-23 12:20:47 +01:00
Stefan Haller
a9ef69b9c7 Fix moving a commit across a branch boundary in a stack
See the previous commit for a detailed explanation.
2024-12-23 12:18:48 +01:00
Stefan Haller
cf27974ea3 Add test for moving a commit across a branch boundary in a stack
The test demonstrates that the behavior is undesirable right now: we move the
commit only past the update-ref todo of branch1, which means the order of
commits stays the same and only the branch head icon moves up by one. However,
we move the selection down by one, so the wrong commit is selected now. This is
especially bad if you type a bunch of ctrl-j quickly in a row, because now you
are moving the wrong commit.

There are two possible ways to fix this:
1) keep the moving behavior the same, but don't change the selection
2) change the behavior so that we move the commit not only past the update-ref,
   but also past the next real commit.

You could argue that 1) is the more desirable fix, as it gives you more control
over where exactly the moved commit goes; however, it is much trickier to
implement, so we go with 2) for now (and that's what the commented-out
"EXPECTED" section documents here). If users need more fine-grained control,
they can always enter an interactive rebase first.
2024-12-23 12:18:48 +01:00
Stefan Haller
83356d441f Fix moving a commit across an exec todo 2024-12-23 12:18:48 +01:00
Stefan Haller
49c50fc95c Add tests for moving across an exec todo
These don't work correctly yet, they move it one too far.
2024-12-23 12:18:48 +01:00
Stefan Haller
b719dc4d8e Add tests for moving a commit across an update-ref todo
This works correctly, we just didn't have test coverage for it.
2024-12-23 12:18:48 +01:00
Stefan Haller
75121384a3
Drop merge commits (#4094)
- **PR Description**

Allow deleting a merge commit. We only allow this when the merge commit
is the only selected item, and only outside of a rebase. The reason for
this is that we don't show the "label" and "reset" todos in lazygit, so
deleting a merge commit would leave the commits from the branch that is
being merged in the list as "pick" commits, with no indication that they
are going to be dropped because they are on a different branch, and the
merge commit that would have brought them in is gone. This could be very
confusing.

Fixes #3164.

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

* [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] Tests have been added/updated (see
[here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md)
for the integration test guide)
* [x] 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
* [x] You've read through your own file changes for silly mistakes etc
2024-12-23 12:17:26 +01:00
Stefan Haller
078445db63 Allow deleting a merge commit
For non-merge commits we change "pick" to "drop" when we delete them. We do this
so that we can use the same code for dropping a commit no matter whether we are
in an interactive rebase or not. (If we aren't, we could just as well delete the
pick line from the todo list instead of setting it to "drop", but if we are, it
is better to keep the line around so that the user can change it back to "pick"
if they change their mind.)

However, merge commits can't be changed to "drop", so we have to delete them
from the todo file. We add a new daemon instruction that does this.

We still don't allow deleting a merge commit from within an interactive rebase.
The reason is that we don't show the "label" and "reset" todos in lazygit, so
deleting a merge commit would leave the commits from the branch that is being
merged in the list as "pick" commits, with no indication that they are going to
be dropped because they are on a different branch, and the merge commit that
would have brought them in is gone. This could be very confusing.
2024-12-23 12:12:45 +01:00
Stefan Haller
64eb3d560b Simplify finding rebase todos
One of the comments we are deleting here said:

  // Comparing just the hash is not enough; we need to compare both the
  // action and the hash, as the hash could appear multiple times (e.g. in a
  // pick and later in a merge).

I don't remember what I was thinking when I wrote this code, but it's nonsense
of course. Maybe I was thinking that the hash that appears in a "merge" todo
would be the hash of the commit that is being merged in (which would then
actually appear in an earlier pick), but it isn't, it's the hash of the merge
commit itself (so that the rebase can reuse its commit message). Which means
that hashes are unique, no need to compare the action.
2024-12-23 12:12:45 +01:00
Stefan Haller
2823a7cff0 Make equalHash more correct
So far it didn't have to handle the case where one hash is empty and the other
isn't, but in the next commit we need that, so let's handle that case correctly.
There's enough logic in the function now that it's worth covering it with tests.
2024-12-23 12:12:45 +01:00
Stefan Haller
d5f2fb6003 Disable dropping merge commits if it's not a single selection 2024-12-23 12:12:45 +01:00
Stefan Haller
bd0d9ef259 Disable fixup/squash for merge commits 2024-12-23 12:12:45 +01:00
Stefan Haller
75d2fb1df2 Disable moving merge commits
Not much of a change in behavior, because moving merge commits was already not
possible. However, it failed with a cryptic error message ("Todo fa1afe1 not
found in git-rebase-todo"), so disable it properly instead.
2024-12-23 12:12:45 +01:00
Stefan Haller
13e9e1de83
Fix typos (#4121)
- **PR Description**

This PR fixes typos in the `allBranchesLogCmd` description
2024-12-18 14:17:28 +01:00
Sergey Kochetkov
93a37cf83e
fix(config): allBranchesLogCmd description typo 2024-12-18 11:42:50 +01:00
Stefan Haller
0f269183de
remove duplicate secondary MouseWheelUp keybind (#4120)
- **Remove duplicate secondary view MouseWheelUp keybinding**

The `MouseWheelUp` keybind for the secondary view was duplicated in the
array.
2024-12-17 22:46:27 +01:00
Samuel Dominguez
4268701606 reorder keybinds to main/down, main/up, secondary/down, secondary/up 2024-12-17 16:57:23 +00:00
Samuel Dominguez
799827ee0e remove duplicate secondary MouseWheelUp keybind 2024-12-17 14:00:21 +00:00
Stefan Haller
4a7cf6040e
Show the number of lines changed per file in working file tree view (#4015)
- **PR Description**
Implements Issue #3643
Adds the number of line changes to the end of each file line in the
Files view.
Also adds the possibility for the user to enable and disable this
feature through the UserConfig.
<img width="323" alt="screenshot"
src="https://github.com/user-attachments/assets/6f818dd4-fbf5-49f2-b338-1b1fcc73f73a">

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

* [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] 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))
* [x] 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
* [x] You've read through your own file changes for silly mistakes etc
2024-12-08 12:14:06 +01:00
johannaschwarz
f455f99705 Add user config gui.showNumstatInFilesView
When enabled, it adds "+n -m" after each file in the Files panel to show how
many lines were added and deleted, as with `git diff --numstat` on the command
line.
2024-12-08 12:09:47 +01:00
Stefan Haller
f3a5c184e1
Fix issues with opening links and files using WSL (#3850)
- **PR Description**

This PR fixes to issues with the current implementation of the OSConfig
for WSL:

**File explorer**
When using the file explorer from WSL, for instance by pressing "o" in
the "Files" menu, the explorer always opens on the default landing page.
This is caused by the filepath being expressed in WSL format instead of
the expected Windows format. For instance:
- "/home/myuser/path/to/my/file" should be
"\\wsl$\MyDistroName\home\myuser\path\to\my\file"
- "/mnt/c/path/to/my/file" should be "C:\path\to\my\file"

There's a utility to do that in WSL, `wslpath`. We use it in the Open to
format the filename before passing it to the Powershell command

**Link URLs**
Opening links containing ampersands inside lazygit (a pull-request
creation page in BitBucket Server, for instance) returns the following
Powershell error:
> The ampersand (&) character is not allowed. The & operator is reserved
> for future use; wrap an ampersand in double quotation marks ("&") to
> pass it as part of a string.

We fix it by enclosing the URL in single quotes.

**Notes on this PR**
This is my first PR on this repo, please tell me if something is needed.
I read the contributing guide.
The OS-specific logic doesn't appear to be tested in integration and
unit tests, so I didn't add tests.

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

* [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))
* [ ] 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
* [x] You've read through your own file changes for silly mistakes etc
2024-12-04 09:46:28 +01:00
Baptiste Ottino
1543b83d10 Fix opening links containing ampersands (&) in WSL
Opening links containing ampersands inside lazygit (a pull-request
creation page in BitBucket Server, for instance) returns the following
Powershell error:
> The ampersand (&) character is not allowed. The & operator is reserved
> for future use; wrap an ampersand in double quotation marks ("&") to
> pass it as part of a string.

We fix it by enclosing the URL in single quotes.
2024-12-04 09:43:30 +01:00