jesseduffield / lazygit

simple terminal UI for git commands
MIT License
52.99k stars 1.85k forks source link

apostrophe in remote branch title causes error #1566

Open JayHennessy opened 3 years ago

JayHennessy commented 3 years ago

Describe the bug Lazygit throws a panic: Starting quote has no ending quote. error. This happens when there is an apostrophe (single quote) is used in the git issue title and you try to scroll over the issue in the Remotes branches. Its possible this might happen in the Local Branches as well but I did not test.

To Reproduce Steps to reproduce the behavior:

  1. In a git repo, create a PR whose git issue contains a " ' " in the title.
  2. Open Lazygit for that repo.
  3. In the Local Branches pane, press ] to move to Remotes
  4. Use the arrow keys to scroll down to your remote branch with the offending issue title you created in step 1.

Expected behavior The pane should continue scrolling without giving an error.

Desktop (please complete the following information):

Ryooooooga commented 3 years ago

Does it happen in the latest version? If so, please attach the full stack trace.

blm commented 2 years ago

I cannot reproduce this problem with master. I was able to reproduce it with the commit 70b5c822bb2dfc3b82e8fa7a97fab0bff0c4960b which corresponds to 0.27.4.

This was the stack trace

panic: Starting quote has no ending quote.

goroutine 1 [running]:
github.com/mgutz/str.ToArgv({0xc0000661c0, 0x6a})
        /home/aaaaaa/go/src/jesseduffield/lazygit/vendor/github.com/mgutz/str/funcsPZ.go:377 +0x4be
github.com/jesseduffield/lazygit/pkg/commands/oscommands.(*OSCommand).ExecutableFromString(0xc0001c8280, {0xc0000661c0, 0xd})
        /home/aaaaaa/go/src/jesseduffield/lazygit/pkg/commands/oscommands/os.go:132 +0x2d
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).handleRemoteBranchSelect(0xc00012d520)
        /home/aaaaaa/go/src/jesseduffield/lazygit/pkg/gui/remote_branches_panel.go:27 +0xbc
github.com/jesseduffield/lazygit/pkg/gui.(*ListContext).HandleFocus(0xc0000d6460)
        /home/aaaaaa/go/src/jesseduffield/lazygit/pkg/gui/list_context.go:152 +0x170
github.com/jesseduffield/lazygit/pkg/gui.(*ListContext).handleLineChange(0xc0000d6460, 0x1)
        /home/aaaaaa/go/src/jesseduffield/lazygit/pkg/gui/list_context.go:188 +0x27d
github.com/jesseduffield/lazygit/pkg/gui.(*ListContext).handleNextLine(...)
        /home/aaaaaa/go/src/jesseduffield/lazygit/pkg/gui/list_context.go:167
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).keybindings.func2(0x633105, 0x0)
        /home/aaaaaa/go/src/jesseduffield/lazygit/pkg/gui/confirmation_panel.go:317 +0x1b
github.com/jesseduffield/gocui.(*Gui).execKeybinding(0xc00026fb40, 0xc00000cd20, 0xc00026fb40)
        /home/aaaaaa/go/src/jesseduffield/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:1162 +0x4e
github.com/jesseduffield/gocui.(*Gui).execKeybindings(0xc00012d6c0, 0xc00000cd20, 0xc0004cb928)
        /home/aaaaaa/go/src/jesseduffield/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:1130 +0x2f3
github.com/jesseduffield/gocui.(*Gui).onKey(0xc0004cb908, 0xc0004cb8f8)
        /home/aaaaaa/go/src/jesseduffield/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:1055 +0xde
github.com/jesseduffield/gocui.(*Gui).handleEvent(...)
        /home/aaaaaa/go/src/jesseduffield/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:651
github.com/jesseduffield/gocui.(*Gui).MainLoop(0xc00012d6c0)
        /home/aaaaaa/go/src/jesseduffield/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:611 +0x257
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).Run(0xc00012d520)
        /home/aaaaaa/go/src/jesseduffield/lazygit/pkg/gui/gui.go:536 +0x590
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).RunAndHandleError.func1()
        /home/aaaaaa/go/src/jesseduffield/lazygit/pkg/gui/gui.go:544 +0x34
github.com/jesseduffield/lazygit/pkg/utils.SafeWithError(0xc0001945a0)
        /home/aaaaaa/go/src/jesseduffield/lazygit/pkg/utils/utils.go:380 +0x67
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).RunAndHandleError(0xc00012d520)
        /home/aaaaaa/go/src/jesseduffield/lazygit/pkg/gui/gui.go:543 +0x6f
github.com/jesseduffield/lazygit/pkg/app.(*App).Run(0xc0001ea230)
        /home/aaaaaa/go/src/jesseduffield/lazygit/pkg/app/app.go:242 +0x85
main.main()
        /home/aaaaaa/go/src/jesseduffield/lazygit/main.go:127 +0xcdd

Using git bisect I found that it appears to be fixed by commit:

commit 292b780bd8e628cea253226f97849f65cd097463 (HEAD, refs/bisect/bad)
Author: Ryooooooga <eial5q265e5@gmail.com>
Date:   Wed Oct 6 23:26:25 2021 +0900

     Quote branch names and remote names
mark2185 commented 2 years ago

So, this issue is good for closing?

blm commented 2 years ago

I think so but I was hoping the reporter might offer feedback that would confirm this.