summaryrefslogtreecommitdiffstats
path: root/pkg/app
AgeCommit message (Collapse)Author
2024-07-06Optimize number of early calls to GetRepoPathsJohn Whitley
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-06-03Add -profile command line flagStefan Haller
When on, start a built-in web server that takes requests on port 6060 to gather profiling data.
2024-04-22Drop update-ref commands at the top of the rebase-todo fileStefan Haller
The rebase.updateRefs feature of git is very useful to rebase a stack of branches and keep everything nicely stacked; however, it is usually in the way when you make a copy of a branch and want to rebase it "away" from the original branch in some way or other. For example, the original branch might sit on main, and you want to rebase the copy onto devel to see if things still compile there. Or you want to do some heavy history rewriting experiments on the copy, but keep the original branch in case the experiments fail. Or you want to split a branch in two because it contains two unrelated sets of changes; so you make a copy, and drop half of the commits from the copy, then check out the original branch and drop the other half of the commits from it. In all these cases, git's updateRefs feature insists on moving the original branch along with the copy in the first rebase that you make on the copy. I think this is a bug in git, it should create update-ref todos only for branches that point into the middle of your branch (because only then do they form a stack), not when they point at the head (because then it's a copy). I had a long discussion about this on the git mailing list [1], but people either don't agree or don't care enough. So we fix this on our side: whenever we start a rebase for whatever reason, be it interactive, non-interactive, or behind-the-scenes, we drop any update-ref todos that are at the very top of the todo list, which fixes all the above-mentioned scenarios nicely. I will admit that there's one scenario where git's behavior is the desired one, and the fix in this PR makes it worse: when you create a new branch off of an existing one, with the intention of creating a stack of branches, but before you make the first commit on the new branch you realize some problem with the first branch (e.g. a commit that needs to be reworded or dropped). It this case you do want both branches to be affected by the change. In my experience this scenario is much rarer than the other ones that I described above, and it's also much easier to recover from: just check out the other branch again and hard-reset it to the rebased one. [1] https://public-inbox.org/git/354f9fed-567f-42c8-9da9-148a5e223022@haller-berlin.de/
2024-04-22Switch git-todo-parser from fsmiamoto original repo to stefanhaller's forkStefan Haller
Sometimes it takes a while to get PRs accepted upstream, and this blocks our progress. Since I'm pretty much the only one making changes there anyway, it makes sense to point to my fork directly.
2024-04-12rename sha to hash 9, case: Shapikomonde
2024-04-12rename sha to hash 6, update short hashpikomonde
2024-04-12rename sha to hashpikomonde
2024-03-26Fix deleting update-ref todosStefan Haller
It is a bad idea to read a git-rebase-todo file, remove some update-ref todos, and write it back out behind git's back. This will cause git to actually remove the branches referenced by those update-ref todos when the rebase is continued. The reason is that git remembers the refs affected by update-ref todos at the beginning of the rebase, and remembers information about them in the file .git/rebase-merge/update-refs. Then, whenever the user performs a "git rebase --edit-todo" command, it updates that file based on whether update-ref todos were added or removed by that edit. If we rewrite the git-rebase-todo file behind git's back, this updating doesn't happen. Fix this by not updating the git-rebase-todo file directly in this case, but performing a "git rebase --edit-todo" command where we set ourselves as the editor and change the file in there. This makes git update the bookkeeping information properly. Ideally we would use this method for all cases where we change the git-rebase-todo file (e.g. moving todos up/down, or changing the type of a todo); this would be cleaner because we wouldn't mess with git's private implementation details. I tried this, but unfortunately it isn't fast enough. Right now, moving a todo up or down takes between 1 and 2ms on my machine; changing it to do a "git rebase --edit-todo" slows it down to over 100ms, which is unacceptable.
2024-01-23Support range select in rebase actionsJesse Duffield
2024-01-14Make it possible to handle toasts in integration testsStefan Haller
Use it in two selected tests to demonstrate what it looks like.
2024-01-02Show a friendly error message when starting lazygit from a non-existent cwdSimon Whitaker
Closes 3187
2023-09-25respect and env varsBZ
2023-09-04Add AppState to common.CommonStefan Haller
2023-08-07Support bare worktrees where worktree does not have its own .git fileJesse Duffield
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-07-30Remove secureexec packageJesse Duffield
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-30Standardise on using lo for slice functionsJesse Duffield
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-30Write unit tests with the help of aferoJesse Duffield
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-30Change directory to worktree if given as an argumentJesse Duffield
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-11Do not quote initial branch arg when creating repoJesse Duffield
Also, we shouldn't pass the initial branch arg if it's empty.
2023-07-02Use comment char config on interactive rebaseGustavo Krieger
Co-authored-by: Stefan Haller <stefan@haller-berlin.de>
2023-06-07Fix focus issue when opening recent-repos menu at launchJesse Duffield
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-05-25Allow global logging when developingJesse Duffield
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-23Construct arg vector manually rather than parse stringJesse Duffield
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-02merge master into refactor-better-encapsulationJesse Duffield
2023-04-30Begin refactoring guiJesse Duffield
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-15extract out functionJesse Duffield
2023-04-15feat: let interactive rebase prepend commands to the default todo fileAzraelSec
2023-02-19Bump minimum required git version to 2.20Stefan Haller
We need this because the next commit is going to make use of the "break" interactive rebase instruction, which was added in 2.20.
2022-12-30feat: add `GitVersion` structRyooooooga
2022-12-30chore(gui): remove unused `gitConfig`Ryooooooga
2022-11-13added gitVersion for version flagnitin mewar
Signed-off-by: nitin mewar <nitinmewar28@gmail.com>
2022-11-12added gitVersion to version flagnitin mewar
Signed-off-by: nitin mewar <nitinmewar28@gmail.com>
2022-09-23Merge pull request #2167 from xiaoliwang/remove_deprecatedJesse Duffield
2022-09-17remove deprecated callsjiepeng
2022-09-12Validate --path argument when starting lazygitLuka Markušić
2022-08-18Run gofumptnullishamy
2022-08-15Merge branch 'master' into feat/detect-bare-reponullishamy
2022-08-15Apply refactoring suggestionsnullishamy
2022-08-14Merge pull request #2098 from Ryooooooga/feature/not-a-repository-quitJesse Duffield
2022-08-13refactor to ensure code doesn't depend on integration codeJesse Duffield
2022-08-13move code from main into app package to allow test to be injectedJesse Duffield
2022-08-13move input and assert into integration tests packageJesse Duffield
2022-08-13introduce gui adapterJesse Duffield
2022-08-08feat(config): add `notARepository: quit`Ryooooooga
2022-08-01Refactor branching logicnullishamy
2022-08-01Factor out opening of recent reposnullishamy
2022-08-01Factor out redundant statementnullishamy
2022-08-01Format, bug fixesnullishamy
2022-08-01Merge branch 'master' into feat/detect-bare-reponullishamy
2022-08-01Apply suggestions from code reviewnullishamy