Skip to content

Runtime error when checking out an old branch #3955

@alexasa79

Description

@alexasa79

Describe the bug
Lazygit consistently crashes when I am checking out a revision from five years ago. This is an eight year old repository. Not sure how the five year old revision is different from the tip of the master, but somehow it is. We do use submodules and likely added some new submodules in the past years. Unfortunately, this is a proprietary codebase, so I cannot share the code repo.

Backtrace
panic: runtime error: index out of range [1] with length 1

goroutine 3498 [running]:
github.com/jesseduffield/lazygit/pkg/gui/context.searchModelCommits.func2(0x10?, 0x0?)
/home/sasandl/go/pkg/mod/github.com/jesseduffield/lazygit@v0.43.1/pkg/gui/context/local_commits_context.go:212 +0x12f
github.com/samber/lo.FilterMap[...]({0xc00025f308, 0x12c, 0xe130bf}, 0xc005cc5af0?)
/home/sasandl/go/pkg/mod/github.com/samber/lo@v1.31.0/slice.go:45 +0xa2
github.com/jesseduffield/lazygit/pkg/gui/context.searchModelCommits(0xc0?, {0xc00025f308?, 0x4700da?, 0xc001ad60a8?}, {0xc001ad6000?, 0x1669280?, 0xc005cc5c00?}, {0xc00348b170?, 0x4700da?})
/home/sasandl/go/pkg/mod/github.com/jesseduffield/lazygit@v0.43.1/pkg/gui/context/local_commits_context.go:206 +0x92
github.com/jesseduffield/lazygit/pkg/gui/context.(*LocalCommitsContext).ModelSearchResults(0xc000358828, {0xc00348b170, 0x28}, 0x0)
/home/sasandl/go/pkg/mod/github.com/jesseduffield/lazygit@v0.43.1/pkg/gui/context/local_commits_context.go:161 +0x69
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.modelSearchResults({0xf90bd8, 0xc000358828})
/home/sasandl/go/pkg/mod/github.com/jesseduffield/lazygit@v0.43.1/pkg/gui/controllers/helpers/search_helper.go:180 +0xaf
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*SearchHelper).ReApplySearch(0xc00030e418, {0xf8fa78, 0xc000358828})
/home/sasandl/go/pkg/mod/github.com/jesseduffield/lazygit@v0.43.1/pkg/gui/controllers/helpers/search_helper.go:259 +0x8b
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).refreshView(0xc000324640, {0xf8fa78, 0xc000358828})
/home/sasandl/go/pkg/mod/github.com/jesseduffield/lazygit@v0.43.1/pkg/gui/controllers/helpers/refresh_helper.go:770 +0x71
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).refreshCommitsWithLimit(0xc000324640)
/home/sasandl/go/pkg/mod/github.com/jesseduffield/lazygit@v0.43.1/pkg/gui/controllers/helpers/refresh_helper.go:347 +0x5df
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).refreshCommitsAndCommitFiles(0xc000324640)
/home/sasandl/go/pkg/mod/github.com/jesseduffield/lazygit@v0.43.1/pkg/gui/controllers/helpers/refresh_helper.go:278 +0x1c
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.1.2()
/home/sasandl/go/pkg/mod/github.com/jesseduffield/lazygit@v0.43.1/pkg/gui/controllers/helpers/refresh_helper.go:116 +0xa8
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.1.gowrap1.Safe.1()
/home/sasandl/go/pkg/mod/github.com/jesseduffield/lazygit@v0.43.1/pkg/utils/utils.go:88 +0x13
github.com/jesseduffield/lazygit/pkg/utils.SafeWithError(0xc00693d4f0?)
/home/sasandl/go/pkg/mod/github.com/jesseduffield/lazygit@v0.43.1/pkg/utils/utils.go:99 +0x56
github.com/jesseduffield/lazygit/pkg/utils.Safe(...)
/home/sasandl/go/pkg/mod/github.com/jesseduffield/lazygit@v0.43.1/pkg/utils/utils.go:88
created by github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.1 in goroutine 1
/home/sasandl/go/pkg/mod/github.com/jesseduffield/lazygit@v0.43.1/pkg/gui/controllers/helpers/refresh_helper.go:113 +0x136

Version info:
Run lazygit --version and paste the result here
commit=, build date=, build source=unknown, version=unversioned, os=linux, arch=amd64, git version=2.43.5
I checked my GOROOT though. It shows version 0.43.1. I think I installed with go get.
Run git --version and paste the result here
git version 2.43.5

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