Better error message for trying to squash or fixup the first commit

It's not so much the total number of commits that matters here, it's just
whether we are on the first one. (This includes the other condition.)

This allows us to get rid of the condition in rebase.go.
This commit is contained in:
Stefan Haller 2023-02-19 15:08:35 +01:00
parent 1c3db24e44
commit dd61c49a15
11 changed files with 87 additions and 22 deletions

View file

@ -178,10 +178,6 @@ func (self *RebaseCommands) BuildSingleActionTodo(commits []*models.Commit, acti
if action == "squash" || action == "fixup" {
baseIndex++
if len(commits) <= baseIndex {
return nil, "", errors.New(self.Tr.CannotSquashOntoSecondCommit)
}
}
todoLines := self.BuildTodoLines(commits[0:baseIndex], func(commit *models.Commit, i int) string {