1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-03 00:57:52 +02:00

Fix moving a custom patch from the very first commit of the history to a later commit

This would crash with an index-out-of-range error.

I double-checked that all other callers of PrepareInteractiveRebaseCommand
already call getBaseHashOrRoot, so this was the only one that was broken.

I decided not to add a test for this as the scenario is not a very common one.
This commit is contained in:
Stefan Haller
2025-06-09 16:53:24 +02:00
parent ec0f4d242e
commit 206283d1f7

View File

@ -162,7 +162,7 @@ func (self *PatchCommands) MovePatchToSelectedCommit(commits []*models.Commit, s
self.os.LogCommand(logTodoChanges(changes), false) self.os.LogCommand(logTodoChanges(changes), false)
err := self.rebase.PrepareInteractiveRebaseCommand(PrepareInteractiveRebaseCommandOpts{ err := self.rebase.PrepareInteractiveRebaseCommand(PrepareInteractiveRebaseCommandOpts{
baseHashOrRoot: commits[baseIndex].Hash(), baseHashOrRoot: getBaseHashOrRoot(commits, baseIndex),
overrideEditor: true, overrideEditor: true,
instruction: daemon.NewChangeTodoActionsInstruction(changes), instruction: daemon.NewChangeTodoActionsInstruction(changes),
}).Run() }).Run()