Store fromHash/toHash in Pipe struct as pointers

Now that commit hashes are stored in a pool and referenced by pointer by the
commits, we can use those same pointers in the pipes.
This commit is contained in:
Stefan Haller 2025-04-15 14:57:40 +02:00
parent 8d834e2eab
commit 13c21365c0
7 changed files with 126 additions and 112 deletions

View file

@ -93,6 +93,10 @@ func (c *Commit) Hash() string {
return *c.hash
}
func (c *Commit) HashPtr() *string {
return c.hash
}
func (c *Commit) ShortHash() string {
return utils.ShortHash(c.Hash())
}
@ -120,6 +124,10 @@ func (c *Commit) Parents() []string {
return lo.Map(c.parents, func(s *string, _ int) string { return *s })
}
func (c *Commit) ParentPtrs() []*string {
return c.parents
}
func (c *Commit) IsFirstCommit() bool {
return len(c.parents) == 0
}