Skip to content

Commit dc66f20

Browse files
committed
Add FixupFlag field to Commit
This is true for Fixup todos that have their -C flag set.
1 parent 5d30409 commit dc66f20

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

pkg/commands/git_commands/commit_loader.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ func (self *CommitLoader) getHydratedTodoCommits(hashPool *utils.StringPool, tod
320320
hydratedCommits = append(hydratedCommits, rebasingCommit)
321321
} else if commit := findFullCommit(rebasingCommit.Hash()); commit != nil {
322322
commit.Action = rebasingCommit.Action
323+
commit.FixupFlag = rebasingCommit.FixupFlag
323324
commit.Status = rebasingCommit.Status
324325
hydratedCommits = append(hydratedCommits, commit)
325326
}
@@ -366,10 +367,11 @@ func (self *CommitLoader) getRebasingCommits(hashPool *utils.StringPool, addConf
366367
continue
367368
}
368369
commits = utils.Prepend(commits, models.NewCommit(hashPool, models.NewCommitOpts{
369-
Hash: t.Commit,
370-
Name: t.Msg,
371-
Status: models.StatusRebasing,
372-
Action: t.Command,
370+
Hash: t.Commit,
371+
Name: t.Msg,
372+
Status: models.StatusRebasing,
373+
Action: t.Command,
374+
FixupFlag: t.Command == todo.Fixup && t.Flag == "-C",
373375
}))
374376
}
375377

pkg/commands/models/commit.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ type Commit struct {
5656

5757
Status CommitStatus
5858
Action todo.TodoCommand
59+
FixupFlag bool // Only used for todo.Fixup action: true if the `-C` flag is set
5960
Divergence Divergence // set to DivergenceNone unless we are showing the divergence view
6061
}
6162

@@ -64,6 +65,7 @@ type NewCommitOpts struct {
6465
Name string
6566
Status CommitStatus
6667
Action todo.TodoCommand
68+
FixupFlag bool
6769
Tags []string
6870
ExtraInfo string
6971
AuthorName string
@@ -79,6 +81,7 @@ func NewCommit(hashPool *utils.StringPool, opts NewCommitOpts) *Commit {
7981
Name: opts.Name,
8082
Status: opts.Status,
8183
Action: opts.Action,
84+
FixupFlag: opts.FixupFlag,
8285
Tags: opts.Tags,
8386
ExtraInfo: opts.ExtraInfo,
8487
AuthorName: opts.AuthorName,

0 commit comments

Comments
 (0)