1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00
Commit Graph

6509 Commits

Author SHA1 Message Date
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
030c2e5aef Fix postFilterTest to actually do what it says
I'm pretty sure that the check for the main view was meant to be done with the
commit selected in the commits panel, not with the first file of the commit
files view selected, so it was pressing enter too early. It's pure coincidence
that the test worked.
2025-03-20 11:58:50 +01:00
e8d3a7afec Add a "Content of selected file" entry to the copy menu for commit files (#4341)
- **PR Description**

Some people have the need to get at the file content of a file as it was
in an earlier commit. They expect to press `e` in the commit files view
and get the file opened in the state it was in at that commit, somehow.
I explained a few times (e.g. in #3902, #4109, and #4327) that this is
not how `e` should work; so if we want this as a feature, we'd need it
as a separate command. However, it's a bit tricky to implement; if we
check out the selected file to a temp file, it's unclear when to remove
the file again. Alternatively we could use EditAndWait to open the file,
then we would block until the user closes the editor and delete the file
then. This is probably not the best user experience though, e.g. it
wouldn't allow opening two files from an older commit at once.

Instead of finding solutions to all these questions, this PR takes a
simpler route and adds a command to the "Copy to Clipboard" menu that
allows copying the entire content of a file. Users can then open a new,
empty editor buffer and paste it in, this is almost as good as opening a
temp file, but without all the questions. This was suggested in #4327.

- **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
2025-03-20 11:54:49 +01:00
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
357c046df2 Drop the git config cache when getting focus (#4376)
- **PR Description**

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.

Addresses #4240.
2025-03-20 11:52:20 +01:00
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
f98ad65f46 Cleanup: remove more unnecessary type arguments
Missed these in 44097384d3.
2025-03-20 11:50:28 +01:00
f5f246478e Revert #4313 (Skip post-checkout hook when discarding changes) (#4407)
@jesseduffield:

> Let's revert this PR, given that, as @TimShilov says, the
post-checkout hook will receive a flag stating whether the checkout was
for a file or a branch, meaning it's within the user's power to just
update the hook script to only run on branch checkouts if desired.
2025-03-20 11:48:47 +01:00
cf27399571 Revert "Skip post-checkout hook when discarding changes"
This reverts commit 964278255b.
2025-03-20 11:41:15 +01:00
b3b8223364 Support home and end as alternatives to '<' and '>' (#4396)
- **PR Description**

Allow pressing `<home>` and `<end>` to jump to the beginning/end of
lists, in addition to the current keybindings of `<` and `>`.
2025-03-17 20:00:02 +01:00
95c5d51e64 Support home and end as alternatives to '<' and '>' 2025-03-17 19:58:01 +01:00
71c5fa9688 Commit only tracked files in tracked filter view (#4386)
- **PR Description**
When in tracked filter view, selecting a folder for staging should only
stage files that are tracked by git. Previously, it staged even
untracked files that were not in view.
All staged (even untracked) files are shown in tracked filter view.
Fixes #4245 

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

<!--
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-03-17 19:56:53 +01:00
7a1b63182d Commit only tracked files in tracked only filter view 2025-03-17 19:51:27 +01:00
220f06052a Show staged but untracked files in tracked only filter view 2025-03-17 19:50:58 +01:00
a0dd3bec8e Fix commitPrefix setting with empty pattern (#4381)
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

```yml
  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:17:51 +01:00
05a18edc54 Add hint to not copy the whole defaults section into the config file
I'm not mentioning *why* it's not a good idea, and I'm not sure it's important
to explain this to users. I'll say it here:
- it exposes users to potential bugs like the one described in the previous
  commit
- if we decide to change the default of an option to something "better" (like we
  did with the "show graph" setting), users don't benefit from what we think is
  an improvement for most users
2025-03-12 08:15:36 +01:00
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
c735a5e5aa URL encode gitlab brackets to make consistent with branch names (#4336)
- **PR Description**
Some operating systems 'open' implementations do not like when some
special characters are unencoded, so they will double-encode the branch
name, which we already encode.

This particularly matters since branch names with / are common.

Fixes https://github.com/jesseduffield/lazygit/issues/4321

- **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-12 09:27:25 +11:00
c1ca1c8f99 URL encode gitlab brackets to make consistent with branch names
Some operating systems 'open' implementations do not like
when some special characters are unencoded, so they will
double-enconde the branch name, which we already encode.

This particularly matters since branch names with / are common
2025-03-12 09:04:04 +11:00
d423d2ac3d Add an integration test for a config with a negative refspec (#4382)
- **PR Description**

This is a sanity check to verify that lazygit has been built with a
patched version of go-git that does not error on negative refspecs.

- **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))
* [x] Docs have been updated if necessary
* [x] You've read through your own file changes for silly mistakes etc
2025-03-11 08:35:26 +01:00
b76b73943a Add an integration test for a config with a negative refspec 2025-03-11 08:33:41 +01:00
bf6d2a1c28 Update to go 1.24 (#4377)
- **PR Description**
Update to go 1.24. This is required to use a newer version of go-git.

- **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))
* [x] Docs have been updated if necessary
* [x] You've read through your own file changes for silly mistakes etc
2025-03-11 08:31:32 +01:00
be7583dd40 Update to go 1.24 2025-03-08 14:53:54 -05:00
19ac926116 Add acme editor preset (#4360)
- **PR Description**
Add editor preset for the acme editor (http://acme.cat-v.org/)

- **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))
* [x] Docs have been updated if necessary
* [x] You've read through your own file changes for silly mistakes etc
2025-03-06 15:09:59 +01:00
f989425f8c Add acme editor preset 2025-03-06 15:02:53 +01:00
0b9f320132 Fix release schedule again (#4364)
There's no way to tell cron to run a job on the first Saturday of a
month, so we tell it to run every Saturday, and manually check whether
it's the first week of the month. This is not ideal because we'll get
notifications about failed releases three times a month, but it's better
than nothing for now.
2025-03-06 11:17:40 +01:00
f7fd5217cb Fix release schedule again
There's no way to tell cron to run a job on the first Saturday of a month, so we
tell it to run every Saturday, and manually check whether it's the first week of
the month. This is not ideal because we'll get notifications about failed
releases three times a month, but it's better than nothing for now.
2025-03-06 10:04:15 +01:00
182cefcafc Fix changing language while lazygit is running (#4361)
- **PR Description**

When changing the language in the config file while lazygit is running,
the panel titles and tab titles weren't properly updated. I noticed this
while working on #4359.

Probably not an important feature for users, because they are unlikely
to change the language all the time; but it's still nice if this isn't
broken.
2025-03-06 08:27:29 +01:00
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
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
1213e875bb Cleanup: standardize on accessing translations via gui.c.Tr 2025-03-06 08:24:03 +01:00