mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-15 22:26:40 +02:00
Extract common code to a helper method
This should arguably have been done in b133318b40 already; it's becoming more important now because we're going to extend the common code with more logic in the next commit.
This commit is contained in:
parent
3e3b902228
commit
c6d20c876e
@ -847,11 +847,7 @@ func (self *LocalCommitsController) squashFixupCommits() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *LocalCommitsController) squashAllFixupsAboveSelectedCommit(commit *models.Commit) error {
|
func (self *LocalCommitsController) squashAllFixupsAboveSelectedCommit(commit *models.Commit) error {
|
||||||
return self.c.WithWaitingStatus(self.c.Tr.SquashingStatus, func(gocui.Task) error {
|
return self.squashFixupsImpl(commit)
|
||||||
self.c.LogAction(self.c.Tr.Actions.SquashAllAboveFixupCommits)
|
|
||||||
err := self.c.Git().Rebase.SquashAllAboveFixupCommits(commit)
|
|
||||||
return self.c.Helpers().MergeAndRebase.CheckMergeOrRebase(err)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *LocalCommitsController) squashAllFixupsInCurrentBranch() error {
|
func (self *LocalCommitsController) squashAllFixupsInCurrentBranch() error {
|
||||||
@ -860,6 +856,10 @@ func (self *LocalCommitsController) squashAllFixupsInCurrentBranch() error {
|
|||||||
return self.c.Error(err)
|
return self.c.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return self.squashFixupsImpl(commit)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *LocalCommitsController) squashFixupsImpl(commit *models.Commit) error {
|
||||||
return self.c.WithWaitingStatus(self.c.Tr.SquashingStatus, func(gocui.Task) error {
|
return self.c.WithWaitingStatus(self.c.Tr.SquashingStatus, func(gocui.Task) error {
|
||||||
self.c.LogAction(self.c.Tr.Actions.SquashAllAboveFixupCommits)
|
self.c.LogAction(self.c.Tr.Actions.SquashAllAboveFixupCommits)
|
||||||
err := self.c.Git().Rebase.SquashAllAboveFixupCommits(commit)
|
err := self.c.Git().Rebase.SquashAllAboveFixupCommits(commit)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user