jesseduffield / jesseduffield/lazygit
Invalid gitconfig throws an unhandled error
- Dominant language
- Go
- Stars
- 82.4k
- Forks
- 3k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 19
Description
**Describe the bug**
Here's a broken `~/.gitconfig` file:
```conf
[core]
autocrlf = 'foo'
```
Then start `lazygit`:
```sh
lazygit
# panic: fatal: bad boolean config value ''foo'' for 'core.autocrlf'
#
#
# goroutine 16 [running]:
# github.com/jesseduffield/lazygit/pkg/commands/loaders.(*BranchLoader).obtainBranches(0x0?)
# github.com/jesseduffield/lazygit/pkg/commands/loaders/branches.go:113 +0x85
# github.com/jesseduffield/lazygit/pkg/commands/loaders.(*BranchLoader).Load(0xc00007f6b0, {0x5603d437b078, 0x0, 0x0})
# github.com/jesseduffield/lazygit/pkg/commands/loaders/branches.go:54 +0x4e
# github.com/jesseduffield/lazygit/pkg/gui.(*Gui).refreshBranches(0xc00037c480)
# github.com/jesseduffield/lazygit/pkg/gui/refresh.go:272 +0x105
# github.com/jesseduffield/lazygit/pkg/gui.(*Gui).refreshCommits.func1()
# github.com/jesseduffield/lazygit/pkg/gui/refresh.go:173 +0x35
# github.com/jesseduffield/lazygit/pkg/utils.Safe.func1()
# github.com/jesseduffield/lazygit/pkg/utils/utils.go:104 +0x1b
# github.com/jesseduffield/lazygit/pkg/utils.SafeWithError(0x0?)
# github.com/jesseduffield/lazygit/pkg/utils/utils.go:115 +0x67
# github.com/jesseduffield/lazygit/pkg/utils.Safe(0x0?)
# github.com/jesseduffield/lazygit/pkg/utils/utils.go:104 +0x35
# created by github.com/jesseduffield/lazygit/pkg/gui.(*Gui).refreshCommits
# github.com/jesseduffield/lazygit/pkg/gui/refresh.go:170 +0xca
#
```
**Expected behavior**
An message from `lazygit`, saying something like `invalid gitconfig: bad boolean config value ''foo'' for 'core.autocrlf'`, would be better.
**Desktop (please complete the following information):**
- OS: Arch Linux
- Lazygit Version: `commit=v0.35, build date=2022-07-20T10:20:42Z, build source=binaryRelease, version=0.35, os=linux, arch=amd64`
**Additional context**
Looks similar to https://github.com/jesseduffield/lazygit/issues/2030 but I don't here get a wrong (handled) error. Instead, it's unhandled error with the stack trace.
Contributor guide
Assessment
This issue has not been assessed yet.