Skip to content

Commit 9c8f987

Browse files
committed
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.
1 parent d84ee60 commit 9c8f987

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

pkg/commands/git_commands/commit_loader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func (self *CommitLoader) GetCommits(opts GetCommitsOptions) ([]*models.Commit,
126126
if commit.Hash == firstPushedCommit {
127127
passedFirstPushedCommit = true
128128
}
129-
if commit.Status != models.StatusRebasing {
129+
if !commit.IsTODO() {
130130
if passedFirstPushedCommit {
131131
commit.Status = models.StatusPushed
132132
} else {

pkg/gui/controllers/files_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ func (self *FilesController) handleAmendCommitPress() error {
829829
func (self *FilesController) isResolvingConflicts() bool {
830830
commits := self.c.Model().Commits
831831
for _, c := range commits {
832-
if c.Status != models.StatusRebasing {
832+
if !c.IsTODO() {
833833
break
834834
}
835835
if c.Action == models.ActionConflict {

pkg/gui/controllers/helpers/merge_and_rebase_helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func (self *MergeAndRebaseHelper) genericMergeCommand(command string) error {
122122

123123
func (self *MergeAndRebaseHelper) hasExecTodos() bool {
124124
for _, commit := range self.c.Model().Commits {
125-
if commit.Status != models.StatusRebasing {
125+
if !commit.IsTODO() {
126126
break
127127
}
128128
if commit.Action == todo.Exec {

0 commit comments

Comments
 (0)