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:
+7
-1
@@ -4,10 +4,12 @@ use crate::paginate;
|
||||
use crate::pb::{
|
||||
FileMetadata, FindFilesRequest, FindFilesResponse, ListTreeRequest, ObjectType, tree_entry,
|
||||
};
|
||||
use crate::tree;
|
||||
|
||||
impl GitBare {
|
||||
pub fn find_files(&self, request: FindFilesRequest) -> GitResult<FindFilesResponse> {
|
||||
let revision = request.revision.clone();
|
||||
let rev = tree::resolve_revision(&revision);
|
||||
let root = if request.pathspec.is_empty() {
|
||||
vec![String::new()]
|
||||
} else {
|
||||
@@ -35,13 +37,17 @@ impl GitBare {
|
||||
tree_entry::EntryType::TreeEntryTypeUnspecified => ObjectType::Unspecified,
|
||||
_ => ObjectType::Blob,
|
||||
} as i32;
|
||||
let entry_path = entry.path.clone();
|
||||
let rc = tree::recent_commit(self, &rev, &entry_path);
|
||||
files.push(FileMetadata {
|
||||
path: entry.path,
|
||||
path: entry_path,
|
||||
oid: entry.oid,
|
||||
mode: entry.mode,
|
||||
size: entry.size,
|
||||
r#type: object_type,
|
||||
binary: false,
|
||||
is_lfs: false,
|
||||
recent_commit: rc,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user