-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
There's an off-by-one when you incrementally stage the last hunk of a file. maybe only if it's the last file in the list? anyway it happens to me constantly and I just pulled the latest version to try to fix, but it's still there.
To Reproduce
Steps to reproduce the behavior:
have multiple files changed, filter by only unstaged, start staging hunks. i've seen this happen a lot, but not every time?
Expected behavior
no crash
Screenshots
panic: runtime error: index out of range [1] with length 0
goroutine 452 [running]:
github.com/jesseduffield/lazygit/pkg/commands/patch.headerInfo({0x40009220fb?, 0x4bc?})
github.com/jesseduffield/lazygit/pkg/commands/patch/parse.go:47 +0xd0
github.com/jesseduffield/lazygit/pkg/commands/patch.Parse({0x4000922000?, 0x4bd?})
github.com/jesseduffield/lazygit/pkg/commands/patch/parse.go:22 +0x2fc
github.com/jesseduffield/lazygit/pkg/gui/patch_exploring.NewState({0x4000922000, 0x4bd}, 0xffffffffffffffff, 0x40000f98c8, 0x40002ca5b0, 0x1)
github.com/jesseduffield/lazygit/pkg/gui/patch_exploring/state.go:56 +0x94
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*StagingHelper).RefreshStagingPanel(0x400021c778, {{0x0?, 0x4000bba658?}, 0x10c16c?})
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/staging_helper.go:67 +0x220
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.13()
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:177 +0x3c
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.1.2()
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:114 +0x80
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.1.gowrap1.Safe.1()
github.com/jesseduffield/lazygit/pkg/utils/utils.go:69 +0x24
github.com/jesseduffield/lazygit/pkg/utils.SafeWithError(0x1e?)
github.com/jesseduffield/lazygit/pkg/utils/utils.go:80 +0x5c
github.com/jesseduffield/lazygit/pkg/utils.Safe(...)
github.com/jesseduffield/lazygit/pkg/utils/utils.go:69
created by github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.1 in goroutine 1
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:111 +0x110
Version info:
╰─❯ lg --version
commit=, build date=, build source=nix, version=0.56.0, os=linux, arch=arm64, git version=2.51.2
╰─❯ git --version
git version 2.51.2
Additional context
Add any other context about the problem here.
Note
Please try updating to the latest version or manually building the latest master to see if the issue still occurs.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working