From 9c8f987934eaf5480cd8516a5d47dcbf6d509911 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 5 Apr 2025 10:48:32 +0200 Subject: [PATCH] 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. --- pkg/commands/git_commands/commit_loader.go | 2 +- pkg/gui/controllers/files_controller.go | 2 +- pkg/gui/controllers/helpers/merge_and_rebase_helper.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/commands/git_commands/commit_loader.go b/pkg/commands/git_commands/commit_loader.go index 22050b384..556863de1 100644 --- a/pkg/commands/git_commands/commit_loader.go +++ b/pkg/commands/git_commands/commit_loader.go @@ -126,7 +126,7 @@ func (self *CommitLoader) GetCommits(opts GetCommitsOptions) ([]*models.Commit, if commit.Hash == firstPushedCommit { passedFirstPushedCommit = true } - if commit.Status != models.StatusRebasing { + if !commit.IsTODO() { if passedFirstPushedCommit { commit.Status = models.StatusPushed } else { diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go index 167e29f1b..45cb80d2f 100644 --- a/pkg/gui/controllers/files_controller.go +++ b/pkg/gui/controllers/files_controller.go @@ -829,7 +829,7 @@ func (self *FilesController) handleAmendCommitPress() error { func (self *FilesController) isResolvingConflicts() bool { commits := self.c.Model().Commits for _, c := range commits { - if c.Status != models.StatusRebasing { + if !c.IsTODO() { break } if c.Action == models.ActionConflict { diff --git a/pkg/gui/controllers/helpers/merge_and_rebase_helper.go b/pkg/gui/controllers/helpers/merge_and_rebase_helper.go index 3f2ced17e..8505110a0 100644 --- a/pkg/gui/controllers/helpers/merge_and_rebase_helper.go +++ b/pkg/gui/controllers/helpers/merge_and_rebase_helper.go @@ -122,7 +122,7 @@ func (self *MergeAndRebaseHelper) genericMergeCommand(command string) error { func (self *MergeAndRebaseHelper) hasExecTodos() bool { for _, commit := range self.c.Model().Commits { - if commit.Status != models.StatusRebasing { + if !commit.IsTODO() { break } if commit.Action == todo.Exec {