Make Commit.Hash a getter for an unexported hash field

This is in preparation for turning the hash into pointer to a string.
This commit is contained in:
Stefan Haller 2025-04-24 09:13:40 +02:00
parent 97aa7a04e6
commit 1037371a44
28 changed files with 301 additions and 245 deletions

View file

@ -65,7 +65,7 @@ func (self *ReflogCommitLoader) GetReflogCommits(lastReflogCommit *models.Commit
}
func (self *ReflogCommitLoader) sameReflogCommit(a *models.Commit, b *models.Commit) bool {
return a.Hash == b.Hash && a.UnixTimestamp == b.UnixTimestamp && a.Name == b.Name
return a.Hash() == b.Hash() && a.UnixTimestamp == b.UnixTimestamp && a.Name == b.Name
}
func (self *ReflogCommitLoader) parseLine(line string) (*models.Commit, bool) {
@ -82,11 +82,11 @@ func (self *ReflogCommitLoader) parseLine(line string) (*models.Commit, bool) {
parents = strings.Split(parentHashes, " ")
}
return &models.Commit{
return models.NewCommit(models.NewCommitOpts{
Hash: fields[0],
Name: fields[2],
UnixTimestamp: int64(unixTimestamp),
Status: models.StatusReflog,
Parents: parents,
}, true
}), true
}