From 014fa6329915cf9a7521b024cc896c3e46c6582b Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sun, 27 Apr 2025 21:40:17 +0200 Subject: [PATCH] Add FixupFlag field to Commit This is true for Fixup todos that have their -C flag set. --- pkg/commands/git_commands/commit_loader.go | 10 ++++++---- pkg/commands/models/commit.go | 3 +++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pkg/commands/git_commands/commit_loader.go b/pkg/commands/git_commands/commit_loader.go index 6b1dfacdf..7383b4173 100644 --- a/pkg/commands/git_commands/commit_loader.go +++ b/pkg/commands/git_commands/commit_loader.go @@ -320,6 +320,7 @@ func (self *CommitLoader) getHydratedTodoCommits(hashPool *utils.StringPool, tod hydratedCommits = append(hydratedCommits, rebasingCommit) } else if commit := findFullCommit(rebasingCommit.Hash()); commit != nil { commit.Action = rebasingCommit.Action + commit.FixupFlag = rebasingCommit.FixupFlag commit.Status = rebasingCommit.Status hydratedCommits = append(hydratedCommits, commit) } @@ -366,10 +367,11 @@ func (self *CommitLoader) getRebasingCommits(hashPool *utils.StringPool, addConf continue } commits = utils.Prepend(commits, models.NewCommit(hashPool, models.NewCommitOpts{ - Hash: t.Commit, - Name: t.Msg, - Status: models.StatusRebasing, - Action: t.Command, + Hash: t.Commit, + Name: t.Msg, + Status: models.StatusRebasing, + Action: t.Command, + FixupFlag: t.Command == todo.Fixup && t.Flag == "-C", })) } diff --git a/pkg/commands/models/commit.go b/pkg/commands/models/commit.go index eca66b3ac..0cc2cf86f 100644 --- a/pkg/commands/models/commit.go +++ b/pkg/commands/models/commit.go @@ -56,6 +56,7 @@ type Commit struct { Status CommitStatus Action todo.TodoCommand + FixupFlag bool // Only used for todo.Fixup action: true if the `-C` flag is set Divergence Divergence // set to DivergenceNone unless we are showing the divergence view } @@ -64,6 +65,7 @@ type NewCommitOpts struct { Name string Status CommitStatus Action todo.TodoCommand + FixupFlag bool Tags []string ExtraInfo string AuthorName string @@ -79,6 +81,7 @@ func NewCommit(hashPool *utils.StringPool, opts NewCommitOpts) *Commit { Name: opts.Name, Status: opts.Status, Action: opts.Action, + FixupFlag: opts.FixupFlag, Tags: opts.Tags, ExtraInfo: opts.ExtraInfo, AuthorName: opts.AuthorName,