Skip to content

Commit

Permalink
ignore redundant actions when undoing and redoing
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseduffield committed Mar 24, 2020
1 parent d105e26 commit 45bba0a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/gui/undoing.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,23 @@ func (gui *Gui) parseReflogForActions(onUserAction func(counter int, action refl
action = &reflogAction{kind: COMMIT, from: prevCommitSha, to: reflogCommit.Sha}
} else if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^rebase -i \(start\)`); ok {
// if we're here then we must be currently inside an interactive rebase
action = &reflogAction{kind: CURRENT_REBASE}
action = &reflogAction{kind: CURRENT_REBASE, from: prevCommitSha}
}
} else if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^rebase -i \(start\)`); ok {
action = &reflogAction{kind: REBASE, from: prevCommitSha, to: rebaseFinishCommitSha}
rebaseFinishCommitSha = ""
}

if action != nil {
if action.kind != CURRENT_REBASE && action.from == action.to {
// if we're going from one place to the same place we'll ignore the action.
continue
}
ok, err := onUserAction(counter, *action)
if ok {
return err
}
counter--
if action.kind == REBASE {
rebaseFinishCommitSha = ""
}
}
}
return nil
Expand Down

0 comments on commit 45bba0a

Please sign in to comment.