Monorepo for Tangled tangled.org
856
fork

Configure Feed

Select the types of activity you want to include in your feed.

knotmirror: reinstate LastCommitInfo in tree responses #318

open opened by oppi.li targeting master from op/sxolltqksvuo
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:qfpnj4og54vl56wngdriaxug/sh.tangled.repo.pull/3mkzdnss2zv22
+36 -4
Diff #0
+36 -4
knotmirror/xrpc/git_get_tree.go
··· 13 13 "tangled.org/core/api/tangled" 14 14 "tangled.org/core/appview/pages/markup" 15 15 "tangled.org/core/knotserver/git" 16 + "tangled.org/core/types" 16 17 ) 17 18 18 19 func (x *Xrpc) GetTree(w http.ResponseWriter, r *http.Request) { ··· 106 107 } 107 108 } 108 109 110 + // find the most recent commit across all entries for the directory-level last commit 111 + var lastCommitInfo *types.LastCommitInfo 112 + for _, file := range files { 113 + if file.LastCommit == nil { 114 + continue 115 + } 116 + if lastCommitInfo == nil { 117 + lastCommitInfo = file.LastCommit 118 + continue 119 + } 120 + if file.LastCommit.When.After(lastCommitInfo.When) { 121 + lastCommitInfo = file.LastCommit 122 + } 123 + } 124 + 125 + var lastCommit *tangled.GitTempGetTree_LastCommit 126 + if lastCommitInfo != nil { 127 + lastCommit = &tangled.GitTempGetTree_LastCommit{ 128 + Hash: lastCommitInfo.Hash.String(), 129 + Message: lastCommitInfo.Message, 130 + When: lastCommitInfo.When.Format(time.RFC3339), 131 + } 132 + if commit, err := gr.Commit(lastCommitInfo.Hash); err == nil { 133 + lastCommit.Author = &tangled.GitTempGetTree_Signature{ 134 + Name: commit.Author.Name, 135 + Email: commit.Author.Email, 136 + } 137 + } 138 + } 139 + 109 140 return &tangled.GitTempGetTree_Output{ 110 - Ref: ref, 111 - Parent: parentPtr, 112 - Dotdot: dotdotPtr, 113 - Files: treeEntries, 141 + Ref: ref, 142 + Parent: parentPtr, 143 + Dotdot: dotdotPtr, 144 + Files: treeEntries, 145 + LastCommit: lastCommit, 114 146 Readme: &tangled.GitTempGetTree_Readme{ 115 147 Filename: readmeFileName, 116 148 Contents: readmeContents,

History

1 round 0 comments
sign up or login to add to the discussion
oppi.li submitted #0
1 commit
expand
knotmirror: reinstate LastCommitInfo in tree responses
merge conflicts detected
expand
  • knotmirror/xrpc/git_get_tree.go:13
expand 0 comments