Add FixupFlag field to Commit

This is true for Fixup todos that have their -C flag set.
This commit is contained in:
Stefan Haller 2025-04-27 21:40:17 +02:00
parent 66caa25dcd
commit 014fa63299
2 changed files with 9 additions and 4 deletions

View file

@ -320,6 +320,7 @@ func (self *CommitLoader) getHydratedTodoCommits(hashPool *utils.StringPool, tod
hydratedCommits = append(hydratedCommits, rebasingCommit) hydratedCommits = append(hydratedCommits, rebasingCommit)
} else if commit := findFullCommit(rebasingCommit.Hash()); commit != nil { } else if commit := findFullCommit(rebasingCommit.Hash()); commit != nil {
commit.Action = rebasingCommit.Action commit.Action = rebasingCommit.Action
commit.FixupFlag = rebasingCommit.FixupFlag
commit.Status = rebasingCommit.Status commit.Status = rebasingCommit.Status
hydratedCommits = append(hydratedCommits, commit) hydratedCommits = append(hydratedCommits, commit)
} }
@ -366,10 +367,11 @@ func (self *CommitLoader) getRebasingCommits(hashPool *utils.StringPool, addConf
continue continue
} }
commits = utils.Prepend(commits, models.NewCommit(hashPool, models.NewCommitOpts{ commits = utils.Prepend(commits, models.NewCommit(hashPool, models.NewCommitOpts{
Hash: t.Commit, Hash: t.Commit,
Name: t.Msg, Name: t.Msg,
Status: models.StatusRebasing, Status: models.StatusRebasing,
Action: t.Command, Action: t.Command,
FixupFlag: t.Command == todo.Fixup && t.Flag == "-C",
})) }))
} }

View file

@ -56,6 +56,7 @@ type Commit struct {
Status CommitStatus Status CommitStatus
Action todo.TodoCommand 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 Divergence Divergence // set to DivergenceNone unless we are showing the divergence view
} }
@ -64,6 +65,7 @@ type NewCommitOpts struct {
Name string Name string
Status CommitStatus Status CommitStatus
Action todo.TodoCommand Action todo.TodoCommand
FixupFlag bool
Tags []string Tags []string
ExtraInfo string ExtraInfo string
AuthorName string AuthorName string
@ -79,6 +81,7 @@ func NewCommit(hashPool *utils.StringPool, opts NewCommitOpts) *Commit {
Name: opts.Name, Name: opts.Name,
Status: opts.Status, Status: opts.Status,
Action: opts.Action, Action: opts.Action,
FixupFlag: opts.FixupFlag,
Tags: opts.Tags, Tags: opts.Tags,
ExtraInfo: opts.ExtraInfo, ExtraInfo: opts.ExtraInfo,
AuthorName: opts.AuthorName, AuthorName: opts.AuthorName,