isacikgoz / gitbatch

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

Error when loading stashed items #38

Closed nandryshak closed 5 years ago

nandryshak commented 5 years ago

goroutine 5 [running]:
github.com/isacikgoz/gitbatch/pkg/git.(*RepoEntity).loadStashedItems(0xc00021c000, 0x0, 0x0)
        /home/nick/go/src/github.com/isacikgoz/gitbatch/pkg/git/cmd-stash.go:64 +0x64b
github.com/isacikgoz/gitbatch/pkg/git.(*RepoEntity).loadComponents(0xc00021c000, 0x1, 0xc00021c000, 0x0)
        /home/nick/go/src/github.com/isacikgoz/gitbatch/pkg/git/repository.go:119 +0x92
github.com/isacikgoz/gitbatch/pkg/git.InitializeRepo(0xc0000a3740, 0x18, 0xc000028140, 0x0, 0x0)
        /home/nick/go/src/github.com/isacikgoz/gitbatch/pkg/git/repository.go:104 +0x7d
github.com/isacikgoz/gitbatch/pkg/git.LoadRepositoryEntities.func1(0xc000028140, 0xc000028150, 0xc00000c080, 0xc0000a3740, 0x18)
        /home/nick/go/src/github.com/isacikgoz/gitbatch/pkg/git/util-load.go:27 +0x7d
created by github.com/isacikgoz/gitbatch/pkg/git.LoadRepositoryEntities
        /home/nick/go/src/github.com/isacikgoz/gitbatch/pkg/git/util-load.go:23 +0x158

https://github.com/isacikgoz/gitbatch/blob/e566c4ba671ddb223f36cc78c4a1285cd53d767c/pkg/git/cmd-stash.go#L64

Stashed items don't always have a hash id in the message, so trying to parse it like this will fail. Use git stash push -m 'no hash here' to create a stash item with no hash id.

isacikgoz commented 5 years ago

will look at this

isacikgoz commented 5 years ago

I fixed it with the pr #40 , please let me know if you have still issues. Thanks for the feedback

amityo commented 5 years ago

still getting an error with version 0.2.0: @isacikgoz

panic: runtime error: slice bounds out of range

goroutine 41 [running]:
github.com/isacikgoz/gitbatch/pkg/git.(*RepoEntity).loadStashedItems(0xc00033c200, 0x0, 0x0)
        /Users/ibrahim/go/src/github.com/isacikgoz/gitbatch/pkg/git/cmd-stash.go:65 +0x684
github.com/isacikgoz/gitbatch/pkg/git.(*RepoEntity).loadComponents(0xc00033c200, 0x1, 0xc00033c200, 0x0)
        /Users/ibrahim/go/src/github.com/isacikgoz/gitbatch/pkg/git/repository.go:119 +0x92
github.com/isacikgoz/gitbatch/pkg/git.InitializeRepo(0xc000180d60, 0x1c, 0xc000234070, 0x0, 0x0)
        /Users/ibrahim/go/src/github.com/isacikgoz/gitbatch/pkg/git/repository.go:104 +0x7d
github.com/isacikgoz/gitbatch/pkg/git.LoadRepositoryEntities.func1(0xc000234070, 0xc000234080, 0xc00023c020, 0xc000180d60, 0x1c)
        /Users/ibrahim/go/src/github.com/isacikgoz/gitbatch/pkg/git/util-load.go:27 +0x7d
created by github.com/isacikgoz/gitbatch/pkg/git.LoadRepositoryEntities
        /Users/ibrahim/go/src/github.com/isacikgoz/gitbatch/pkg/git/util-load.go:23 +0x158
isacikgoz commented 5 years ago

hey @amityo i'm looking into this right now. hope pr #45 will solve the issue.

tobixx commented 5 years ago

Sorry to tell you, but still the same on 0.2.1:

panic: runtime error: slice bounds out of range

goroutine 25 [running]:
github.com/isacikgoz/gitbatch/pkg/git.(*RepoEntity).loadStashedItems(0xc420183200, 0x0, 0x0)
        /home/someone/workspace/gocode/src/github.com/isacikgoz/gitbatch/pkg/git/cmd-stash.go:71 +0x70f
github.com/isacikgoz/gitbatch/pkg/git.(*RepoEntity).loadComponents(0xc420183200, 0x1, 0xc420183200, 0x0)
        /home/someone/workspace/gocode/src/github.com/isacikgoz/gitbatch/pkg/git/repository.go:119 +0x92
github.com/isacikgoz/gitbatch/pkg/git.InitializeRepo(0xc4201ce7c0, 0x34, 0xc4201f5d60, 0x0, 0x0)
        /home/someone/workspace/gocode/src/github.com/isacikgoz/gitbatch/pkg/git/repository.go:104 +0x7d
github.com/isacikgoz/gitbatch/pkg/git.LoadRepositoryEntities.func1(0xc4201f5d60, 0xc4201f5d70, 0xc420202880, 0xc4201ce7c0, 0x34)
        /home/someone/workspace/gocode/src/github.com/isacikgoz/gitbatch/pkg/git/util-load.go:27 +0x7d
created by github.com/isacikgoz/gitbatch/pkg/git.LoadRepositoryEntities
        /home/someone/workspace/gocode/src/github.com/isacikgoz/gitbatch/pkg/git/util-load.go:23 +0x13f
isacikgoz commented 5 years ago

thanks for checking @tobixx I think, I am constantly failing to reproduce the error. Can you print the output of the git stash list command in your repository that results this outcome?

I've just patched da697f6a3d7a431e69c326effca9096b4232ec6e you can try it if you can update with go get -u github.com/isacikgoz/gitbatch

tobixx commented 5 years ago

Great! That worked ! Many thanks!

nandryshak commented 5 years ago

The hotfix in da697f6 also worked for me, thanks!