1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-02 01:01:41 +03:00
Commit Graph

6539 Commits

Author SHA1 Message Date
f75c0af6e0 Update disabled message 2025-04-07 09:42:19 +02:00
2db0a024bc Add integration test 2025-04-07 09:42:19 +02:00
1fa9ea7f04 Fix discarding submodule changes in nested folders
The current rules for discarding submodule changes is that no other changed item
must be also selected. There are some bugs with the current implementation when
submodules are in folders.

For example, selecting and discarding a folder with only a nested submodule
change will currently do nothing. The submodule changes should be discarded. The
folder only contains submodule changes so it should be no different than
pressing discard on the submodule entry itself.

Also, I noticed range selecting both the folder and the submodule and then
pressing discard would be incorrectly disallowed.
2025-04-07 09:42:19 +02:00
106b7018dd Cleanup: rename predicate params (test -> predicate) 2025-04-07 09:39:42 +02:00
c488e22abc Bump generics dependency 2025-04-06 22:18:20 -07:00
b0b8ef9cf6 Fix display of renamed files
This broke with #4346 (Add root node in file tree).
2025-04-02 18:15:44 +02:00
267ef70de6 Add test showing problem with the display of renamed files
Renaming a file inside the same directory shows it with its full path in the
tree view, which isn't what we want. We'll fix this in the next commit.

Also adding a few other test cases for moving files; they show that the display
of moved files in tree view isn't ideal. For example, moving file1 from top
level into dir shows it as "R file1 → file1", which isn't distinguishable from
renaming file1 inside dir. I suppose what we would like to have here is
"R ../file1 → file1" or something, but I'll leave that for the future; here I
only want to fix the regression that was introduced with the root item PR.
2025-04-02 18:15:27 +02:00
facc73a88b Allow range drop stashes (#4451)
- **PR Description**

This pr implement dropping multiple stashes feature.

In #3196, dropping multiple stashes feature is listed as possible but
less needed. In practice, I tend to use `apply` instead of `drop` in
order to retrieve some temporary changes in the near future, but the
consequence of this is that at the end of the work week I often have to
go back and manually clean up stashes that I no longer need or that I
simply forgot to drop.

- **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
2025-04-02 11:37:39 +02:00
3a03aebd89 feat: Implement range stash drop
Signed-off-by: gaogao-qwq <gaogaoqwq@gmail.com>
2025-04-02 17:34:35 +08:00
cd2286276c Fix flaky integration test (#4432)
- **PR Description**

The integration test `stash/rename.go` occasionally fails for me
locally. This PR fixes it.

In 8b8343b8a9 we made a change to run newPtyTask from AfterLayout; this
is needed so that the PTY gets the new, updated view size. However, this
created a race condition for integration tests that select a line in a
list view and then expect the main view to have certain content;
sometimes that content gets rendered too late.

I'm surprised that this didn't cause more tests to fail; right now I
only know of one test that occasionally fails because of this, which is
`stash/rename.go`.

Fix this by moving the AfterLayout to inside newPtyTask, and do it only
when we are actually using a PTY (we don't when no pager is configured,
which is the case for integration tests).

The diff is best viewed with "ignore whitespace" turned on.
2025-03-31 10:50:39 +02:00
10f29bc6b4 Fix race with PTYs in integration tests
In 8b8343b8a9 we made a change to run newPtyTask from AfterLayout; this is
needed so that the PTY gets the new, updated view size. However, this created a
race condition for integration tests that select a line in a list view and then
expect the main view to have certain content; sometimes that content gets
rendered too late.

I'm surprised that this didn't cause more tests to fail; right now I only know
of one test that occasionally fails because of this, which is stash/rename.go.

Fix this by moving the AfterLayout to inside newPtyTask, and do it only when we
are actually using a PTY (we don't when no pager is configured, which is the
case for integration tests).

The diff is best viewed with "ignore whitespace" turned on.
2025-03-28 11:16:04 +01:00
d2d13449e4 Cleanup: remove pointless if statement 2025-03-28 11:06:35 +01:00
c55062fe86 Corrected interactive rebase keybind example in README.md (#4426)
- **PR Description**
* The keybind for moving a commit up in the interactive rebase example
of the README file is incorrect.
I've changed it to the keybind present in current versions of Lazygit
2025-03-26 09:10:01 +01:00
55445dca8d Corrected interactive rebase keybinds example in README.md 2025-03-26 08:40:14 +05:30
77651cac35 Add "Absolute path" item to the file view's copy menu (#4410)
- **PR Description**

Make it possible to copy the absolute path of a file to the clipboard.

Addresses #4409.
2025-03-25 10:03:41 +01:00
a8f6b04ff3 Add "Absolute path" item to the file view's copy menu
Rename the existing item to "Relative path".
2025-03-25 10:00:56 +01:00
200e490398 Fix checking out a file from a range selection of commits (#4423)
- **PR Description**

When selecting a range of commits by selecting the top one and then
pressing shift-down to create a range, and then pressing enter and
checking out one of the files by pressing `c`, you would get the file
checked out with its state at the bottom end of the range, which is not
what you want; it is expected to check out the file at the state that
the diff shows it changes to. (And if the file was only created in the
middle of that range, trying to check it out would result in an error.)
Fix this by paying attention to a "from-to" range selection, and
checking out the file at the "to" state.

Related to #4420.
2025-03-25 09:58:34 +01:00
d2059df543 Fix the bug mentioned in the previous commit 2025-03-25 09:56:01 +01:00
61c56c7822 Add test for checking out a file from a range selection of commits
The test shows a misbehavior: even though the diff shows "-one" and "+three",
meaning that "three" is the state we want to check out, we get "one". The reason
is that the checkout file command doesn't pay attention to range selections, it
only looks at the "moving end" of the range. Had we created the range by
selecting "two" and then pressed shift-up to "three", we would have gotten the
expected result.
2025-03-25 09:56:01 +01:00
ac7d8ad025 Add test for checking out a file from a commit
This works, we just didn't have a test for it.
2025-03-25 09:56:01 +01:00
5038fa2d51 Let users define custom icons and color for files on the config file (#4395)
- **PR Description**

_Yet another icon-related PR_

- Implementation on config file for user defined file icons and colors. 
- Fix for some file icon mappings.

I use [eza](https://github.com/eza-community/eza),
[nvim-wewb-devicons](https://github.com/nvim-tree/nvim-web-devicons) and
lazygit; the first ones already let user to override icons and colors
via a config file, so with this change I can customize based on
filenames and file extensions.

| Before | After  |
|--------|--------|
|
![image](https://github.com/user-attachments/assets/bc747d99-25c1-4b74-868e-a31178d7d22e)
|
![image](https://github.com/user-attachments/assets/9a43eda9-d167-4602-a891-8c7c3e530289)
|

```yaml
gui:
  customIcons:
    filenames:
      "CONTRIBUTING.md": { icon: "\uede2", color: "#FEDDEF" }
      "HACKING.md": { icon: "\uede2", color: "#FEDDEF" }
    extensions:
      ".cat":
        icon: "\U000f011b"
        color: "#BC4009"
      ".dog":
        icon: "\U000f0a43"
        color: "#B6977E"
```
2025-03-25 09:55:18 +01:00
0f37f62770 Fix double '#' on hexadecimal colors 2025-03-25 09:48:12 +01:00
8ec37f80b7 Let users to define custom icons and color for files on the config file
Co-authored-by: Stefan Haller <stefan@haller-berlin.de>
2025-03-25 09:48:12 +01:00
1eb00d8d14 Add newlines for correct markdown
See
https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md#md031---fenced-code-blocks-should-be-surrounded-by-blank-lines
2025-03-25 09:48:12 +01:00
7d26a751bd Enhance support for GPG signed tags (#4394)
- **PR Description**

When using gpg signing on tags via the git config `tag.gpgSign=true`, it
is not possible to do a lightweight tag. You must do an annotated tag
(Which is allowed to have an empty description).

This PR augments the existing `WithGpgHandling` helper to allow it to
specifically target commit signing and tag signing. It then uses that
handler, and creates an annotated tag, when the git config demands tag
GPG signing. By default it will launch the tag signing in a new
subprocess. This does require that users click an extra `<enter>` after
creating a signed tag, but this is currently the behavior for signed
commits, so I don't feel too bad about that. If they want, they can use
the LazyGit configuration option of `git.overrideGpg: true` to promise
to LazyGit that they do not need a GPG sub-process (because they
reliably already have gpg-agent or similar running in the background).
This again matches the current behavior for GPG signed commits.

This has no integration test because we don't have the machinery set up
in place to set up a GPG key inside of our integration test framework.

Fixes https://github.com/jesseduffield/lazygit/issues/2955
2025-03-24 08:43:41 +01:00
c765da10f5 Allow passing refresh scope to WithGpgHandling 2025-03-24 08:41:58 +01:00
c06d4e7b18 fix: Make tag operation use GPG helper to run signing in sub-process 2025-03-24 08:41:58 +01:00
f779a5878d refactor: Express WithGpgHelper with a config key parameter 2025-03-24 08:41:58 +01:00
6fb3b7430c refactor: Make commit.gpgSign match official capitalization
The actual usage is case insensitive, so this doesn't actually matter.
But if fills my heart with joy.

The test is case sensitive, but the actual response to `git config
commit.gpgSign` is equivalent to `git config commit.gppsign`
2025-03-24 08:41:58 +01:00
52da806c57 refactor: Rename UsingGpg to make room for Gpg Tag logic 2025-03-24 08:41:58 +01:00
67b0db0bd8 Filter out deprecated user config fields from generated Config.md (#4416)
- **PR Description**

This removes generated Config.md entries that are contain the word:
`deprecated` (case insensitive) anywhere in their header comment.

I think adding in deprecated configs into the reference config clutters
it at best, and encourages users to use those configs at worst. They are
still going to be validated by the schema, but this PR removes them from
the generated config.

I also added in the missing `deprecated` yaml tags in our user config in
anticipation of https://github.com/invopop/jsonschema/pull/79 getting
merged.
2025-03-23 12:47:32 +01:00
a64c32d431 Add in missing "deprecated" yaml tags 2025-03-23 12:45:34 +01:00
b5d4bdbd08 Remove deprecated configs from auto generated config.md 2025-03-23 12:44:24 +01:00
d8e2819e2a Include empty arrays and maps in config docs (#4413)
- **PR Description**

Include empty arrays and maps in the generated Config.md

It's not an ideal solution because there's no indication of what kind of objects
you can add to those maps or arrays, but at least they show up at all (with a
comment containing a link to more information), and that's already an improvement.
2025-03-23 12:40:50 +01:00
c3b099398b Include empty arrays and maps in the generated Config.md
It's not an ideal solution because there's no indication of what kind of objects
you can add to those maps or arrays, but at least they show up at all (with a
comment containing a link to more information), and that's already an
improvement.
2025-03-22 12:35:24 +01:00
0c9154ca9d Add comments with more information
This will be useful in the next commit when these start to show up in the
generated Config.md.
2025-03-22 12:35:24 +01:00
a51bf12661 Commit without pre-commit hooks action is independent on prefix (#4374)
As discussed in #1984, this PR modifies the code such that the `w`
command always commits without pre-commit hooks. The `skipHookPrefix` is
still considered when starting the commit messaged with the prefix in
the regular commit command using `c`.

Skipping pre-commits also works when switching to the editor and adding
a co author from the the `w` command
2025-03-22 11:08:50 +01:00
728f0d9dfa Remove text that is now unused 2025-03-22 11:06:15 +01:00
b102646b20 Commit without pre-commit hooks is independent on prefix
Add verify flag

Add and update integration tests

Rename verify to forceSkipHooks

Adapt CommitSkipHooks integration test to actually use a hook

Remove forceSkipHooks param from OnConfirm et al

Simplify tests
2025-03-22 11:04:28 +01:00
ab9f4af636 [FEAT] Add Recursive Bulk Initialize and Update for Submodules (#4259)
- **PR Description**
This PR adds a new bulk action for submodules.
As I often work with a lot of submodules that are hierarchically
structured, the flag "--recursive" saves a lot of work.
2025-03-22 10:09:41 +01:00
5de735f1ac feat(submodules): add method to bulk init and update submodules 2025-03-22 09:54:32 +01:00
4b4d82e13c Specify a go release minor version (#4393)
- **PR Description**
Since they started releasing .0 versions with 1.21.0, the go version
need to be a full release version specifier and not a go language
version. They relented and added support for defaulting to a .0 release
if none is specified in later 1.23.x releases, but for users with local
1.21 or 1.22 toolchains the lack of a full release specifier breaks
them. And going forwards this is more technically correct anyway.

See https://github.com/golang/go/issues/62278#issuecomment-1693620853
2025-03-21 15:57:21 +01:00
14ba0e7523 Specify a go release minor version
Since they started releasing .0 versions with 1.21.0, the go version
need to be a full release version specifier and not a go language
version. They relented and added support for defaulting to a .0 release
if none is specified in later 1.23.x releases, but for users with local
1.21 or 1.22 toolchains the lack of a full release specifier breaks
them. And going forwards this is more technically correct anyway.

See https://github.com/golang/go/issues/62278#issuecomment-1693620853
2025-03-21 08:28:18 -04:00
1107462c3e Add root node in file tree (#4346)
- **PR Description**

If files at the root level of the repository have changed, there was no
way to see the combined diff of all of them. Fix this by inserting a `/`
item in this case. This is useful in repositories such as git.git, which
have all their `.c` files at root level (gasp).

If only files inside some folder have changed, the root item gets
compressed away automatically, so nothing changes for that case (which I
guess should be more common for most people).

Addresses #4331.

- **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
2025-03-21 08:08:09 +01:00
26459523f5 Add a root item ("/") if files at top level have changed 2025-03-21 08:04:58 +01:00
0b42cfb568 Make Node.path private
This is in preparation for changing the meaning of path in the next commit.
2025-03-20 12:31:34 +01:00
3f4cb8bdda Use Path directly instead of GetPath getter inside the filetree package 2025-03-20 12:31:34 +01:00
53090b2c45 Use GetPath accessor outside of filetree package
In preparation of making it private to the package.
2025-03-20 12:31:34 +01:00
2dfc3491bd Rename Name to Path in File and CommitFile
Name was very confusing and misleading.
2025-03-20 12:31:34 +01:00
0b5504aa98 Cleanup: make integration test assertions for files panel more specific
Assert the entire lines using Equals instead of Contains. This makes the tests a
bit easier to read, and it makes it much easier to decide how they need to be
changed when we change the layout (like we do in the last commit of this
branch).

It is true that this requires changing all these tests for any future UI
changes, but I think this is a good price to pay; those adaptions are trivial
and can be done without thinking.
2025-03-20 11:58:50 +01:00