isacikgoz / gitbatch

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

0.4.1 - panic: runtime error: slice bounds out of range #73

Closed DennisBecker closed 5 years ago

DennisBecker commented 5 years ago

I have installed v0.4.1 on my Mac OS 10.14.2 notebook and opened gitbatch within the directory I have all git repositories cloned. The following output happens after a while:

panic: runtime error: slice bounds out of range
goroutine 34 [running]:

github.com/isacikgoz/gitbatch/core/git.(*Repository).loadStashedItems(0xc420304270, 0xc420170150, 0x0)
    /home/isacikgoz/.local/share/go/src/github.com/isacikgoz/gitbatch/core/git/stash.go:47 +0x6f8
github.com/isacikgoz/gitbatch/core/git.(*Repository).loadComponents(0xc420304270, 0x1, 0xc420304270, 0x0)
    /home/isacikgoz/.local/share/go/src/github.com/isacikgoz/gitbatch/core/git/repository.go:154 +0x9e
github.com/isacikgoz/gitbatch/core/git.InitializeRepo(0xc420027c80, 0x19, 0xc420224000, 0x1, 0x0)
    /home/isacikgoz/.local/share/go/src/github.com/isacikgoz/gitbatch/core/git/repository.go:136 +0x7d
github.com/isacikgoz/gitbatch/core/load.AsyncLoad.func1(0xc420222000, 0xc420228000, 0xc42020e020, 0xc420027c80, 0x19)
    /home/isacikgoz/.local/share/go/src/github.com/isacikgoz/gitbatch/core/load/load.go:79 +0x89
created by github.com/isacikgoz/gitbatch/core/load.AsyncLoad
    /home/isacikgoz/.local/share/go/src/github.com/isacikgoz/gitbatch/core/load/load.go:76 +0x112

The current go version is:

$ go version
go version go1.11.4 darwin/amd64
isacikgoz commented 5 years ago

Thanks for the bug report @DennisBecker, I will re-implement from scratch to handle stash. Current implementation is messy and does not cover such cases like yours.

In your case; a stash item in a repository breaks the stash parsing function.

I hope this bug will be solved in the next release. If you can find the repository which causes app to crash, can you provide me the output of git stash listcommand? Maybe I can come up with a qucik patch. Thanks in advance.

DennisBecker commented 5 years ago

Looks like one repository contains the following on the stash: stash@{0}: autostash

I guess this could happen from my git pull --rebase --autostash command I'm using.

isacikgoz commented 5 years ago

I did a quick patch, if you can install with go get -u github.com/isacikgoz/gitbatch it should solve the issue for now.

isacikgoz commented 5 years ago

Since there is no additional feedback, I am closing this issue and mark it as resolved with #74. Thanks for the feedback again @DennisBecker

Zialus commented 4 years ago

I'm getting this on version 0.5.0

|panic: runtime error: slice bounds out of range                                                                                                                        │
│                                                                                                                                                                                                                                             │
goroutine 10 [running]:                                                                                                                                                                                                                       │
github.com/isacikgoz/gitbatch/core/git.(*Repository).loadStashedItems(0xc000240270, 0xc000132070, 0x0)                                                                                                                                        │
│       /Users/ibrahim/git/gitbatch/core/git/stash.go:51 +0x7a8                                                                                                                                                                               │
github.com/isacikgoz/gitbatch/core/git.(*Repository).loadComponents(0xc000240270, 0x1, 0xc000240270, 0x0)                                                                                                                                     │
│       /Users/ibrahim/git/gitbatch/core/git/repository.go:155 +0xa2                                                                                                                                                                          │
github.com/isacikgoz/gitbatch/core/git.InitializeRepo(0xc000023200, 0x28, 0xc0000aad20, 0x1, 0x0)                                                                                                                                             │
│       /Users/ibrahim/git/gitbatch/core/git/repository.go:137 +0x7d                                                                                                                                                                          │
github.com/isacikgoz/gitbatch/core/load.AsyncLoad.func1(0xc00000e7a0, 0xc000027560, 0xc0001aa020, 0xc000023200, 0x28)                                                                                                                         │
│       /Users/ibrahim/git/gitbatch/core/load/load.go:79 +0x89                                                                                                                                                                                │
created by github.com/isacikgoz/gitbatch/core/load.AsyncLoad                                                                                                                                                                                  │
│       /Users/ibrahim/git/gitbatch/core/load/load.go:76 +0x18e