summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2024-01-31 12:02:24 +0100
committerStefan Haller <stefan@haller-berlin.de>2024-03-09 07:55:22 +0100
commitc6d20c876ecb11b2476eb9b173734f6af3aff06c (patch)
tree2b86cbe2e82eefdcee92a3cb738b758a4e02f441 /pkg
parent3e3b902228189255d7411413f0ef7deef71ef6ac (diff)
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.
Diffstat (limited to 'pkg')
-rw-r--r--pkg/gui/controllers/local_commits_controller.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go
index 0c55ffa44..e6b8bc801 100644
--- a/pkg/gui/controllers/local_commits_controller.go
+++ b/pkg/gui/controllers/local_commits_controller.go
@@ -847,11 +847,7 @@ func (self *LocalCommitsController) squashFixupCommits() error {
}
func (self *LocalCommitsController) squashAllFixupsAboveSelectedCommit(commit *models.Commit) error {
- return self.c.WithWaitingStatus(self.c.Tr.SquashingStatus, func(gocui.Task) error {
- self.c.LogAction(self.c.Tr.Actions.SquashAllAboveFixupCommits)
- err := self.c.Git().Rebase.SquashAllAboveFixupCommits(commit)
- return self.c.Helpers().MergeAndRebase.CheckMergeOrRebase(err)
- })
+ return self.squashFixupsImpl(commit)
}
func (self *LocalCommitsController) squashAllFixupsInCurrentBranch() error {
@@ -860,6 +856,10 @@ func (self *LocalCommitsController) squashAllFixupsInCurrentBranch() error {
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 {
self.c.LogAction(self.c.Tr.Actions.SquashAllAboveFixupCommits)
err := self.c.Git().Rebase.SquashAllAboveFixupCommits(commit)