feat(api): extend commit and diff services with new functionality
- Add FindCommit, ListCommitsByOid, CommitIsAncestor RPCs to CommitService - Add CheckObjectsExist, CommitsByMessage, GetCommitStats RPCs to CommitService - Add LastCommitForPath, CountCommits, CountDivergingCommits RPCs to CommitService - Add RawDiff, RawPatch, FindChangedPaths RPCs to DiffService - Add FindMergeBase, WriteRef, SearchFilesByContent RPCs to RepositoryService - Add SearchFilesByName, ObjectsSize, RepositorySize RPCs to RepositoryService - Add FindLicense, OptimizeRepository, GetRawChanges RPCs to RepositoryService - Add FetchRemote, CreateRepositoryFromURL RPCs to RepositoryService - Implement server handlers for all new RPC methods - Add new modules for commit counting, finding, and querying features - Add new modules for diff changed paths and raw operations - Add new modules for refs and remote operations - Remove unnecessary comments from various source files - Update proto definitions with new message types and service methods
This commit is contained in:
@@ -50,7 +50,6 @@ impl GitBare {
|
||||
let options = request.options.as_ref();
|
||||
let want_patch = options.is_some_and(|o| o.include_patch);
|
||||
|
||||
// ── Call 1: --raw -z --numstat -z (all metadata + line counts) ──
|
||||
let (raw_entries, numstat_map) = self.diff_raw_and_numstat(&base, &head, options)?;
|
||||
|
||||
let max_files = options.and_then(|o| (o.max_files > 0).then_some(o.max_files as usize));
|
||||
@@ -59,14 +58,12 @@ impl GitBare {
|
||||
&raw_entries[..raw_entries.len().min(max)]
|
||||
});
|
||||
|
||||
// ── Call 2 (optional): --patch for all files at once ──
|
||||
let patch_map = if want_patch {
|
||||
self.diff_patch_batch(&base, &head, options)?
|
||||
} else {
|
||||
HashMap::new()
|
||||
};
|
||||
|
||||
// ── Merge results (zero additional subprocess calls) ──
|
||||
let mut files = Vec::with_capacity(entries_to_build.len());
|
||||
for entry in entries_to_build {
|
||||
let path = if !entry.new_path.is_empty() {
|
||||
@@ -127,7 +124,6 @@ impl GitBare {
|
||||
});
|
||||
}
|
||||
|
||||
// ── Call 3: diff --shortstat (already efficient, single call) ──
|
||||
let stats = diff_stats_for_range(self, &base, &head, options)?;
|
||||
let (files, page_info) = paginate::paginate(&files, request.pagination.as_ref());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user