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
+4
View File
@@ -3,6 +3,7 @@ use gix::object::tree::EntryKind;
use crate::bare::GitBare;
use crate::error::{GitError, GitResult};
use crate::pb::{FileMetadata, GetFileMetadataRequest, ObjectType, object_selector};
use crate::tree;
impl GitBare {
pub fn get_file_metadata(&self, request: GetFileMetadataRequest) -> GitResult<FileMetadata> {
@@ -26,6 +27,7 @@ impl GitBare {
EntryKind::Commit => ObjectType::Commit,
_ => ObjectType::Blob,
} as i32;
let rc = tree::recent_commit(self, &revision, &request.path);
Ok(FileMetadata {
path: request.path,
oid: Some(self.oid_to_pb(hex)),
@@ -33,6 +35,8 @@ impl GitBare {
size: 0,
r#type: kind,
binary: false,
is_lfs: false,
recent_commit: rc,
})
}
}