mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 04:15:48 +02:00
Simplify finding rebase todos
One of the comments we are deleting here said: // Comparing just the hash is not enough; we need to compare both the // action and the hash, as the hash could appear multiple times (e.g. in a // pick and later in a merge). I don't remember what I was thinking when I wrote this code, but it's nonsense of course. Maybe I was thinking that the hash that appears in a "merge" todo would be the hash of the commit that is being merged in (which would then actually appear in an earlier pick), but it isn't, it's the hash of the merge commit itself (so that the rebase can reuse its commit message). Which means that hashes are unique, no need to compare the action.
This commit is contained in:
parent
2823a7cff0
commit
64eb3d560b
4 changed files with 26 additions and 42 deletions
|
@ -324,9 +324,9 @@ func (self *RebaseCommands) MoveFixupCommitDown(commits []*models.Commit, target
|
|||
|
||||
func todoFromCommit(commit *models.Commit) utils.Todo {
|
||||
if commit.Action == todo.UpdateRef {
|
||||
return utils.Todo{Ref: commit.Name, Action: commit.Action}
|
||||
return utils.Todo{Ref: commit.Name}
|
||||
} else {
|
||||
return utils.Todo{Hash: commit.Hash, Action: commit.Action}
|
||||
return utils.Todo{Hash: commit.Hash}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -335,7 +335,6 @@ func (self *RebaseCommands) EditRebaseTodo(commits []*models.Commit, action todo
|
|||
commitsWithAction := lo.Map(commits, func(commit *models.Commit, _ int) utils.TodoChange {
|
||||
return utils.TodoChange{
|
||||
Hash: commit.Hash,
|
||||
OldAction: commit.Action,
|
||||
NewAction: action,
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue