summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
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-10Run integration tests with all supported git versions (#2754)Stefan Haller
Run integration tests with various different git versions, more or less randomly picked from our range of supported versions. Based on @Ryooooooga's work in #2459, but also restructured a bit. All tests pass for all git versions, but only after cherry-picking #2747. I decided to go with @Ryooooooga's approach and do it without using docker. I also didn't use docker locally; to reproduce the various failures that I had to fix, I simply installed the respective git versions locally and used something like `PATH=~/git-versions/2.25.1/bin:$PATH ./scripts/run_integration_tests.sh`.
2023-07-10Run integration tests with various git versionsStefan Haller
We pick a few interesting ones in the range of supported versions. Based on work by Ryooooooga <eial5q265e5@gmail.com>.
2023-07-10Update checkout and cache action versionsStefan Haller
2023-07-10Fix pull rebase testsStefan Haller
It seems that older git versions would drop empty commits when rebasing. Since this aspect is not relevant to what we're testing here, fix this by simply avoiding empty commits in these tests.
2023-07-10Fix conflict testRyooooooga
The test apply_in_reverse_with_conflict.go fails in git versions 2.30.8 and earlier. Apparently the output "Applied patch to 'file2' cleanly" was only added more recently. It's not essential that we check this output.
2023-07-10Replace uses of "git stash save" with "git stash push"Stefan Haller
Save has been deprecated for a while, push is the recommended way to save a stash. Push has been available since 2.13, so we can use it without problems.
2023-07-10Fix git stash calls for older git versionsStefan Haller
Older git versions are pickier about parameter order: for "store", the sha argument must come last, and for "save", the message must come last.
2023-07-10Fix Shell.Stash() for older versions of gitStefan Haller
Older versions need an explicit "push" subcommand for the -m option to be recognized.
2023-07-10Remove StashWithMessage functionStefan Haller
It's identical to Stash(), so use that.
2023-07-10Use -c init.defaultBranch=master to pass the desired main branch to git initStefan Haller
Older versions of git don't support the -b option yet. However, no version of git complains about the -c option, even when the init.defaultBranch config is not supported.
2023-07-10Remove mainBranch parameter from Shell.Init()Stefan Haller
For older git versions we won't be able to support any other main branch than "master", so hard-code that in Init. This doesn't fix anything for older versions yet; see the next commit for that.
2023-07-10Add script to run integration testsStefan Haller
2023-07-10Retry tests on CI (#2769)Jesse Duffield
2023-07-10Retry tests on CIJesse Duffield
Now that we are running each test 6 times on CI, the risk of flakiness is higher. I want to fix these tests for good but it'l take time, so we're just retrying for now
2023-07-10Fix interactive rebase with git 2.25.1 and earlier (#2747)Stefan Haller
2023-07-10Fix interactive rebase with git 2.25.1 and earlierStefan Haller
The code in getHydratedRebasingCommits relied on the assumption that the git-rebase-todo file contains full SHAs. This has only been true from 2.25.2 on, before that it would contain abbreviated SHAs. Fix this by storing fullCommits in a slice instead of a map, and using a linear search.
2023-07-10Updated README.mdREADME-bot
2023-07-10Track busy/idle state for integration tests (#2765)Jesse Duffield
2023-07-10Retry on index.lock errorJesse Duffield
I don't know why we're getting index.lock errors but they're impossile to stop anyway given that other processes can be calling git commands. So we're retrying a few times before re-raising. To do this we need to clone the command and the current implementation for that is best-effort. I do worry about the maintainability of that but we'll see how it goes. Also, I thought you'd need to clone the task (if it exists) but now I think not; as long as you don't call done twice on it you should be fine, and you shouldn't be done'ing a task as part of running a command: that should happen higher up.
2023-07-10Ensure background refreshes don't bunch upJesse Duffield
2023-07-10Fix flakey pull_merge_conflict testJesse Duffield
It's not clear what was happening but it seemed like we sometimes weren't fully writing to our stdout buffer (which is used for the error message) even though we had returned from cmd.Wait(). Not sure what the cause was but removing an unnecessary goroutine fixed it.
2023-07-10Fix flakey misc/initial_open testJesse Duffield
I've simplifiied the code because it was too complex for the current requirements, and this fixed the misc/initial_open test which was occasionally failing due to a race condition around busy tasks
2023-07-10RefactorJesse Duffield
2023-07-10Use an interface for tasks instead of a concrete structJesse Duffield
By using an interface for tasks we can use a fake implementation in tests with extra methods
2023-07-09Use mutex on cached git configJesse Duffield
This fixes a race condition caused by a concurrent map read and write
2023-07-09Use first class task objects instead of global counterJesse Duffield
The global counter approach is easy to understand but it's brittle and depends on implicit behaviour that is not very discoverable. With a global counter, if any goroutine accidentally decrements the counter twice, we'll think lazygit is idle when it's actually busy. Likewise if a goroutine accidentally increments the counter twice we'll think lazygit is busy when it's actually idle. With the new approach we have a map of tasks where each task can either be busy or not. We create a new task and add it to the map when we spawn a worker goroutine (among other things) and we remove it once the task is done. The task can also be paused and continued for situations where we switch back and forth between running a program and asking for user input. In order for this to work with `git push` (and other commands that require credentials) we need to obtain the task from gocui when we create the worker goroutine, and then pass it along to the commands package to pause/continue the task as required. This is MUCH more discoverable than the old approach which just decremented and incremented the global counter from within the commands package, but it's at the cost of expanding some function signatures (arguably a good thing). Likewise, whenever you want to call WithWaitingStatus or WithLoaderPanel the callback will now have access to the task for pausing/ continuing. We only need to actually make use of this functionality in a couple of places so it's a high price to pay, but I don't know if I want to introduce a WithWaitingStatusTask and WithLoaderPanelTask function (open to suggestions).
2023-07-09Add dev doc for busy/idle trackingJesse Duffield
2023-07-09Fix testJesse Duffield
It's still skipped but it had an error
2023-07-09Fix race conditionJesse Duffield
We had some test flakiness involving the index.lock file which is fixed by this commit. We shouldn't be accessing newTaskID without the mutex, although I'm surprised that this actually fixes the issue. Surely we don't have tasks (which typically render to the main view) which use index.lock?
2023-07-09Only attempt integration tests onceJesse Duffield
I was able to get all integration tests passing 20 times in a row without any retries so I'm going to see if we can rely on that in CI
2023-07-09Add mutex for refreshing branchesJesse Duffield
We had a race condition due to refreshing branches in two different places, one which refreshed reflog commits beforehand. The race condition meant that upon load we wouldn't see recency values (provided by the reflog commits) against the branches
2023-07-09Remove retry logic in integration testsJesse Duffield
I want to see how we go removing all retry logic within a test. Lazygit should be trusted to tell us when it's no longer busy, and if it that proves false we should fix the issue in the code rather than being lenient in the tests
2023-07-08Wait for intro before doing any of our refresh functionsJesse Duffield
We were doing this already for fetching but not for refreshing files so I'm making it consistent.
2023-07-08Remove redundant waitgroupJesse Duffield
Turns out we're just running our refresh functions one after the other which isn't ideal but we can fix that separately. As it stands this wait group isn't doing anything.
2023-07-08Handle pending actions properly in git commands that require credentialsJesse Duffield
I don't know if this is a hack or not: we run a git command and increment the pending action count to 1 but at some point the command requests a username or password, so we need to prompt the user to enter that. At that point we don't want to say that there is a pending action, so we decrement the action count before prompting the user and then re-increment it again afterward. Given that we panic when the counter goes below zero, it's important that it's not zero when we run the git command (should be impossible anyway). I toyed with a different approach using channels and a long-running goroutine that handles all commands that request credentials but it feels over-engineered compared to this commit's approach.
2023-07-08Add busy count for integration testsJesse Duffield
Integration tests need to be notified when Lazygit is idle so they can progress to the next assertion / user action.
2023-07-08Bump gocuiJesse Duffield
This includes new gocui logic for tracking busy/idle program state
2023-07-03Updated README.mdREADME-bot
2023-07-03View filtering (#2680)Jesse Duffield
2023-07-03Add mutex to filtered list to avoid concurrency issuesJesse Duffield
2023-07-03Add filtering docsJesse Duffield
2023-07-03Differentiate between different filter modesJesse Duffield
We can filter by path, by file status, and by text.
2023-07-03Update cheatsheetsJesse Duffield
2023-07-03Use searching, not filtering, in file tree viewsJesse Duffield
There's more work to be done to support filtering for these views so we're sticking with searching for now
2023-07-03Fix escape logic for remote branchesJesse Duffield
The remote branches controller was using its own escape method meaning it didn't go through the flow of cancelling an active filter. It's now using the same approach as the sub-commits and commit-files contexts: defining a parent context to return to upon hittin escape.
2023-07-03Add integration tests for searching/filteringJesse Duffield
2023-07-03Support case sensitive filteringJesse Duffield
2023-07-03Color view frame differently when searching/filteringJesse Duffield
Given that we now persist search/filter states even after a side context loses focus, we need to make it really clear to the user that the context is currently being searched/filtered
2023-07-03Show filter status similar to what we show with searchJesse Duffield