mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-13 01:30:53 +02:00
Remove unnecessary refresh
CheckMergeOrRebase calls Refresh already. However, it does an async refresh by default, so we must turn this into a sync refresh so that moving the selection down by one works even for the very first commit in history. Also, we must add an explicit call to FocusLine so that the view selection is in sync with the model selection; previously this was taken care of by the PostRefreshUpdate call that happens as part of a refresh.
This commit is contained in:
@ -874,13 +874,11 @@ func (self *LocalCommitsController) revert(commits []*models.Commit, start, end
|
||||
self.c.LogAction(self.c.Tr.Actions.RevertCommit)
|
||||
return self.c.WithWaitingStatusSync(self.c.Tr.RevertingStatus, func() error {
|
||||
result := self.c.Git().Commit.Revert(hashes, isMerge)
|
||||
if err := self.c.Helpers().MergeAndRebase.CheckMergeOrRebase(result); err != nil {
|
||||
if err := self.c.Helpers().MergeAndRebase.CheckMergeOrRebaseWithRefreshOptions(result, types.RefreshOptions{Mode: types.SYNC}); err != nil {
|
||||
return err
|
||||
}
|
||||
self.context().MoveSelection(len(commits))
|
||||
self.c.Refresh(types.RefreshOptions{
|
||||
Mode: types.SYNC, Scope: []types.RefreshableView{types.COMMITS, types.BRANCHES},
|
||||
})
|
||||
self.context().FocusLine()
|
||||
return nil
|
||||
})
|
||||
},
|
||||
|
Reference in New Issue
Block a user