1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-13 00:07:59 +02:00

6469 Commits

Author SHA1 Message Date
Stefan Haller
3b85307f67 Filter out [dev] comments when generating config doc 2025-02-23 20:55:28 +01:00
Karim Khaleel
30e9bf8a75 Use refs in jsonschema userconfig generator
This makes it possible to use recursive structures in the user config.
2025-02-23 20:55:28 +01:00
Stefan Haller
62c6ba7d57
Don't rewrite config file unnecessarily when it contains commitPrefixes (#4311)
- **PR Description**
The issue statement https://github.com/jesseduffield/lazygit/issues/4310
is exactly right, that the `commitPrefixes` element improperly claims
that it has modified the yaml whenever it exists, even if it does not
need to do changes.

Now, we initialize it to false, only set it to true inside our
modification section of the for loop.
Tests updated to add one that would have failed prior to this change.
The syntax change to use named struct fields instead of positional
fields felt nice since I wanted to just define on a single one of them
the `assertAsString` field.

The reason that field is required at all is the 2nd complaint on the
linked issue about the formatting change, is I don't believe is
something that is trivial to fix. I observed on existing migrations
before I wrote this one. But if it is easy to wrap up into this, let me
know!

Also, how do we normally backport things into previous releases? We'll
probably want this to make it into a `0.47.2`.

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

* [ ] 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-02-23 20:44:23 +01:00
Chris McDonnell
72b9e8328d Make commit prefixes migration only return true if it enters if statement 2025-02-23 19:01:03 +01:00
Stefan Haller
38ab7ebefb Change TestCommitPrefixMigrations to compare only strings 2025-02-23 18:59:37 +01:00
Stefan Haller
4b30bc6dd3 Change test to use named struct fields instead of positional fields
This makes the tests a little bit easier to read, the multi-line string literals
make this otherwise a little difficult.
2025-02-23 18:59:37 +01:00
Stefan Haller
626ca18a23
Use indentation of 2 when rewriting auto-migrated config file (#4312)
- **PR Description**

Use indentation of 2 when rewriting auto-migrated config file. This
seems to be what most people use when indenting yaml files, and it seems
to make more sense than the default of 4. We also use it the example
config in Config.md.
2025-02-23 18:23:17 +01:00
Stefan Haller
87c3e75811 Use indentation of 2 when rewriting auto-migrated config file
This seems to be what most people use when indenting yaml files, and it seems to
make more sense than the default of 4.

We also use it the example config in Config.md.
2025-02-23 11:32:12 +01:00
Stefan Haller
1e05055fff
fix: Disable global keybinds when confirmation is active (#4284)
- **PR Description**

Adds a guard around all global keybinds except for quitting the
application when a popup window is active. Users must now confirm, or
cancel, the popup prior to taking other action. This fixes
https://github.com/jesseduffield/lazygit/issues/4052, and will also
prevent other such confusing cases where popups are created, but never
removed.
2025-02-23 08:47:37 +01:00
Chris McDonnell
0ef3832e59 docs: Add reference to confirmation key to intro message 2025-02-23 08:44:48 +01:00
Chris McDonnell
b766ff9c83 Disable global keybinds while popups are active 2025-02-23 08:44:48 +01:00
Jesse Duffield
b2fd6128f6
Fix auto-release schedule (#4308)
It was previously on each saturday. Splitting this out from
https://github.com/jesseduffield/lazygit/pull/4307 in case that takes
longer to merge.

- **PR Description**

- **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-02-22 23:07:19 +11:00
Jesse Duffield
a81f9ea97c Fix auto-release schedule
It was previously on each saturday
2025-02-22 23:03:42 +11:00
Stefan Haller
101bbb0ac5
Fix race condition with reselecting the focused branch and rendering (#4268)
In ff4ae4a544 we changed the order of the calls to render before
selecting the branch. This was done only to save an extra call to
ReApplyFilter, which is done by refreshView; I claimed that the order of
refreshView vs. SetSelectedLineIdx doesn't matter here. I guess I was
wrong about that, it makes the integration test
custom_commands/suggestions_preset.go flaky. To fix this, put the
refreshView call back to where it was (after the SetSelectedLineIdx
call), and instead insert an extra call to ReApplyFilter where necessary
to fix the bug that ff4ae4a544 was trying to fix.

I still don't think there was any user facing problem caused by this
(@ChrisMcD1 correct me if I'm wrong), so I don't think we need to cut a
0.46.1 release with the fix (otherwise it would have been a regression
in 0.46), and I only label it as `maintenance` because it only fixes CI.

Fixes #4267.
v0.47.1
2025-02-22 10:10:41 +01:00
Stefan Haller
3e11e34181 Fix race condition with reselecting the focused branch and rendering
In ff4ae4a544 we changed the order of the calls to render before selecting the
branch. This was done only to save an extra call to ReApplyFilter, which is done
by refreshView; I claimed that the order of refreshView vs. SetSelectedLineIdx
doesn't matter here. I guess I was wrong about that, it makes the integration
test custom_commands/suggestions_preset.go flaky. To fix this, put the
refreshView call back to where it was (after the SetSelectedLineIdx call), and
instead insert an extra call to ReApplyFilter where necessary to fix the bug
that ff4ae4a544 was trying to fix.
2025-02-22 10:07:27 +01:00
Jesse Duffield
daf1fd3419
Update README.md (#4305)
- **PR Description**

- **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
-->
v0.47.0
2025-02-22 08:35:24 +11:00
Jesse Duffield
54d0ebeff0
Update README.md 2025-02-22 08:34:35 +11:00
Jesse Duffield
af9699e59a
Add --include-untracked flag to stash show command (#3932)
- **PR Description**

This PR fixes #3931 by adding `--include-untracked` to `git stash show`
command. Untracked stashed file diff is now shown in the main view.

![before this
PR](https://github.com/user-attachments/assets/81097c71-3764-4467-a960-a87c51921139)
*Before: the untracked stashed file is not shown in lazygit*.

![after this
PR](https://github.com/user-attachments/assets/4aafd5f6-5305-4f9b-9068-1570d22e755c)
*After: the untracked stashed file diff is shown in lazygit*.

## One Issue

This PR does not fix the fact that untracked stashed files are not shown
in the list of files in the "Stash" panel when entering a stash entry, I
could not find an easy way to make them appear there.

* [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
2025-02-22 08:26:54 +11:00
Matteo Golinelli
d92c6d116b Replace --include-untracked with -u in stash show command for compatibility and update failing tests 2025-02-22 08:17:38 +11:00
Matteo Golinelli
343a3e466a Add --include-untracked flag to stash show command 2025-02-22 08:17:38 +11:00
Stefan Haller
16f5348790
Validate user config keybindings (#4275)
- **PR Description**

This improves the user experience when users try to use an invalid key
name in their config, either for one of our standard keybindings or for
the key of a custom command.

Fixes half of #4256 (only the keybindings aspect of it, not the context
names).
2025-02-21 13:24:41 +01:00
Stefan Haller
5979b40546 Validate keys of custom commands 2025-02-21 13:20:53 +01:00
Stefan Haller
a5f78d3222 Validate that Universal.JumpToBlock array has 5 elements
The code that uses this panics if it has fewer.
2025-02-21 13:20:53 +01:00
Stefan Haller
f3791e6ab6 Validate keybindings 2025-02-21 13:20:53 +01:00
Stefan Haller
130801dbf6 Add a few missing keybindings to docs/keybindings/Custom_Keybindings.md 2025-02-21 13:20:33 +01:00
Stefan Haller
67bb7f62c5 Move labelByKey to config package 2025-02-21 13:20:33 +01:00
Stefan Haller
52b1c42d38
Add gui.tabWidth config (#4291)
- **PR Description**

This adds a config `gui.tabWidth` that can be used to change the tab
width from the default of 4 to a different number. It affects everything
that's shown in the main view, but is probably mostly relevant for
diffs.

When using a pager, the pager needs to be configured separately for the
same tab width.

This may often be different for different repos, so it may make sense to
put it in a repo-local config file.

In some cases this may still not be flexible enough, e.g. in
multi-language projects that use different tab widths for the different
file types; but it's better than before and was easy to do...

Addresses #4290.
2025-02-20 09:17:05 +01:00
Stefan Haller
11616190ee Add a gui.tabWidth config
Affects everything that is shown in the main view, but probably mostly relevant
for diffs.
2025-02-20 09:13:56 +01:00
Stefan Haller
e5137b86cf Add a tabWidth parameter to WrapViewLinesToWidth to match gocui 2025-02-20 09:13:56 +01:00
Stefan Haller
ac3824bd7c Bump gocui 2025-02-20 09:13:54 +01:00
Stefan Haller
56c9d5abeb
Add a "Copy to clipboard" menu to the Commit Files panel (#4271)
- **PR Description**

Add a "Copy to clipboard" menu to the Commit Files panel

This is very similar to the same menu in the Files panel, except that it
works on whatever diff is currently shown in the main view, including
range diffs either in diffing mode (shift-W), or from a range selection
of commits.

The menu has some code duplication with the existing menu in the Files
panel, but actually not so much. The first two menu items could be
unified once we have generalized the filetrees, but these are pretty
trivial; the other two menu items are sufficiently different that
unifying them is not practical, I think.

Fixes #4254.
2025-02-19 18:52:34 +01:00
Stefan Haller
c9196812a2 Add a "Copy to clipboard" menu to the Commit Files panel
This is very similar to the same menu in the Files panel, except that it works
on whatever diff is currently shown in the main view, including range diffs
either in diffing mode (shift-W), or from a range selection of commits.
2025-02-19 18:50:12 +01:00
Stefan Haller
caca62b89e Cleanup: simplify and tighten test expectations related to clipboard
Change our fake clipboard command to not append a linefeed; that's closer to
what the production code does.

This allows us to use Equals instead of Contains for checking the clipboard
contents.

Finally, use FileSystem().FileContent() to assert the clipboard contents,
instead of selecting the clipboard file and then checking the diff view.
2025-02-19 18:50:12 +01:00
Stefan Haller
e15e4951ab
Fix documentation of gui.showFileTree config (#4282)
Change `~` to `` ` `` as it's the correct key.
2025-02-17 20:19:10 +01:00
Adrian Gielniewski
e3944c1707 Fix description of showFileTree
Change '~' to '`' as it's the correct key.

Signed-off-by: Adrian Gielniewski <adrian.gielniewski@gmail.com>
2025-02-17 20:14:11 +01:00
Stefan Haller
0d155e1478
feat: Support multiple commit prefixes (#4261)
- **PR Description**
This implementation, unlike that proposed in
https://github.com/jesseduffield/lazygit/pull/4253 keeps the yaml schema
easy, and does a migration from the single elements to a sequence of
elements.

Addresses https://github.com/jesseduffield/lazygit/issues/4194
2025-02-17 20:02:12 +01:00
Chris McDonnell
2fa4ee2cac feat: Support multiple commit prefixes
This implementation, unlike that proposed in https://github.com/jesseduffield/lazygit/pull/4253
keeps the yaml schema easy, and does a migration from the single
elements to a sequence of elements.
2025-02-17 19:58:31 +01:00
Stefan Haller
a7bfeca9c0
Add option to copy commit body (#4274)
I based this off of the existing `CommitMessage` option in the copy
commit attributes menu.
2025-02-17 18:56:44 +01:00
Chris McDonnell
ab23539c0c Add option to copy commit message body 2025-02-17 18:43:39 +01:00
Jesse Duffield
01eece3737
Use personal access token to push tag (#4266)
Github actions refuses to trigger a workflow from another workflow, but
if you use your own personal access token (in this case,
GITHUB_API_TOKEN), it should work.

- **PR Description**

- **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-02-15 15:55:20 +11:00
Jesse Duffield
57220ba478 Use personal access token to push tag
Github actions refuses to trigger a workflow from another workflow, but
if you use your own personal access token (in this case,
GITHUB_API_TOKEN), it should work.
2025-02-15 15:54:47 +11:00
Jesse Duffield
6636d0c15a
Fix auto-release workflow (#4265)
The latest_tag env var wasn't defined when it was used.

- **PR Description**

- **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
-->
v0.46.0
2025-02-15 15:37:50 +11:00
Jesse Duffield
269d89ea51 Fix issue where latest tag wasn't obtained early enough in auto-release script 2025-02-15 15:36:54 +11:00
Jesse Duffield
dcf264b182
README.md: Update Sponsors (#4177)
Automated changes by
[create-pull-request](https://github.com/peter-evans/create-pull-request)
GitHub action
2025-02-15 15:24:27 +11:00
github-actions[bot]
e37d7d5ad2 README.md: Update Sponsors 2025-02-15 04:23:38 +00:00
Jesse Duffield
988162848a
Don't try killing processes if we already know the command finished + reduce error logging noise on Windows (#4231)
- **PR Description**

I was tinkering around with the code and then checking associated logs
but even with LOG_LEVEL=error, I found there was a lot of noise on
Windows.

This PR fixes two such sources:
1. Navigating through files in the Files panel
1. Navigating through branches in the Branches panel when there are a
lot of commits (e.g. this repo)

More details in the comments below.

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

* [ ] 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

<!--
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-02-15 15:23:26 +11:00
Brandon
ed9519a241 Suppress error logs when killing process on Windows
There is a string check here to suppress the failure logs due to this reason but on Windows, the string is different ("exit status 1").
2025-02-15 14:51:35 +11:00
Brandon
7731311674 Don't try killing processes if we already know the command finished
This may lead to unrelated processes being killed on Windows (https://github.com/jesseduffield/lazygit/issues/3008). Imagine:
1. lazygit is started and runs git diff in process X which completes immediately and exits.
2. lazygit is left in the background for several hours by which process X pid is reused by an unrelated process.
3. lazygit is focused back on and runs another git diff. It first runs this stop logic which will kill process X and its children.
2025-02-15 14:51:35 +11:00
Stefan Haller
853a04dfd0
Update translations; includes a new Portuguese translation (#4250)
- **PR Description**

Update translations from Crowdin.
2025-02-12 08:23:56 +01:00
Stefan Haller
c02709698c Update translations from Crowdin
This adds a new Portuguese translation.
2025-02-12 08:21:47 +01:00