jesseduffield / jesseduffield/lazygit

lazygit crashes when directory has a " ' "

Open
#3,089 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
82.4k
Forks
3k
Avg merge
2d 18h
Merged PRs (30d)
19

Description

**Describe the bug**
If my current directory has a `'` in the name, lazygit will crash

**To Reproduce**
Steps to reproduce the behavior:

1. Create a folder called `test ' hello`
2. Open the folder and initialize a repository
3. Run lazygit

**Expected behavior**
Lazygit running

**Screenshots**
No screenshot but i have this error:
```
panic: Starting quote has no ending quote.

goroutine 1 [running]:
github.com/mgutz/str.ToArgv({0xc00029c8d0, 0x23})
/home/runner/work/lazygit/lazygit/vendor/github.com/mgutz/str/funcsPZ.go:377 +0x51b
github.com/jesseduffield/lazygit/pkg/commands/oscommands.(*CmdObjBuilder).NewShell(0xc0000081f8, {0xc000038e60?, 0x1c?}) /home/runner/work/lazygit/lazygit/pkg/commands/oscommands/cmd_obj_builder.go:55 +0x32d
github.com/jesseduffield/lazygit/pkg/commands/oscommands.(*OSCommand).UpdateWindowTitle(0xc00006e200)
/home/runner/work/lazygit/lazygit/pkg/commands/oscommands/os.go:344 +0xef
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).loadNewRepo(0xc000428000)
/home/runner/work/lazygit/lazygit/pkg/gui/gui.go:811 +0x6a
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).onInitialViewsCreationForRepo(0xc000428000)
/home/runner/work/lazygit/lazygit/pkg/gui/layout.go:196 +0xf1
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).layout(0xc000428000, 0xc000059520)
/home/runner/work/lazygit/lazygit/pkg/gui/layout.go:124 +0x6b7
github.com/jesseduffield/gocui.ManagerFunc.Layout(0x0?, 0x0?)
/home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:697 +0x1f
github.com/jesseduffield/gocui.(*Gui).flush(0xc000059520)
/home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:1139 +0xc4
github.com/jesseduffield/gocui.(*Gui).processEvent(0xc000059520)
/home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:766 +0x2a5
github.com/jesseduffield/gocui.(*Gui).MainLoop(0xc000059520)
/home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:739 +0xa5
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).Run(0xc000428000, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}})
/home/runner/work/lazygit/lazygit/pkg/gui/gui.go:669 +0x5e5
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).RunAndHandleError.func1()
/home/runner/work/lazygit/lazygit/pkg/gui/gui.go:675 +0x4c
github.com/jesseduffield/lazygit/pkg/utils.SafeWithError(0x0?)
/home/runner/work/lazygit/lazygit/pkg/utils/utils.go:108 +0x67
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).RunAndHandleError(0xc000428000, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}})
/home/runner/work/lazygit/lazygit/pkg/gui/gui.go:674 +0xd4
github.com/jesseduffield/lazygit/pkg/app.(*App).Run(...)
/home/runner/work/lazygit/lazygit/pkg/app/app.go:263
github.com/jesseduffield/lazygit/pkg/app.Run({0x18b9a70?, 0xc000230820?}, 0xc000250540, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}})
/home/runner/work/lazygit/lazygit/pkg/app/app.go:48 +0xe9
github.com/jesseduffield/lazygit/pkg/app.Start(0xc0000c5f30, {0x0, 0x0})
/home/runner/work/lazygit/lazygit/pkg/app/entry_point.go:150 +0xd26
main.main()
/home/runner/work/lazygit/lazygit/main.go:23 +0x9e
```

**Version info:**
_Run `lazygit --version` and paste the result here_
`commit=5e388e21c8ca6aa883dbcbe45c47f6fdd5116815, build date=2023-08-07T14:05:48Z, build source=binaryRelease, version=0.40.2, os=windows, arch=amd64, git version=2.33.0.windows.2`

_Run `git --version` and paste the result here_
`git version 2.33.0.windows.2`

**Additional context**
This was brought up on #890, and was "fixed" but it apparently still happens

I haven't tried compiling from the latest `master` branch, since I don't know anything about Go.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.