Commit graph

131 commits

Author SHA1 Message Date
Stefan Haller e27422f894 Bump minimum required git version to 2.32
The version choice is a little arbitrary, but see discussion at
https://github.com/jesseduffield/lazygit/pull/4559#issuecomment-2876201680.

The main reason why I'm updating the version now is that versions before 2.27
had a bug with branch sorting, where sorting by -committerdate (which will be
our default soon) would sort branches that point at the same commit in reverse
alphabetical order rather than alphabetical order. While this is only slightly
annoying but not a huge deal for users, it makes maintaining our integration
tests across versions very hard. So I wanted to update to at least 2.27 to get
around this problem, and went with 2.32 after the discussion linked to above.

The choice of which versions to run integration tests on is pretty arbitrary
too, I just picked some at random which are about 5 to 6 minor versions apart.
2025-07-09 12:18:57 +02:00
Stefan Haller ca05a2ccea Enable revive linter, and fix a bunch of warnings
I took the set of enabled checks from revive's recommended configuration [1],
and removed some that I didn't like. There might be other useful checks in
revive that we might want to enable, but this is a nice improvement already.

The bulk of the changes here are removing unnecessary else statements after
returns, but there are a few others too.

[1] https://github.com/mgechev/revive?tab=readme-ov-file#recommended-configuration
2025-06-30 19:13:20 +02:00
Stefan Haller ad813503fb Bump minimum required git version to 2.22
Versions older than 2.22 have issues with "git cherry-pick --continue" and
"git cherry-pick --skip" that are difficult to work around.
2025-04-09 10:40:52 +02:00
Stefan Haller 2499a6c8a3 Initialize translation set after reading user config
This allows having per-repo config files with different languages per repo. Now
granted, this is not an important use case that we need to support; however, the
goal is to eventually make all configs hot-reloadable (as opposed to loading
them only once at startup), so this is one step in that direction.
2024-08-18 10:24:52 +02:00
Stefan Haller f98b57aa5e Change direct access to Common.UserConfig to a getter
This will allow us to turn the field into an atomic.Value for safe concurrent
access.
2024-08-18 10:24:52 +02:00
ppoum ef4fd70f9c Ignore GetRepoPaths error when launching 2024-08-03 10:02:47 -04: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
Stefan Haller 9fa43394fe Make it possible to handle toasts in integration tests
Use it in two selected tests to demonstrate what it looks like.
2024-01-14 17:42:03 +01:00
Stefan Haller 18c5780485 Add AppState to common.Common 2023-09-04 17:48:39 +02:00
Jesse Duffield e33fe37a99 Standardise on using lo for slice functions
We've been sometimes using lo and sometimes using my slices package, and we need to pick one
for consistency. Lo is more extensive and better maintained so we're going with that.

My slices package was a superset of go's own slices package so in some places I've just used
the official one (the methods were just wrappers anyway).

I've also moved the remaining methods into the utils package.
2023-07-30 18:51:23 +10:00
Jesse Duffield 7b302d8c29 Write unit tests with the help of afero
Afero is a package that lets you mock out a filesystem with an in-memory filesystem.
It allows us to easily create the files required for a given test without worrying about
a cleanup step or different tests tripping on eachother when run in parallel.

Later on I'll standardise on using afero over the vanilla os package
2023-07-30 18:35:36 +10:00
Jesse Duffield d4eae73a68 Do not quote initial branch arg when creating repo
Also, we shouldn't pass the initial branch arg if it's empty.
2023-07-11 17:18:58 +10:00
Jesse Duffield c92e687d3b Fix focus issue when opening recent-repos menu at launch
I don't know why we were setting the initial context to CurrentSideContext
and not just CurrentContext in the first place. If there is no current context
in either case it'll default to the files context. So the only issue is if
we anticipated that some random context would be focused and we didn't want to
activate that. But I can't think of any situation where that would happen.
2023-06-07 18:27:18 +10:00
Jesse Duffield e0ecc9e835 Allow global logging when developing
I'll be honest, for all I know logging should be global in general: it is
a pain to pass a logger to any struct that needs it. But smart people on the
internet tell me otherwise, and I do like the idea of not having any global
variables lying around.

Nonetheless, I often need to log things when locally debugging and that's a
different kind of logging than the kind you would include in the actual
released binary. For example if I want to log something from gocui, I would
rather not have gocui depend on lazygit's logging setup.
2023-05-25 18:31:32 +10:00
Jesse Duffield 63dc07fded Construct arg vector manually rather than parse string
By constructing an arg vector manually, we no longer need to quote arguments

Mandate that args must be passed when building a command

Now you need to provide an args array when building a command.
There are a handful of places where we need to deal with a string,
such as with user-defined custom commands, and for those we now require
that at the callsite they use str.ToArgv to do that. I don't want
to provide a method out of the box for it because I want to discourage its
use.

For some reason we were invoking a command through a shell when amending a
commit, and I don't believe we needed to do that as there was nothing user-
supplied about the command. So I've switched to using a regular command out-
side the shell there
2023-05-23 19:49:19 +10:00
Jesse Duffield 8edad826ca Begin refactoring gui
This begins a big refactor of moving more code out of the Gui struct into contexts, controllers, and helpers. We also move some code into structs in the
gui package purely for the sake of better encapsulation
2023-04-30 13:19:52 +10:00
Stefan Haller bb856ad7c6 Bump minimum required git version to 2.20
We need this because the next commit is going to make use of the "break"
interactive rebase instruction, which was added in 2.20.
2023-02-19 10:20:14 +01:00
Ryooooooga cd9111837e
feat: add GitVersion struct 2022-12-30 20:01:14 +09:00
Ryooooooga 41222f07ed
chore(gui): remove unused gitConfig 2022-12-30 20:01:14 +09:00
nullishamy 956372cf8a
Run gofumpt 2022-08-18 18:26:34 +01:00
nullishamy 21a4522a51
Merge branch 'master' into feat/detect-bare-repo 2022-08-15 14:00:34 +01:00
nullishamy 154bd975a6
Apply refactoring suggestions 2022-08-15 13:59:34 +01:00
Jesse Duffield 4aea005f26
Merge pull request #2098 from Ryooooooga/feature/not-a-repository-quit 2022-08-14 17:37:07 +10:00
Jesse Duffield ba96baee32 move code from main into app package to allow test to be injected 2022-08-13 13:55:08 +10:00
Jesse Duffield d890238c7b move input and assert into integration tests package 2022-08-13 13:52:13 +10:00
Jesse Duffield 46ae55f91e introduce gui adapter 2022-08-13 13:51:56 +10:00
Ryooooooga 8b371ada73
feat(config): add notARepository: quit 2022-08-08 18:11:58 +09:00
nullishamy 0b4f9f8c76
Refactor branching logic 2022-08-01 21:58:00 +01:00
nullishamy a658cd4076
Factor out opening of recent repos 2022-08-01 20:05:35 +01:00
nullishamy 69718fb557
Factor out redundant statement 2022-08-01 19:39:39 +01:00
nullishamy b9b2f58bc8
Format, bug fixes 2022-08-01 17:41:20 +01:00
nullishamy 2866827ca8
Apply suggestions from code review 2022-08-01 17:05:16 +01:00
nullishamy 9987e65c35
Merge branch 'master' into feat/detect-bare-repo 2022-08-01 03:14:49 +01:00
Luka Markušić 9c6239df3d Worktrees should not be filtered out
But non-git directories should
2022-07-30 17:03:30 +02:00
nullishamy 41b54d742f
Check for bare repositories 2022-07-29 23:55:34 +01:00
Luka Markušić f1efa02640 Ask for initial branch name 2022-06-30 13:53:58 +02:00
Jesse Duffield 32c0b39dbd
Merge pull request #1950 from HiromasaNojima/add_subcommand_into_specific_layout_directly 2022-06-11 11:51:14 +10:00
Jesse Duffield b1e4968d0b allow opening lazygit to a specific panel 2022-06-11 11:23:56 +10:00
Luka Markušić a955dbcfd7 Validate recent repo before blindly opening it 2022-06-11 09:42:51 +10:00
Luka Markušić 658a6b239b Fix parsing of 'y/n' when starting in non-repo 2022-06-11 09:42:51 +10:00
Jesse Duffield 499d51ecf6
Merge pull request #1931 from mark2185/fix-non-existant-recent-repo 2022-05-18 22:22:28 +10:00
Ryooooooga 9693afd671
fix: fix lint error 2022-05-18 20:34:35 +09:00
Luka Markušić 1de5ca3511 Don't panic when there are no valid git repos 2022-05-17 07:28:52 +02:00
Jesse Duffield cd5b041b0f clearer separation of concerns when bootstrapping application 2022-05-07 16:02:04 +10:00
Ryooooooga 86c259623c feat: fix permission problem of temp dirs 2022-04-02 08:48:38 +11:00
Jesse Duffield 99e55725fb simplify 2022-03-24 20:14:41 +11:00
Jesse Duffield cb26c7a1f2 more things 2022-03-24 20:14:41 +11:00
Jesse Duffield a34bdf1a04 update linters 2022-03-19 12:12:57 +11:00
Jesse Duffield 2a1e3faa0c resetting controllers on new repo 2022-03-17 19:13:40 +11:00
David Roman b8fc829f86 Record current directory on switch 2022-03-17 19:01:28 +11:00