···77777878 return files
7979}
8080+8181+// ObjectCommitToNiceDiff is a compatibility function to convert a
8282+// commit object into a NiceDiff structure.
8383+func ObjectCommitToNiceDiff(c *object.Commit) NiceDiff {
8484+ var niceDiff NiceDiff
8585+8686+ // set commit information
8787+ niceDiff.Commit.Message = c.Message
8888+ niceDiff.Commit.Author = c.Author
8989+ niceDiff.Commit.This = c.Hash.String()
9090+ niceDiff.Commit.Committer = c.Committer
9191+ niceDiff.Commit.Tree = c.TreeHash.String()
9292+ niceDiff.Commit.PGPSignature = c.PGPSignature
9393+9494+ changeId, ok := c.ExtraHeaders["change-id"]
9595+ if ok {
9696+ niceDiff.Commit.ChangedId = string(changeId)
9797+ }
9898+9999+ // set parent hash if available
100100+ if len(c.ParentHashes) > 0 {
101101+ niceDiff.Commit.Parent = c.ParentHashes[0].String()
102102+ }
103103+104104+ // XXX: Stats and Diff fields are typically populated
105105+ // after fetching the actual diff information, which isn't
106106+ // directly available in the commit object itself.
107107+108108+ return niceDiff
109109+}