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

2623 Commits

Author SHA1 Message Date
Stefan Haller
d2059df543 Fix the bug mentioned in the previous commit 2025-03-25 09:56:01 +01:00
hasecilu
0f37f62770 Fix double '#' on hexadecimal colors 2025-03-25 09:48:12 +01:00
hasecilu
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
Stefan Haller
c765da10f5 Allow passing refresh scope to WithGpgHandling 2025-03-24 08:41:58 +01:00
Chris McDonnell
c06d4e7b18 fix: Make tag operation use GPG helper to run signing in sub-process 2025-03-24 08:41:58 +01:00
Chris McDonnell
f779a5878d refactor: Express WithGpgHelper with a config key parameter 2025-03-24 08:41:58 +01:00
Chris McDonnell
52da806c57 refactor: Rename UsingGpg to make room for Gpg Tag logic 2025-03-24 08:41:58 +01:00
Korbinian Schweiger
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
Cesar Andres
5de735f1ac feat(submodules): add method to bulk init and update submodules 2025-03-22 09:54:32 +01:00
Stefan Haller
26459523f5 Add a root item ("/") if files at top level have changed 2025-03-21 08:04:58 +01:00
Stefan Haller
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
Stefan Haller
3f4cb8bdda Use Path directly instead of GetPath getter inside the filetree package 2025-03-20 12:31:34 +01:00
Stefan Haller
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
Stefan Haller
2dfc3491bd Rename Name to Path in File and CommitFile
Name was very confusing and misleading.
2025-03-20 12:31:34 +01:00
Stefan Haller
f7295a97c0 Add a "Content of selected file" entry to the copy menu for commit files
This is useful for copying the entire content of the selected file as it was at
the selected commit.

We only add it to the commit files panel; it is not needed in the files panel,
because there you can simply press "e" to edit the file.
2025-03-20 11:52:53 +01:00
Stefan Haller
3e15be576e Drop the git config cache when getting focus
This allows changing git config values while lazygit is running (e.g. in a
different terminal tab, or even in lazygit's ":" shell prompt), and have them
take effect immediately, while still getting some benefit from caching them
while lazygit is in the foreground.
2025-03-20 11:50:28 +01:00
Stefan Haller
f98ad65f46 Cleanup: remove more unnecessary type arguments
Missed these in 44097384d30d.
2025-03-20 11:50:28 +01:00
Stefan Haller
95c5d51e64 Support home and end as alternatives to '<' and '>' 2025-03-17 19:58:01 +01:00
Partho Kunda
7a1b63182d Commit only tracked files in tracked only filter view 2025-03-17 19:51:27 +01:00
Partho Kunda
220f06052a Show staged but untracked files in tracked only filter view 2025-03-17 19:50:58 +01:00
Stefan Haller
95940ee01e Ignore commit prefixes with an empty pattern
Before we changed the commitPrefix config to a list in #4261, we had this bug
where the defaults section in Config.md would erroneously list the default for
commitPrefix as

  git:
    commitPrefix:
      pattern: ""
      replace: ""

This was not correct, commitPrefix was a pointer, and the default for that was
nil, which is not the same.

Now, some people copied and pasted the entire defaults section into their config
files, setting the commitPrefix to an empty pattern (which is not the same as
not setting it at all). And this caused the branch name to be filled in to the
subject field for every commit; see for example
https://github.com/jesseduffield/lazygit/discussions/3632.

New users copying the defaults section into their config file in the current
version no longer have this problem because now that commitPrefix is a list, it
is no longer included in the defaults section. However, the migration that we
added in #4261 would happily carry over those empty strings into a list entry,
so people migrating from an older version still have the broken config in their
config files.

To work around the issue, ignore commit prefix settings whose pattern is an
empty string. I can't imagine a valid reason why people would actually want to
set the pattern to an empty string, so I assume this only comes from the broken
defaults problem described above.
2025-03-12 08:15:36 +01:00
Kevin Radloff
be7583dd40 Update to go 1.24 2025-03-08 14:53:54 -05:00
Stefan Haller
20ab6c8cc8 Set tab titles after reloading user config
This ensures that tab titles are updated to the new language when changing the
language in the config while lazygit is running.
2025-03-06 08:24:03 +01:00
Stefan Haller
8c014641d1 Set view titles in configureViewProperties rather than createAllViews
This ensures that they are updated to the new language when changing the
language in the config while lazygit is running.
2025-03-06 08:24:03 +01:00
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
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
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
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
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
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
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
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
Peter Cardenas
9dbde94952
fix: properly detect icon for BAZEL and WORKSPACE files 2025-02-11 11:26:18 -08:00
Stefan Haller
ba6cfc1f85 Handle pasting multi-line commit messages
When pasting a multi-line commit message into the subject field of the commit
editor, we would interpret the first newline as the confirmation for closing the
editor, and then all remaining characters as whatever command they are bound to,
resulting in executing all sorts of arbitrary commands.

Now we recognize this being a paste, and interpret the first newline as moving
to the description.

Also, prevent tabs in the pasted content from switching to the respective other
panel; simply insert four spaces instead, which should be good enough for the
leading indentation in pasted code snippets, for example.
2025-02-10 13:40:25 +01:00
Stefan Haller
e987d4b519 Swap position of checkout-commit and checkout-branch menu items
Jesse's comment from https://github.com/jesseduffield/lazygit/issues/4237:

We recently added a new option to check out a commit's branch from within the
commits, reflog, and sub-commits panels:

https://github.com/user-attachments/assets/0a5cf3f2-6803-4709-ae5a-e4addc061012

After using it for some time, I find it annoying that the default option has
changed. I rarely find myself wanting to check out a branch from the commits
panel, and it's rarer still to want to check out a branch from the reflog and
sub-commits panel. Although there may be use cases for this, it is jarring that
something you can always do (checkout the commit) is harder to do than something
that you can sometimes do (checkout the branch).

We've also had a user complain (see
https://github.com/jesseduffield/lazygit/pull/4117) about their muscle-memory
being broken by the recent change, and I have also fallen victim to this. I
don't think that the new branch checkout option is sufficiently useful to
dislodge the existing keybinding, so let's swap them.
2025-02-10 13:35:01 +01:00
Stefan Haller
ff4ae4a544 Fix possible crash when deleting a branch while filtering is active
The code that tries to reselect the same branch again uses GetItems, which in
case of filtering is the filtered list. After replacing the branches slice with
a new one, the filtered list is no longer up to date, so we must reapply the
filter before working with it. It so happens that refreshView does that, so
simply call that before setting the selection again; I don't think the order
matters in this case. Otherwise we'd have to insert another call to
ReApplyFilter before the call to GetItems, which we can avoid this way.

Note that this doesn't actually make anything work better in the case of
deleting a branch, since we can't reselect the deleted branch anyway of course.
But it avoids a possible crash if the branch that was deleted was the last one
in the unfiltered list.
2025-02-07 09:34:25 +01:00
AzraelSec
a32be7e9fa Implement reboot-resistant commit message persistence 2025-02-07 09:28:27 +01:00