1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-22 15:22:51 +03:00

6368 Commits

Author SHA1 Message Date
Stefan Haller
a3560eb451
Don't exit app when GetRepoPaths call fails during startup (#3779)
- **PR Description**
Fixes #3740 

As explained in the issue, 7a67096 moved some code around that caused a
call to `GetRepoPaths` to occur before `setupApp`, which usually handles
the scenario where we are not in a git directory. `GetRepoPaths` returns
an error if the path isn't a git repository, which caused the app to
exit before we reached `setupApp`.

When starting up lazygit, we ignore (and log) the error returned by
`GetRepoPaths`, and continue instead of exiting early. This allows us to
reach the step where we follow the user's `notARepository` config entry.
2024-08-03 18:37:53 +02:00
ppoum
ef4fd70f9c Ignore GetRepoPaths error when launching 2024-08-03 10:02:47 -04:00
Stefan Haller
74fe069da9
feat(custom command): support multiple contexts within one command (#3784)
- **PR Description**

For some custom commands, they can be used in multiple contexts. But for
now, if we want to do this, we should copy and paste the same config
times and times with just a different **context**.

Related issue: #3759 

This PR makes it possible to use multiple contexts in the `context` field of 
`customCommand`, separated by comma.
2024-08-02 11:59:39 +02:00
Yam Liu
542030f190 Support multiple contexts within one command, add tests, update doc 2024-08-02 11:55:29 +02:00
Yam Liu
206b2c6f0b Add a unit test case for global context 2024-08-02 11:55:29 +02:00
Stefan Haller
dc87592876
Add a readme file for the JSON files in pkg/i18n/translations (#3781) 2024-07-26 11:04:18 +02:00
Stefan Haller
37f35da436 Add a readme file for the JSON files in pkg/i18n/translations
People have started sending PRs that change these files.
2024-07-26 11:00:10 +02:00
Stefan Haller
f598da0df2
Reapply "Check for fixup commits on CI" (#3745)
Re-enable the check for fixup commits (see #3742), make it work for
forks, and extend it to "amend!" and "WIP" commits (and a few others).
2024-07-13 15:17:50 +02:00
Stefan Haller
20ccb03a45 Extend check for fixups
Also check for squash! and amend! (these are all anchored to the beginning of
the subject), and WIP and DROPME for good measure (but only if they occur in the
first line, otherwise it wouldn't let me merge this very commit :)
2024-07-13 15:15:01 +02:00
Stefan Haller
891362dfb2 Use extended regex rather than perl regex in the git call
My local git is not compiled with PCRE support, so using -E makes it easier for
me to test the script locally. And -E is good enough for the simple matching we
want to do here.
2024-07-13 15:02:34 +02:00
Stefan Haller
463cf35e64 Make checkout action work with forks 2024-07-13 14:39:28 +02:00
Stefan Haller
1919a2d2d6 Reapply "Check for fixup commits on CI"
This reverts commit f2db9fa3f91311fb42967234222bc510cf89b8bf.
2024-07-13 14:08:44 +02:00
Stefan Haller
71ad3fac63
Fix language auto detection (#3744)
- **PR Description**

Fix a regression (introduced with #3649) that broke language
auto-detection. When starting lazygit with the `gui.language` config set
to "auto" (which is the default), lazygit would fail to start if the
LANG environment is set to one of our supported languages.

For example:
```
$ export LANG=nl_NL
$ lazygit
2024/07/13 11:43:03 open translations/nl-NL.json: file does not exist
```

Fixes #3743
v0.43.1
2024-07-13 12:14:39 +02:00
Stefan Haller
ae4a579153 Fix language auto-detection
Starting lazygit with an environment containing LANG=ko_KO or LANG=nl_NL would
result in an error at startup.
2024-07-13 12:07:59 +02:00
Stefan Haller
da86096e19 Add test that demonstrates bug with language auto-detection 2024-07-13 12:07:59 +02:00
Jesse Duffield
e1d973d62a
README.md: Update Sponsors (#3732)
Automated changes by
[create-pull-request](https://github.com/peter-evans/create-pull-request)
GitHub action
v0.43.0
2024-07-13 15:04:32 +10:00
github-actions[bot]
0489b11c0c README.md: Update Sponsors 2024-07-13 05:03:33 +00:00
Jesse Duffield
c7a9b9ca07
Add support for setting the similarity threshold for detecting renames (closes #2904) (#3025)
- **PR Description**
Implement the feature as discussed in #2904.

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

* [x] Cheatsheets are up-to-date (run `go run scripts/cheatsheet/main.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] Docs (specifically `docs/Config.md`) have been updated if
necessary
* [x] You've read through your own file changes for silly mistakes etc

---

_Edit: Previously I have left the "Text is internationalised" checkbox
empty, as I thought that it would also have to include translations, but
as I understand currently, that would be "localization" instead, so I
ticked it._

<!--
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
-->
2024-07-13 15:03:21 +10:00
Jesse Duffield
f2db9fa3f9 Revert "Check for fixup commits on CI"
This reverts commit 7652d579f587c3202d1d80464557cfaa8005b3de.

Not working on forks, and I don't have time to fix right now
2024-07-13 14:54:20 +10:00
István Donkó
b9107d5fc8 Support setting the similarity threshold for detecting renames 2024-07-13 14:24:26 +10:00
Jesse Duffield
bfe2dd4ed8
Check for fixup commits on CI (#3742)
I keep merging PRs that still have fixup commits on them! This will make
it impossible to do so

- **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))
* [ ] 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
-->
2024-07-13 13:51:10 +10:00
Jesse Duffield
7652d579f5 Check for fixup commits on CI
I keep merging PRs that still have fixup commits on them! This will make
it impossible to do so
2024-07-13 13:41:47 +10:00
Jesse Duffield
73bcbe4ee2
Extend icon coverage on remotes and file extensions (#3484)
- **PR Description**

Initially I opened #3426 issue, this PR is targeted to fix that.

- **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))
* [ ] 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] Docs (specifically `docs/Config.md`) have been updated if
necessary
* [X] You've read through your own file changes for silly mistakes etc

This is the result from the remote icons that I posted on the issue.
Note: The FreeBSD only is triggered if the remote is "git.FreeBSD.org",
note the capitalization

Edit: btw, there are also icons for gitea -> `nf-linux-gitea`, \uf339, 
and forgejo -> `nf-linux-forgejo`, \uf335,  if someone is interested on
some instances that use that sofware.


![image](https://github.com/jesseduffield/lazygit/assets/53124818/d68aa9a1-5a3d-446a-af38-650754056f06)

Would be nice if in the future the user can make overrides via config
file.
```yml
icon_overrides:
  filenames:
    Cargo.toml: 🦀
    Cargo.lock: 🦀
  extensions:
    rs: 🦀
    nix: ❄
```

Fix #3426

<!--
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
-->
2024-07-13 13:32:26 +10:00
hasecilu
cd01e4e7c2 fixup! Add icons for some file names 2024-07-13 13:23:12 +10:00
hasecilu
c5de9cfd8e fixup! Add icons for some file extensions 2024-07-13 13:23:12 +10:00
hasecilu
1129e0e4a0 Add icons for some git remotes 2024-07-13 13:23:12 +10:00
hasecilu
981f1fa7aa Add icons for some file extensions 2024-07-13 13:23:12 +10:00
hasecilu
cad4581d05 Add icons for some file names 2024-07-13 13:23:12 +10:00
hasecilu
f0af42270e Update link from unmaintained exa to maintained eza 2024-07-13 13:23:12 +10:00
Stefan Haller
e0377f2bce
Only add commit prefix if branch name matches regex pattern (#3703)
- **PR Description**
Currently if a branch name does not match a regex pattern defined in the
config.yaml (commitPrefix/es) the commit message box is populated with
the branch name as is - this does not match expectations. A prefix
should only be added if there is a match on the regex pattern.

This PR seeks to change that by checking for a match before calling
ReplaceAllString - see Issue #3695

- **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))
* [-] Docs have been updated if necessary
* [x] You've read through your own file changes for silly mistakes etc
2024-07-10 09:13:25 +02:00
Luke Swan
968060a5ec Ensure branch name matches pattern before replace
Amend test for non-matching branch name
2024-07-10 09:05:41 +02:00
Luke Swan
07fe828f60 Add initial test for non-matching branch name 2024-07-10 09:05:33 +02:00
Jesse Duffield
b004b2e275
Change RepoPaths to be acquired via RepoPathCache (#3284)
### **PR Description**
In order to optimize the number of git calls made this change implements
a RepoPathCache as the API by which RepoPaths instances are acquired.
This primarily affects app startup and worktree enumeration.

This introduces a new dependency on
[go-memoize](https://github.com/kofalt/go-memoize), which is a
lightweight wrapper around go-cache and singleflight, in order to ensure
that the cache is concurrency safe. (As compared to a simple map, e.g.)
See the go-memoize README for details.

Fixes #3227.

### **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] Docs (specifically `docs/Config.md`) have been updated if
necessary
* [x] You've read through your own file changes for silly mistakes etc
2024-07-07 15:43:15 +10:00
John Whitley
7a670964cd Optimize number of early calls to GetRepoPaths
This change reduces the number of calls during application startup to
one, calling GetRepoPaths() earlier than previously and plumbing the
repoPaths struct around to achieve this end.
2024-07-06 12:09:48 -07:00
Jesse Duffield
a138a31c72
README.md: Update Sponsors (#3580)
Automated changes by
[create-pull-request](https://github.com/peter-evans/create-pull-request)
GitHub action
2024-07-06 23:00:22 +10:00
github-actions[bot]
31456a8caa README.md: Update Sponsors 2024-07-06 12:08:18 +00:00
Jesse Duffield
22764cd207
Switch between multiple log views (#3354)
- **PR Description**

* Fixes jesseduffield/lazygit#1363
* Allow switching between up two three log views

Seeing as the last activity related to this issue was over a year ago, I
decided to take a stab at this.
The implementation should be fully backwards compatible. Simply add
`allBranchesLogCmdAlt1` and/or `allBranchesLogCmdAlt2` to your config
file to use them when cycling between log commands using 'a'.
You can even use `allBranchesLogCmdAlt2` together with
`allBranchesLogCmd` (skipping `allBranchesLogCmdAlt1`) if you want, it
should not affect usability.

This is my first contribution to LazyGit, but I have experience with Go.

Changes:

- Introduced two new optional user config commands,
allBranchesLogCmdAlt1+2
- When pressing 'a' in the Status view, cycle between non-empty,
non-identical log commands
- There will always be at least one command to run, since
allBranhesLogCmd has a default

- **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))
* [ ] Docs (specifically `docs/Config.md`) 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
-->
2024-07-06 22:08:05 +10:00
Martin Kock
be21328c69 Allow cycling between multiple log commands
- Introduced a new optional user config command, allBranchesLogCmds
- When pressing 'a' in the Status view, cycle between non-empty, non-identical log commands
- There will always be at least one command to run, since allBranhesLogCmd has a default
- Update documentation & write an integration test
- Update translation string
2024-07-06 22:02:47 +10:00
Jesse Duffield
3d14893c65
Add Token credential request handling (#3647)
- **PR Description**

Asking for 2FA Token prompt when an additional authentication is
configured for git over SSH

- **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] 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
-->
2024-07-06 21:47:40 +10:00
Aleksei Larkov
8813587961 Add Token credential request handling
Asking for 2FA Token prompt when an additional authentication is configured for git over SSH
2024-07-06 21:44:10 +10:00
Jesse Duffield
13bd4b964f
Add flox install (#3656)
- **PR Description**

`lazygit` is available in Flox today, and seems to be working well.
Since Flox is related to Nix, I decided a good place would be right
below the Nix install section. 😉

- **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] 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
-->
2024-07-06 21:35:19 +10:00
Bryan Honof
eae76a97e9 docs: Add flox install 2024-07-06 21:27:08 +10:00
Jesse Duffield
34214af41f
Fix multi selection stage/discard not working for files with substrings (#3599)
- **PR Description**

I found an issue with multi selection stage/discard. Here is a minimal
repro:
```bash
git init
touch a
touch aa
lazygit
```

Select both files using shift and hit space. Only `a` is staged.

- **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))
* [ ] 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
-->
2024-07-06 21:26:32 +10:00
Brandon
38aa5b89ab Simplify integration test 2024-07-06 21:22:04 +10:00
Brandon
2e5b570bb6 Add integration test 2024-07-06 21:22:04 +10:00
Brandon
a5eec48b4b Fix multi selection stage/discard not working for files with substrings 2024-07-06 21:22:04 +10:00
Jesse Duffield
94cf2cc7df
Bump actions/checkout, actions/setup-go, actions/cache/restore, actions/cache/save (#3594) 2024-07-06 21:21:32 +10:00
kyu08
ac30aee1b8 Bump actions/checkout, actions/setup-go, actions/cache/restore, actions/cache/save 2024-07-06 21:17:29 +10:00
Jesse Duffield
d3780fd57d
Allow setting a default name when creating new branches (#3487)
- **PR Description**

I commonly prefix my branch names with my first initial and last name,
such as this one (`ecubit/branch-prefixes`). It can be a bit annoying to
type out.

This PR adds a config option to set a default value for the name in the
branch creation modal.

If there would have previously been a branch name autofilled (I do not
know all such cases), this change has no effect.

- **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))
- `CONTRIBUTING.md` says I may submit without doing localization (and I
am unable)
* [x] Docs (specifically `docs/Config.md`) have been updated if
necessary
* [x] You've read through your own file changes for silly mistakes etc
2024-07-06 21:16:31 +10:00
Elliot Cubit
5959f7bc8e Allow setting a default name when creating new branches 2024-07-06 21:06:28 +10:00