···7778 return files
79}
80-81-// ObjectCommitToNiceDiff is a compatibility function to convert a
82-// commit object into a NiceDiff structure.
83-func ObjectCommitToNiceDiff(c *object.Commit) NiceDiff {
84- var niceDiff NiceDiff
85-86- // set commit information
87- niceDiff.Commit.Message = c.Message
88- niceDiff.Commit.Author = c.Author
89- niceDiff.Commit.This = c.Hash.String()
90- niceDiff.Commit.Committer = c.Committer
91- niceDiff.Commit.Tree = c.TreeHash.String()
92- niceDiff.Commit.PGPSignature = c.PGPSignature
93-94- changeId, ok := c.ExtraHeaders["change-id"]
95- if ok {
96- niceDiff.Commit.ChangedId = string(changeId)
97- }
98-99- // set parent hash if available
100- if len(c.ParentHashes) > 0 {
101- niceDiff.Commit.Parent = c.ParentHashes[0].String()
102- }
103-104- // XXX: Stats and Diff fields are typically populated
105- // after fetching the actual diff information, which isn't
106- // directly available in the commit object itself.
107-108- return niceDiff
109-}