From b09000194a571579dddb1f0793a4d8c5d0e8d99c Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 18 Apr 2023 17:33:33 +0200 Subject: [PATCH 1/2] Allow resetting author of HEAD commit during rebase --- pkg/commands/git_commands/rebase.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/commands/git_commands/rebase.go b/pkg/commands/git_commands/rebase.go index cffc5d68a..5828ffbaa 100644 --- a/pkg/commands/git_commands/rebase.go +++ b/pkg/commands/git_commands/rebase.go @@ -79,7 +79,7 @@ func (self *RebaseCommands) SetCommitAuthor(commits []*models.Commit, index int, } func (self *RebaseCommands) GenericAmend(commits []*models.Commit, index int, f func() error) error { - if index == 0 { + if models.IsHeadCommit(commits, index) { // we've selected the top commit so no rebase is required return f() } From 21072226d24bf8e2cd9dbd2085b969303a1797eb Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 18 Apr 2023 17:34:07 +0200 Subject: [PATCH 2/2] Don't allow resetting non-HEAD commits (including rebase todos) during rebase --- pkg/gui/controllers/local_commits_controller.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go index 4610aed12..35e314357 100644 --- a/pkg/gui/controllers/local_commits_controller.go +++ b/pkg/gui/controllers/local_commits_controller.go @@ -474,6 +474,10 @@ func (self *LocalCommitsController) amendTo(commit *models.Commit) error { } func (self *LocalCommitsController) amendAttribute(commit *models.Commit) error { + if self.git.Status.WorkingTreeState() != enums.REBASE_MODE_NONE && !self.isHeadCommit() { + return self.c.ErrorMsg(self.c.Tr.AlreadyRebasing) + } + return self.c.Menu(types.CreateMenuOptions{ Title: "Amend commit attribute", Items: []*types.MenuItem{