feat(tree): add recent commit metadata and LFS support to file metadata

- Added RecentCommit message definition with oid, subject and timestamp fields
- Extended TreeEntry, Tree, and FileMetadata messages with is_lfs and recent_commit fields
- Updated get_file_metadata function to include recent commit information
- Added tree module import and recent_commit lookup functionality
- Updated protobuf definitions to include new metadata fields
- Enhanced file metadata response with LFS status and commit history
This commit is contained in:
zhenyi
2026-06-04 13:47:46 +08:00
parent dcb0fb74c5
commit 737e934043
8 changed files with 83 additions and 9 deletions
+5 -1
View File
@@ -4,6 +4,7 @@ use crate::bare::GitBare;
use crate::error::{GitError, GitResult};
use crate::paginate;
use crate::pb::{ListTreeRequest, ListTreeResponse, TreeEntry, object_selector, tree_entry};
use crate::tree;
impl GitBare {
pub fn list_tree(&self, request: ListTreeRequest) -> GitResult<ListTreeResponse> {
@@ -40,13 +41,16 @@ impl GitBare {
};
let kind = entry.kind();
let hex = entry.id().to_string();
let entry_path = path.clone();
entries.push(TreeEntry {
name,
path: path.clone(),
path: entry_path.clone(),
oid: Some(self.oid_to_pb(hex)),
r#type: entry_type(kind) as i32,
mode: u32::from_str_radix(&format!("{:o}", entry.mode()), 8).unwrap_or(0),
size: entry_size(&repo, entry.id().to_string().as_str()).unwrap_or(0),
is_lfs: false,
recent_commit: tree::recent_commit(self, &revision, &entry_path),
});
if request.recursive && matches!(kind, EntryKind::Tree) {