Skip to content

Error when loading stashed items on a detached head #42

@ObviouslyGreen

Description

@ObviouslyGreen

For some reason I had a stashed commit for a repo in a detached state i.e.
stash@{0}: WIP on (no branch): test


goroutine 34 [running]:
github.com/isacikgoz/gitbatch/pkg/git.(*RepoEntity).loadStashedItems(0xc000382600, 0x0, 0x0)
	/Users/shibo/Code/go/src/github.com/isacikgoz/gitbatch/pkg/git/cmd-stash.go:57 +0x69c
github.com/isacikgoz/gitbatch/pkg/git.(*RepoEntity).loadComponents(0xc000382600, 0x1, 0xc000382600, 0x0)
	/Users/shibo/Code/go/src/github.com/isacikgoz/gitbatch/pkg/git/repository.go:119 +0x92
github.com/isacikgoz/gitbatch/pkg/git.InitializeRepo(0xc0000a8f00, 0x2f, 0xc0000abe90, 0x0, 0x0)
	/Users/shibo/Code/go/src/github.com/isacikgoz/gitbatch/pkg/git/repository.go:104 +0x7d
github.com/isacikgoz/gitbatch/pkg/git.LoadRepositoryEntities.func1(0xc0000abe90, 0xc0000abe88, 0xc0000bde20, 0xc0000a8f00, 0x2f)
	/Users/shibo/Code/go/src/github.com/isacikgoz/gitbatch/pkg/git/util-load.go:27 +0x7d
created by github.com/isacikgoz/gitbatch/pkg/git.LoadRepositoryEntities
	/Users/shibo/Code/go/src/github.com/isacikgoz/gitbatch/pkg/git/util-load.go:23 +0x158
exit status 2

Quickly threw together a possible fix, but haven't tested with other stuff yet so just opening an issue instead of pr: https://play.golang.org/p/oI9XpuE8-iw

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions