isacikgoz / gitbatch

manage your git repositories in one place
MIT License
1.54k stars 53 forks source link

Out of range error while navigating list #71

Closed Scottapotamas closed 5 years ago

Scottapotamas commented 5 years ago

Reproduction Steps

Linux octagonal 4.20.2-107.current #1 SMP PREEMPT Sun Jan 13 13:42:59 UTC 2019 x86_64 GNU/Linux with go version go1.11.4 linux/amd64 as packaged by my distro (Solus). Installed with go get

  1. from bash, gitbatch.
  2. List of repositories is populated as screenshot below.
  3. Use the down arrow to move cursor focus downwards.
  4. Crashes when reaches the appli-library item in my screenshot.

image

This issue immediately triggers if I run it in the parent directory to that particular repository.
Running it in other subfolders works fine.

panic: runtime error: index out of range

goroutine 1 [running]:
github.com/isacikgoz/gitbatch/gui.(*Gui).renderRemotes(0xc000184f00, 0xc0001a9790, 0x0, 0x0)
    /home/scott/go/src/github.com/isacikgoz/gitbatch/gui/sideviews.go:98 +0x4a0
github.com/isacikgoz/gitbatch/gui.(*Gui).renderSideViews(0xc000184f00, 0xc0001a9790, 0xc00031b9e0, 0x1)
    /home/scott/go/src/github.com/isacikgoz/gitbatch/gui/sideviews.go:56 +0xac
github.com/isacikgoz/gitbatch/gui.(*Gui).renderMain(0xc000184f00, 0x0, 0x0)
    /home/scott/go/src/github.com/isacikgoz/gitbatch/gui/repositoriesview.go:29 +0x1ce
github.com/isacikgoz/gitbatch/gui.(*Gui).cursorDown(0xc000184f00, 0xc000208000, 0xc00022a0f0, 0x28, 0x5)
    /home/scott/go/src/github.com/isacikgoz/gitbatch/gui/repositoriesview.go:58 +0xd0
github.com/isacikgoz/gitbatch/gui.(*Gui).cursorDown-fm(0xc000208000, 0xc00022a0f0, 0x4, 0xc000000301)
    /home/scott/go/src/github.com/isacikgoz/gitbatch/gui/keybindings.go:271 +0x3e
github.com/jroimartin/gocui.(*Gui).execKeybindings(0xc000208000, 0xc00022a0f0, 0xc00031bb88, 0x879798, 0x0, 0x0)
    /home/scott/go/src/github.com/jroimartin/gocui/gui.go:629 +0xbe
github.com/jroimartin/gocui.(*Gui).onKey(0xc000208000, 0xc00031bb88, 0xc00021aa80, 0xc000210010)
    /home/scott/go/src/github.com/jroimartin/gocui/gui.go:593 +0x1b0
github.com/jroimartin/gocui.(*Gui).handleEvent(0xc000208000, 0xc00031bb88, 0x2, 0x0)
    /home/scott/go/src/github.com/jroimartin/gocui/gui.go:413 +0x40
github.com/jroimartin/gocui.(*Gui).MainLoop(0xc000208000, 0xc000208000, 0x0)
    /home/scott/go/src/github.com/jroimartin/gocui/gui.go:373 +0x2c3
github.com/isacikgoz/gitbatch/gui.(*Gui).Run(0xc000184f00, 0x0, 0x0)
    /home/scott/go/src/github.com/isacikgoz/gitbatch/gui/gui.go:140 +0x1e3
main.run(0x0, 0x0, 0x0, 0xb3adc2, 0x5, 0x0, 0xc000110500, 0x0, 0x0, 0x0, ...)
    /home/scott/go/src/github.com/isacikgoz/gitbatch/main.go:52 +0x122
main.main()
    /home/scott/go/src/github.com/isacikgoz/gitbatch/main.go:24 +0xc2
isacikgoz commented 5 years ago

Thanks for the comprehensive feedback @Scottapotamas, can you paste the output of git remote -v command wihile you are in the appli-library?

it seems that it crashes when it tries to trim the URL of the remote

https://github.com/isacikgoz/gitbatch/blob/e15d44594001eac2f63db305408d252d58378663/gui/sideviews.go#L98

I guess it is an issue that I never covered, I will patch this quickly once I recognize the actual cause.

Scottapotamas commented 5 years ago

No problem. I redacted the domain of the private git server which is listed as the origin, otherwise nothing too unusual. It follows the syntax https://words.are-truncated.com/.

scott@octagonal ~/projects/ECAD/appli-library $ git remote -v
github-mirror   https://github.com/Scottapotamas/kicad-library.git (fetch)
github-mirror   https://github.com/Scottapotamas/kicad-library.git (push)
origin  https://[removed].com/git/kicad-library.git (fetch)
origin  https://[removed].com/git/kicad-library.git (push)
isacikgoz commented 5 years ago

I did a quick patch, maybe it will solve this issue for now. You can get the patch if you installed gitbatch with go get. To get the update you can run go get -u github.com/isacikgoz/gitbatchcommand.

Scottapotamas commented 5 years ago

Thanks. 0.4.1 doesn't exhibit this problem.