jesseduffield / lazygit

simple terminal UI for git commands
MIT License
48.12k stars 1.73k forks source link

Crash when I scroll to an unstaged file in the staging menu #2035

Open Nikola-Milovic opened 1 year ago

Nikola-Milovic commented 1 year ago

Describe the bug I've merged a branch into my current working branch, I got a ton of files, there were some GraphQL generated schema issues and I reran the generator. So I ended up with 100+ stages files and 2 unstaged newly generated schemas. When I scroll to the schemas to actually check them out and verify everything is okay as soon as I get to the unstaged files I immediately crash.

To Reproduce

*errors.errorString exec: Stdout already set
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/utils/errors.go:13 (0x8fbf45)
    sanitisedCommandOutput: return errors.Wrap(err, 0)
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/commands/oscommands/cmd_obj_runner.go:135 (0x8fbefe)
    sanitisedCommandOutput: return "", utils.WrapError(err)
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/commands/oscommands/cmd_obj_runner.go:60 (0x8fb94a)
    (*cmdObjRunner).RunWithOutput: output, err := sanitisedCommandOutput(cmdObj.GetCmd().CombinedOutput())
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/commands/git_cmd_obj_runner.go:30 (0x93b905)
    (*gitCmdObjRunner).RunWithOutput: output, err := self.innerRunner.RunWithOutput(cmdObj)
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/commands/git_cmd_obj_runner.go:19 (0x93b865)
    (*gitCmdObjRunner).Run: _, err := self.RunWithOutput(cmdObj)
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/commands/oscommands/cmd_obj.go:102 (0x8faa6f)
    (*CmdObj).Run: return self.runner.Run(self)
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/commands/git_commands/working_tree.go:59 (0x9372ad)
    (*WorkingTreeCommands).StageFile: return self.cmd.New("git add -- " + self.cmd.Quote(fileName)).Run()
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/gui/files_panel.go:159 (0x97be2b)
    (*Gui).stageSelectedFile: return gui.Git.WorkingTree.StageFile(file.Name)
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/gui/merge_panel.go:260 (0x9af085)
    (*Gui).handleCompleteMerge: if err := gui.stageSelectedFile(); err != nil {
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/gui/merge_panel.go:178 (0x9ae725)
    (*Gui).renderConflicts: return false, gui.handleCompleteMerge()
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/gui/merge_panel.go:159 (0x9ae474)
    (*Gui).renderConflictsFromFilesPanel: _, err := gui.renderConflicts(state, false)
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/gui/files_panel.go:57 (0x97b618)
    (*Gui).filesRenderToMain: return gui.renderConflictsFromFilesPanel()
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/gui/context_config.go:216 (0x9a711b)
    (*Gui).filesListContext.func6: return f()
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/gui/list_context.go:153 (0x9a5f59)
    (*ListContext).HandleFocus: if err := self.OnRenderToMain(opts...); err != nil {
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/gui/list_context.go:209 (0x9a6545)
    (*ListContext).handleLineChange: return self.HandleFocus()
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/gui/list_context.go:166 (0x9a605e)
    (*ListContext).handleNextLine: return self.handleLineChange(1)
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/gui/confirmation_panel.go:317 (0x9a247b)
    (*Gui).keybindings.func2: return f()
/home/nikola/go/pkg/mod/github.com/jesseduffield/gocui@v0.3.1-0.20220108045521-1945d7b9ed8b/gui.go:1166 (0x8e11d9)
    (*Gui).execKeybinding: if err := kb.handler(g, v); err != nil {
/home/nikola/go/pkg/mod/github.com/jesseduffield/gocui@v0.3.1-0.20220108045521-1945d7b9ed8b/gui.go:1134 (0x8e0f30)
    (*Gui).execKeybindings: return g.execKeybinding(v, kb)
/home/nikola/go/pkg/mod/github.com/jesseduffield/gocui@v0.3.1-0.20220108045521-1945d7b9ed8b/gui.go:1059 (0x8e077e)
    (*Gui).onKey: _, err := g.execKeybindings(g.currentView, ev)
/home/nikola/go/pkg/mod/github.com/jesseduffield/gocui@v0.3.1-0.20220108045521-1945d7b9ed8b/gui.go:650 (0x8def85)
    (*Gui).handleEvent: return g.onKey(ev)
/home/nikola/go/pkg/mod/github.com/jesseduffield/gocui@v0.3.1-0.20220108045521-1945d7b9ed8b/gui.go:610 (0x8debc5)
    (*Gui).MainLoop: if err := g.handleEvent(&ev); err != nil {
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/gui/gui.go:565 (0x988d1a)
    (*Gui).Run: err = g.MainLoop()
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/gui/gui.go:573 (0x989054)
    (*Gui).RunAndHandleError.func1: if err := gui.Run(); err != nil {
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/utils/utils.go:106 (0x8ec867)
    SafeWithError: err := f()
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/gui/gui.go:572 (0x988fe7)
    (*Gui).RunAndHandleError: return utils.SafeWithError(func() error {
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/pkg/app/app.go:248 (0x9d5945)
    (*App).Run: err := app.Gui.RunAndHandleError()
/home/nikola/go/pkg/mod/github.com/jesseduffield/lazygit@v0.32.2/main.go:138 (0x9d701d)
    main: err = app.Run()
/usr/local/go/src/runtime/proc.go:250 (0x437f32)
    main: fn()
/usr/local/go/src/runtime/asm_amd64.s:1571 (0x465801)
    goexit: BYTE    $0x90   // NOP

Expected behavior Keep scrolling and not crash.

Desktop (please complete the following information):

lazygit -v
commit=, build date=, build source=unknown, version=unversioned, os=linux, arch=amd64

Installed through go I believe and the version is v0.32.2

Screenshots As you can see from the video, I can scroll normally, but when I actually get to these files if I try to scroll downwards I crash

https://user-images.githubusercontent.com/50072027/178670232-ab5bdcfc-6da7-4a2b-b30d-ac525ff59379.mp4

mark2185 commented 1 year ago

That version is quite dated, could you please try building current master?

Nikola-Milovic commented 1 year ago

@mark2185 I'll try with the newest version but I already used the CLI to finish the work. I'll see with the next occurrence and close this if necessary

zoer commented 1 year ago

@mark2185 do you have any extra options for git paging in your config.yml? If yes try to disable them.

mark2185 commented 1 year ago

@mark2185 do you have any extra options for git paging in your config.yml? If yes try to disable them.

I assume that was intended for @Nikola-Milovic ?

zoer commented 1 year ago

@mark2185 yes, sorry :)

mark2185 commented 1 year ago

@Nikola-Milovic do you use the delta pager by any change? Related

Nikola-Milovic commented 1 year ago

@mark2185 yeah

git:
  paging:
    colorArg: never
    pager: delta --dark --paging=never
dplagge commented 2 months ago

I had the same error just now and realized that my version of lazygit is quite old. I suppose it was version 0.32.2, it seems that I installed it via go and I found a go package lazygit@v0.32.2.

Upgrading to the current version 0.41.0 solved the issue.