-
-
Couldn't load subscription status.
- Fork 2.3k
Avoid crash when the git command to obtain branches fails #4547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This is probably not a good enough solution, because we only log the error (in RefreshHelper.refreshBranches) and don't communicate it otherwise to users. This is true for all errors that happen during refresh, though.
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesFootnotes
|
|
I hit a similar error with lazygit 0.55.1, although the error message is a bit different: It would be helpful to know which configuration file it tried to read when the error occured. I successfully created and pushed a feature branch a few hours ago and wanted to update my local repo after the PR was merged when this happened. After the crash the remotes were gone -- |
|
@efussi This is an error from git, it is talking about your repository's config file ( |
|
Thanks for looking at this, @stefanhaller! Something must have messed up my .git/config and I assume lazygit tripped over the missing remotes in there. I have no indication lazygit is to blame for the corruption, and it works fine after I fixed the config file. So please ignore my previous message, it's just a similar stack trace that led me here. |
In #4546 a user reported a crash in refresh when the repository is corrupt. It would be good not to crash, but to handle this gracefully. This PR does that.
However, this is probably not a good enough solution, because we only log the error (in RefreshHelper.refreshBranches) and don't communicate it otherwise to users. This is true for all errors that happen during refresh, though.
It is unclear how we could report refresh errors to users; showing them in a popup doesn't seem right. As long as we don't have a solution for this, it might actually be better to crash, so that users can file an issue and we tell them how to sort it out. Leaving as draft for the time being.