Monorepo for Tangled tangled.org

knotserver: git: add more fields to NiceDiff.Commit

These should now let us reconstruct the commit object (or at least the
git cat-file equivalent) appview-side.

Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.sh>

authored by anirudh.fi and committed by Tangled ea1b3729 b08135c8

Changed files
+15 -4
knotserver
git
types
+7
knotserver/git/diff.go
··· 79 79 80 80 nd.Stat.FilesChanged = len(diffs) 81 81 nd.Commit.This = c.Hash.String() 82 + nd.Commit.PGPSignature = c.PGPSignature 83 + nd.Commit.Committer = c.Committer 84 + nd.Commit.Tree = c.TreeHash.String() 82 85 83 86 if parent.Hash.IsZero() { 84 87 nd.Commit.Parent = "" ··· 87 90 } 88 91 nd.Commit.Author = c.Author 89 92 nd.Commit.Message = c.Message 93 + 94 + if v, ok := c.ExtraHeaders["change-id"]; ok { 95 + nd.Commit.ChangedId = string(v) 96 + } 90 97 91 98 return &nd, nil 92 99 }
+8 -4
types/diff.go
··· 40 40 // A nicer git diff representation. 41 41 type NiceDiff struct { 42 42 Commit struct { 43 - Message string `json:"message"` 44 - Author object.Signature `json:"author"` 45 - This string `json:"this"` 46 - Parent string `json:"parent"` 43 + Message string `json:"message"` 44 + Author object.Signature `json:"author"` 45 + This string `json:"this"` 46 + Parent string `json:"parent"` 47 + PGPSignature string `json:"pgp_signature"` 48 + Committer object.Signature `json:"committer"` 49 + Tree string `json:"tree"` 50 + ChangedId string `json:"change_id"` 47 51 } `json:"commit"` 48 52 Stat struct { 49 53 FilesChanged int `json:"files_changed"`