diff --git a/pkg/gui/controllers/helpers/fixup_helper.go b/pkg/gui/controllers/helpers/fixup_helper.go index f57e8f2f9..e816f425d 100644 --- a/pkg/gui/controllers/helpers/fixup_helper.go +++ b/pkg/gui/controllers/helpers/fixup_helper.go @@ -76,9 +76,7 @@ func (self *FixupHelper) HandleFindBaseCommitForFixupPress() error { return fmt.Errorf("%s\n\n%s", message, subjects) } - commit, index, ok := lo.FindIndexOf(self.c.Model().Commits, func(commit *models.Commit) bool { - return commit.Hash == hashes[0] - }) + commit, index, ok := self.findCommit(hashes[0]) if !ok { commits := self.c.Model().Commits if commits[len(commits)-1].Status == models.StatusMerged { @@ -221,3 +219,9 @@ func (self *FixupHelper) blameDeletedLines(deletedLineHunks []*hunk) ([]string, return result.ToSlice(), errg.Wait() } + +func (self *FixupHelper) findCommit(hash string) (*models.Commit, int, bool) { + return lo.FindIndexOf(self.c.Model().Commits, func(commit *models.Commit) bool { + return commit.Hash == hash + }) +}