summaryrefslogtreecommitdiffstats
path: root/pkg/commands/models
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-06-05 16:39:59 +1000
committerJesse Duffield <jessedduffield@gmail.com>2021-06-05 22:15:51 +1000
commitfb395bca6eedfc44afb04ad26005a45e7b7dfea9 (patch)
tree4669caf828ea97afdb9c829820ff53c5731fcca2 /pkg/commands/models
parentf91adf026bfbddc9505d6d84d3fabc80d49c7ca0 (diff)
support reverting merge commits
Diffstat (limited to 'pkg/commands/models')
-rw-r--r--pkg/commands/models/commit.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/pkg/commands/models/commit.go b/pkg/commands/models/commit.go
index 78cf7f7f7..1b8659e77 100644
--- a/pkg/commands/models/commit.go
+++ b/pkg/commands/models/commit.go
@@ -13,8 +13,8 @@ type Commit struct {
Author string
UnixTimestamp int64
- // IsMerge tells us whether we're dealing with a merge commit i.e. a commit with two parents
- IsMerge bool
+ // SHAs of parent commits (will be multiple if it's a merge commit)
+ Parents []string
}
func (c *Commit) ShortSha() string {
@@ -35,3 +35,7 @@ func (c *Commit) ID() string {
func (c *Commit) Description() string {
return fmt.Sprintf("%s %s", c.Sha[:7], c.Name)
}
+
+func (c *Commit) IsMerge() bool {
+ return len(c.Parents) > 1
+}