diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2023-08-22 16:35:30 +0200 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2024-03-09 07:55:22 +0100 |
commit | 3e3b902228189255d7411413f0ef7deef71ef6ac (patch) | |
tree | 618e8ae4e208e4c5c6fb8ac5bebf5c87a10712dd | |
parent | dfb45ba893200f09cdeceef281de65169757059c (diff) |
Move selection down by one after creating a fixup commit
-rw-r--r-- | pkg/gui/controllers/local_commits_controller.go | 11 | ||||
-rw-r--r-- | pkg/i18n/english.go | 2 | ||||
-rw-r--r-- | pkg/integration/tests/interactive_rebase/squash_fixups_above.go | 5 |
3 files changed, 11 insertions, 7 deletions
diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go index d290192e4..0c55ffa44 100644 --- a/pkg/gui/controllers/local_commits_controller.go +++ b/pkg/gui/controllers/local_commits_controller.go @@ -811,11 +811,14 @@ func (self *LocalCommitsController) createFixupCommit(commit *models.Commit) err HandleConfirm: func() error { return self.c.Helpers().WorkingTree.WithEnsureCommitableFiles(func() error { self.c.LogAction(self.c.Tr.Actions.CreateFixupCommit) - if err := self.c.Git().Commit.CreateFixupCommit(commit.Sha); err != nil { - return self.c.Error(err) - } + return self.c.WithWaitingStatusSync(self.c.Tr.CreatingFixupCommitStatus, func() error { + if err := self.c.Git().Commit.CreateFixupCommit(commit.Sha); err != nil { + return self.c.Error(err) + } - return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC}) + self.context().MoveSelectedLine(1) + return self.c.Refresh(types.RefreshOptions{Mode: types.SYNC}) + }) }) }, }) diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index c05033834..b1d0e01eb 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -341,6 +341,7 @@ type TranslationSet struct { CheckingOutStatus string CommittingStatus string RevertingStatus string + CreatingFixupCommitStatus string CommitFiles string SubCommitsDynamicTitle string CommitFilesDynamicTitle string @@ -1289,6 +1290,7 @@ func EnglishTranslationSet() TranslationSet { CheckingOutStatus: "Checking out", CommittingStatus: "Committing", RevertingStatus: "Reverting", + CreatingFixupCommitStatus: "Creating fixup commit", CommitFiles: "Commit files", SubCommitsDynamicTitle: "Commits (%s)", CommitFilesDynamicTitle: "Diff files (%s)", diff --git a/pkg/integration/tests/interactive_rebase/squash_fixups_above.go b/pkg/integration/tests/interactive_rebase/squash_fixups_above.go index 9af6594ef..b412f93ed 100644 --- a/pkg/integration/tests/interactive_rebase/squash_fixups_above.go +++ b/pkg/integration/tests/interactive_rebase/squash_fixups_above.go @@ -33,11 +33,10 @@ var SquashFixupsAbove = NewIntegrationTest(NewIntegrationTestArgs{ }). Lines( Contains("fixup! commit 02"), - Contains("commit 03").IsSelected(), // wrong, we want the next line - Contains("commit 02"), + Contains("commit 03"), + Contains("commit 02").IsSelected(), Contains("commit 01"), ). - SelectNextItem(). Press(keys.Commits.SquashAboveCommits). Tap(func() { t.ExpectPopup().Menu(). |