Use commit.IsTODO instead of comparing Status against models.StatusRebasing

This is equivalent in the current state of the code, but it will no longer be
after the next commit, because we will introduce a new status value
StatusConflicted. And in a later PR we might add yet another value
StatusCherryPicking to distinguish rebase todos from cherry-pick todos; using
commit.IsTODO is a safer way to check whether a commit is any of these.
This commit is contained in:
Stefan Haller 2025-04-05 10:48:32 +02:00
parent d84ee606e8
commit 9c8f987934
3 changed files with 3 additions and 3 deletions

View file

@ -126,7 +126,7 @@ func (self *CommitLoader) GetCommits(opts GetCommitsOptions) ([]*models.Commit,
if commit.Hash == firstPushedCommit { if commit.Hash == firstPushedCommit {
passedFirstPushedCommit = true passedFirstPushedCommit = true
} }
if commit.Status != models.StatusRebasing { if !commit.IsTODO() {
if passedFirstPushedCommit { if passedFirstPushedCommit {
commit.Status = models.StatusPushed commit.Status = models.StatusPushed
} else { } else {

View file

@ -829,7 +829,7 @@ func (self *FilesController) handleAmendCommitPress() error {
func (self *FilesController) isResolvingConflicts() bool { func (self *FilesController) isResolvingConflicts() bool {
commits := self.c.Model().Commits commits := self.c.Model().Commits
for _, c := range commits { for _, c := range commits {
if c.Status != models.StatusRebasing { if !c.IsTODO() {
break break
} }
if c.Action == models.ActionConflict { if c.Action == models.ActionConflict {

View file

@ -122,7 +122,7 @@ func (self *MergeAndRebaseHelper) genericMergeCommand(command string) error {
func (self *MergeAndRebaseHelper) hasExecTodos() bool { func (self *MergeAndRebaseHelper) hasExecTodos() bool {
for _, commit := range self.c.Model().Commits { for _, commit := range self.c.Model().Commits {
if commit.Status != models.StatusRebasing { if !commit.IsTODO() {
break break
} }
if commit.Action == todo.Exec { if commit.Action == todo.Exec {