Commit graph

4143 commits

Author SHA1 Message Date
Stefan Haller
1213e875bb Cleanup: standardize on accessing translations via gui.c.Tr 2025-03-06 08:24:03 +01:00
Stefan Haller
b31607250d Fix layout of options view for non-english languages
The width calculations didn't take multi-byte characters into account.
2025-03-06 08:19:35 +01:00
Stefan Haller
e6d6ed4f9a Use Rewording instead of Committing when rewording the head commit
Now that we have this status, let's use it for the head case too, for
consistency.
2025-03-06 08:15:18 +01:00
Stefan Haller
c18d8af9f4 Use a WithWaitingStatus for rewording a non-head commit
Rewording a commit at the beginning of a long branch can take very long;
without this change, the commit message panel would stay visible with a blinking
cursor during that time, which is very confusing.

This has the slight downside that it will say "Rebasing" in the lower right
corner until the operation is done; but we already have this problem when doing
custom patch operations, or dropping changes from a commit, so it's not new, and
we can think about how to fix all these another time.
2025-03-06 08:15:18 +01:00
Stefan Haller
eda65cbade Avoid double Refresh when rewording the head commit
WithGpgHandling already does an async refresh when done, so there's no need to
do one here for the case of amending the head commit. On top of that,
WithGpgHandling uses WithWaitingStatus and works in the background, so the
Refresh here would come too early anyway.
2025-03-06 08:15:18 +01:00
Stefan Haller
41a7afb105 Don't call OnCommitSuccess in handleReword
All this does is clear the preserved commit message; however, we open the commit
message panel with PreserveMessage: false when rewording, so this is not
necessary.
2025-03-06 08:15:18 +01:00
Stefan Haller
f28b6f439d Support fish when running shell command
This should allow using custom shell functions in lazygit's : prompt.
2025-03-06 08:11:32 +01:00
Stefan Haller
44097384d3 Remove unnecessary type arguments
I'm getting warnings in my editor about these, probably because of an updated
gopls again.
2025-03-03 21:24:49 +01:00
Stefan Haller
a4d6d020c4 Remove unused functions
For some reason the //nolint:golint,unused comment no longer seems to work after
I updated gopls (I think).

But I also don't understand why we mark unused stuff with linter comments
instead of just getting rid of it.
2025-03-03 21:23:29 +01:00
Stefan Haller
df17896de5 Validate properties of customCommand when commandMenu is used 2025-02-28 10:11:30 +01:00
Stefan Haller
22512d55a8 Add commandMenu property to custom commands 2025-02-28 10:11:30 +01:00
Stefan Haller
e799976b8a Extract a method CustomCommand.GetDescription
We'll reuse it in the next commit.
2025-02-28 10:00:59 +01:00
Stefan Haller
f93948cb23 Change customCommand fields to pointers
This allows us to tell whether they appear in the user's config file, which we
will need later in this branch.
2025-02-28 10:00:59 +01:00
Stefan Haller
0df5e08828 Don't set showOutput explicitly
It is false by default. This way there's one less change to make in the next
commit.
2025-02-28 10:00:59 +01:00
Stefan Haller
9ad50028f8 Fix wrong comment
This was backwards; we renamed Sha to Hash, so Sha is now deprecated, not Hash.
2025-02-28 10:00:59 +01:00
Chris McDonnell
d39f883b4e Migrate to only doing marshalling twice, and compare via deep copy 2025-02-27 17:05:31 -05:00
Chris McDonnell
a01ca19bb3 Set up benchmark on migration 2025-02-27 12:38:21 -05:00
Stefan Haller
4845ce1e0f Remove obsolete filtering from setComment
This reverts the change that we made in 3b85307f67, it is no longer needed
now.
2025-02-25 11:42:47 +01:00
Stefan Haller
0cc6e39f0f Filter out [dev] comments earlier
Previously we only filtered them out from the example config section in
Config.md, but they still appeared in the schema. This is not ideal, because the
schema descriptions can appear in editors on mouse hover or in auto-completions.
So filter them out earlier, so that they don't appear in the schema either.
2025-02-25 11:42:47 +01:00
Stefan Haller
964278255b Skip post-checkout hook when discarding changes
Some people have post-checkout hooks that take a lot of time, which makes
discarding changes slow. You can argue that a post-checkout hook should only run
when you switch branches, so it doesnt't have to run when checking out single
files or directories. You can also argue that lazygit might have implemented
discarding changes by taking the current patch and applying it in reverse, which
wouldn't have run a post-checkout hook either.

So disable them for all cases where we use git checkout with a path; this
includes checking out a file from the commit files view.
2025-02-25 11:39:27 +01:00
Stefan Haller
96934d5a1d Improve the error message when users have gpg signing turned on
It is not obvious that you can get rid of the error by using the overrideGpg
config, so tell them.
2025-02-25 11:34:57 +01:00
Chris McDonnell
9d0740427e Change side panel width calculation to work for larger numbers
This technically is a breaking change for some existing numbers,
but it stays the same for default case, and isn't much different for
others
2025-02-24 07:36:47 +11:00
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
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
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
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
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
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
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
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
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
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
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
Chris McDonnell
ab23539c0c Add option to copy commit message body 2025-02-17 18:43:39 +01: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
c02709698c Update translations from Crowdin
This adds a new Portuguese translation.
2025-02-12 08:21:47 +01:00
Stefan Haller
20fe43f972 Add some more information to pkg/i18n/translations/README.md 2025-02-12 08:21:47 +01:00
Stefan Haller
19921b7c42 Fix json schema for context of CustomCommand
Previously the schema only allowed a single value; however, it is now possible
to specify multiple values separated by comma, and you would get very ugly red
error squiggles in VS Code when you did that.

The only solution that I can see is to get rid of the "enum" specification, and
mention the valid values only in the description. Add examples too so that you
get at least auto-completion.
2025-02-12 08:18:26 +01:00