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 (#4631)

- **PR Description**

Moving a custom patch from the very first commit of the history to a
later commit 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.

Fixes #4624.
This commit is contained in:
Stefan Haller
2025-06-19 18:46:28 +02:00
committed by GitHub

View File

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