mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-10 04:07:18 +02:00
Cleanup: use commit.isTODO() consistently
It seems cleaner than checking the Status for "rebasing".
This commit is contained in:
parent
3a59aba46d
commit
c6930e0538
@ -113,7 +113,7 @@ func (self *CommitLoader) MergeRebasingCommits(commits []*models.Commit) ([]*mod
|
|||||||
// chances are we have as many commits as last time so we'll set the capacity to be the old length
|
// chances are we have as many commits as last time so we'll set the capacity to be the old length
|
||||||
result := make([]*models.Commit, 0, len(commits))
|
result := make([]*models.Commit, 0, len(commits))
|
||||||
for i, commit := range commits {
|
for i, commit := range commits {
|
||||||
if commit.Status != "rebasing" { // removing the existing rebase commits so we can add the refreshed ones
|
if !commit.IsTODO() { // removing the existing rebase commits so we can add the refreshed ones
|
||||||
result = append(result, commits[i:]...)
|
result = append(result, commits[i:]...)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -326,7 +326,7 @@ func (self *LocalCommitsController) interactiveRebase(action string) error {
|
|||||||
// commit meaning you are trying to edit the todo file rather than actually
|
// commit meaning you are trying to edit the todo file rather than actually
|
||||||
// begin a rebase. It then updates the todo file with that action
|
// begin a rebase. It then updates the todo file with that action
|
||||||
func (self *LocalCommitsController) handleMidRebaseCommand(action string, commit *models.Commit) (bool, error) {
|
func (self *LocalCommitsController) handleMidRebaseCommand(action string, commit *models.Commit) (bool, error) {
|
||||||
if commit.Status != "rebasing" {
|
if !commit.IsTODO() {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,8 +364,8 @@ func (self *LocalCommitsController) moveDown(commit *models.Commit) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if commit.Status == "rebasing" {
|
if commit.IsTODO() {
|
||||||
if commits[index+1].Status != "rebasing" {
|
if !commits[index+1].IsTODO() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,7 +399,7 @@ func (self *LocalCommitsController) moveUp(commit *models.Commit) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if commit.Status == "rebasing" {
|
if commit.IsTODO() {
|
||||||
// logging directly here because MoveTodoDown doesn't have enough information
|
// logging directly here because MoveTodoDown doesn't have enough information
|
||||||
// to provide a useful log
|
// to provide a useful log
|
||||||
self.c.LogAction(self.c.Tr.Actions.MoveCommitUp)
|
self.c.LogAction(self.c.Tr.Actions.MoveCommitUp)
|
||||||
|
Loading…
Reference in New Issue
Block a user