-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Describe the bug
When I try to do Patch Options such as "Move patch into new commit with nothing selected in Custom Patch I get a crash.
To Reproduce
Steps to reproduce the behavior:
This will occur in any repo:
- enter lazygit
- go to Commits view
- enter patch view for some file (enter, enter)
- Control-P to "View custom patch options"
- select something like
i"Move patch into new commit" - observe crash:
Expected behavior
If you repeat these steps at the commit view instead of patch view, you get an error (without crashing):
No patch created yet. To start building a patch, use 'space' on a commit file or enter to add specific lines. Something like this would be useful.
Screenshots
panic: runtime error: index out of range [-1]
goroutine 157 [running]:
github.com/jesseduffield/lazygit/pkg/commands/git_commands.(*RebaseCommands).BeginInteractiveRebaseForCommit(0x14000150300, {0x14000324280, 0x4, 0x140001128f0?}, 0xffffffffffffffff, 0x0)
github.com/jesseduffield/lazygit/pkg/commands/git_commands/rebase.go:292 +0x278
github.com/jesseduffield/lazygit/pkg/commands/git_commands.(*PatchCommands).MovePatchIntoIndex(0x140002fe330, {0x14000324280?, 0x4, 0x10546a9ac?}, 0xffffffffffffffff, 0x0)
github.com/jesseduffield/lazygit/pkg/commands/git_commands/patch.go:228 +0xcc
github.com/jesseduffield/lazygit/pkg/gui/controllers.(*CustomPatchOptionsMenuAction).handleMovePatchIntoWorkingTree.func1.1({0x14000030550, 0x14000068900})
github.com/jesseduffield/lazygit/pkg/gui/controllers/custom_patch_options_menu_action.go:159 +0xe0
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*AppStatusHelper).WithWaitingStatus.func1.1()
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/app_status_helper.go:35 +0x54
github.com/jesseduffield/lazygit/pkg/gui/status.(*StatusManager).WithWaitingStatus(0x1400038e330, {0x105522c4d, 0x8}, 0x140003eaf20)
github.com/jesseduffield/lazygit/pkg/gui/status/status_manager.go:44 +0x1d8
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*AppStatusHelper).WithWaitingStatus.func1({0x1057e4f70, 0x14000324820})
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/app_status_helper.go:32 +0x94
github.com/jesseduffield/gocui.(*Gui).onWorkerAux(0x0?, 0x0?, {0x1057e4f70?, 0x14000324820?})
github.com/jesseduffield/gocui@v0.3.1-0.20230723014157-03e858e46144/gui.go:673 +0x6c
github.com/jesseduffield/gocui.(*Gui).OnWorker.func1()
github.com/jesseduffield/gocui@v0.3.1-0.20230723014157-03e858e46144/gui.go:660 +0x34
created by github.com/jesseduffield/gocui.(*Gui).OnWorker
github.com/jesseduffield/gocui@v0.3.1-0.20230723014157-03e858e46144/gui.go:659 +0x9c
Version info:
commit=, build date=, build source=homebrew, version=0.39.4, os=darwin, arch=arm64, git version=2.39.2 (Apple Git-143)
git version 2.39.2 (Apple Git-143)
Additional context
N/A
Note: please try updating to the latest version or manually building the latest master to see if the issue still occurs.