From 54b89d3fa7004f6ff1cc8a471d09598675924af8 Mon Sep 17 00:00:00 2001 From: oppiliappan Date: Tue, 03 Feb 2026 12:41:00 +0000 Subject: [PATCH] lexicons: add lastCommit to sh.tangled.repo.tree quite easily calculated as the most recently modified file in the present tree. Signed-off-by: oppiliappan --- api/tangled/repoblob.go | 2 -- api/tangled/repotree.go | 16 ++++++++++++++-- lexicons/repo/blob.json | 4 ---- lexicons/repo/tree.json | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- 4 file(s) changed, 67 insertion(s)(+), 13 deletion(s)(-) diff --git a/api/tangled/repoblob.go b/api/tangled/repoblob.go --- a/api/tangled/repoblob.go +++ b/api/tangled/repoblob.go @@ -21,8 +21,6 @@ // hash: Commit hash Hash string `json:"hash" cborgen:"hash"` // message: Commit message Message string `json:"message" cborgen:"message"` - // shortHash: Short commit hash - ShortHash *string `json:"shortHash,omitempty" cborgen:"shortHash,omitempty"` // when: Commit timestamp When string `json:"when" cborgen:"when"` } diff --git a/api/tangled/repotree.go b/api/tangled/repotree.go --- a/api/tangled/repotree.go +++ b/api/tangled/repotree.go @@ -16,6 +16,7 @@ ) // RepoTree_LastCommit is a "lastCommit" in the sh.tangled.repo.tree schema. type RepoTree_LastCommit struct { + Author *RepoTree_Signature `json:"author,omitempty" cborgen:"author,omitempty"` // hash: Commit hash Hash string `json:"hash" cborgen:"hash"` // message: Commit message @@ -27,8 +28,9 @@ // RepoTree_Output is the output of a sh.tangled.repo.tree call. type RepoTree_Output struct { // dotdot: Parent directory path - Dotdot *string `json:"dotdot,omitempty" cborgen:"dotdot,omitempty"` - Files []*RepoTree_TreeEntry `json:"files" cborgen:"files"` + Dotdot *string `json:"dotdot,omitempty" cborgen:"dotdot,omitempty"` + Files []*RepoTree_TreeEntry `json:"files" cborgen:"files"` + LastCommit *RepoTree_LastCommit `json:"lastCommit,omitempty" cborgen:"lastCommit,omitempty"` // parent: The parent path in the tree Parent *string `json:"parent,omitempty" cborgen:"parent,omitempty"` // readme: Readme for this file tree @@ -43,6 +45,16 @@ // contents: Contents of the readme file Contents string `json:"contents" cborgen:"contents"` // filename: Name of the readme file Filename string `json:"filename" cborgen:"filename"` +} + +// RepoTree_Signature is a "signature" in the sh.tangled.repo.tree schema. +type RepoTree_Signature struct { + // email: Author email + Email string `json:"email" cborgen:"email"` + // name: Author name + Name string `json:"name" cborgen:"name"` + // when: Author timestamp + When string `json:"when" cborgen:"when"` } // RepoTree_TreeEntry is a "treeEntry" in the sh.tangled.repo.tree schema. diff --git a/lexicons/repo/blob.json b/lexicons/repo/blob.json --- a/lexicons/repo/blob.json +++ b/lexicons/repo/blob.json @@ -115,10 +115,6 @@ "hash": { "type": "string", "description": "Commit hash" }, - "shortHash": { - "type": "string", - "description": "Short commit hash" - }, "message": { "type": "string", "description": "Commit message" diff --git a/lexicons/repo/tree.json b/lexicons/repo/tree.json --- a/lexicons/repo/tree.json +++ b/lexicons/repo/tree.json @@ -6,7 +6,10 @@ "main": { "type": "query", "parameters": { "type": "params", - "required": ["repo", "ref"], + "required": [ + "repo", + "ref" + ], "properties": { "repo": { "type": "string", @@ -27,7 +30,10 @@ "output": { "encoding": "application/json", "schema": { "type": "object", - "required": ["ref", "files"], + "required": [ + "ref", + "files" + ], "properties": { "ref": { "type": "string", @@ -45,6 +51,10 @@ "readme": { "type": "ref", "ref": "#readme", "description": "Readme for this file tree" + }, + "lastCommit": { + "type": "ref", + "ref": "#lastCommit" }, "files": { "type": "array", @@ -77,7 +87,10 @@ ] }, "readme": { "type": "object", - "required": ["filename", "contents"], + "required": [ + "filename", + "contents" + ], "properties": { "filename": { "type": "string", @@ -91,7 +104,11 @@ } }, "treeEntry": { "type": "object", - "required": ["name", "mode", "size"], + "required": [ + "name", + "mode", + "size" + ], "properties": { "name": { "type": "string", @@ -113,7 +130,11 @@ } }, "lastCommit": { "type": "object", - "required": ["hash", "message", "when"], + "required": [ + "hash", + "message", + "when" + ], "properties": { "hash": { "type": "string", @@ -123,10 +144,37 @@ "message": { "type": "string", "description": "Commit message" }, + "author": { + "type": "ref", + "ref": "#signature" + }, "when": { "type": "string", "format": "datetime", "description": "Commit timestamp" + } + } + }, + "signature": { + "type": "object", + "required": [ + "name", + "email", + "when" + ], + "properties": { + "name": { + "type": "string", + "description": "Author name" + }, + "email": { + "type": "string", + "description": "Author email" + }, + "when": { + "type": "string", + "format": "datetime", + "description": "Author timestamp" } } } -- tangled.sh