| 80 | } |
| 81 | |
| 82 | func NewCommit(hashPool *utils.StringPool, opts NewCommitOpts) *Commit { |
| 83 | return &Commit{ |
| 84 | hash: hashPool.Add(opts.Hash), |
| 85 | Name: opts.Name, |
| 86 | Status: opts.Status, |
| 87 | Action: opts.Action, |
| 88 | ActionFlag: opts.ActionFlag, |
| 89 | Tags: opts.Tags, |
| 90 | ExtraInfo: opts.ExtraInfo, |
| 91 | AuthorName: opts.AuthorName, |
| 92 | AuthorEmail: opts.AuthorEmail, |
| 93 | UnixTimestamp: opts.UnixTimestamp, |
| 94 | Divergence: opts.Divergence, |
| 95 | parents: lo.Map(opts.Parents, func(s string, _ int) *string { return hashPool.Add(s) }), |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | func (c *Commit) Hash() string { |
| 100 | return *c.hash |