1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-14 11:23:09 +02:00
Commit Graph

139 Commits

Author SHA1 Message Date
Jesse Duffield
595e28d335 Support bare worktrees where worktree does not have its own .git file
This was on oversight on my part: I assumed that the --work-tree arg was
always intended for use with linked worktrees which have a .git file
pointing back to the repo.

I'm honestly confused now: seems like there are three kinds of worktrees:
* the main worktree of a non-bare repo
* a linked worktree (with its own gitdir in the repo's worktrees/ dir)
* a random folder which you specify as a worktree with the --work-tree arg

I'm pretty sure the --work-tree arg is only intended to be used with this
third kind or workree
2023-08-07 22:40:53 +10:00
Jesse Duffield
975d2bedb6 Remove secureexec package
From the go 1.19 release notes:

Command and LookPath no longer allow results from a PATH search to be found relative to the current directory. This removes a common source of security problems but may also break existing programs that depend on using, say, exec.Command("prog") to run a binary named prog (or, on Windows, prog.exe) in the current directory. See the os/exec package documentation for information about how best to update such programs.
2023-07-30 19:59:51 +10: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
27ade502ee Change directory to worktree if given as an argument
Previously we used an env var for this and it's not clear to me how that worked but
with this PR current directory = worktree directory
2023-07-30 18:35:23 +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
Gustavo Krieger
9ae7710850 Use comment char config on interactive rebase
Co-authored-by: Stefan Haller <stefan@haller-berlin.de>
2023-07-02 02:07:32 -03: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
5dacbb6293 merge master into refactor-better-encapsulation 2023-05-02 19:05:42 +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
Jesse Duffield
711be78811 extract out function 2023-04-15 17:26:08 +10:00
AzraelSec
368f9c8cb3 feat: let interactive rebase prepend commands to the default todo file 2023-04-15 17:26:08 +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
nitin mewar
526d02de1c
added gitVersion for version flag
Signed-off-by: nitin mewar <nitinmewar28@gmail.com>
2022-11-13 19:27:12 +05:30
nitin mewar
188890fc49
added gitVersion to version flag
Signed-off-by: nitin mewar <nitinmewar28@gmail.com>
2022-11-12 16:00:24 +05:30
Jesse Duffield
fd66499c8f
Merge pull request #2167 from xiaoliwang/remove_deprecated 2022-09-23 23:01:40 -07:00
jiepeng
b8900baf1a remove deprecated calls 2022-09-17 15:10:41 -07:00
Luka Markušić
3232f46a8b Validate --path argument when starting lazygit 2022-09-12 17:18:42 +02: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
304d74370e refactor to ensure code doesn't depend on integration code 2022-08-13 13:56:50 +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
bdb0b9ae6e
Merge branch 'master' into feat/detect-bare-repo 2022-08-01 17:05:33 +01:00
nullishamy
2866827ca8
Apply suggestions from code review 2022-08-01 17:05:16 +01:00
Jesse Duffield
86ac309e08 add build info when building from source 2022-08-01 20:16:50 +10: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