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:
zhenyi
2026-06-08 15:37:08 +08:00
parent 8f472a0443
commit 66afd932ed
43 changed files with 3070 additions and 75 deletions
-5
View File
@@ -94,7 +94,6 @@ impl DiskCache {
self.enabled
}
// ── State Directory ──────────────────────────────────────────────
fn state_dir_for(&self, relative_path: &str) -> PathBuf {
self.repo_prefix
@@ -110,7 +109,6 @@ impl DiskCache {
self.state_dir_for(relative_path).join("pending")
}
// ── Cache Directory ──────────────────────────────────────────────
fn cache_dir(&self, namespace: &str) -> PathBuf {
self.repo_prefix.join(namespace)
@@ -120,7 +118,6 @@ impl DiskCache {
self.cache_dir(namespace).join(digest_to_path(digest))
}
// ── Repository State Management ──────────────────────────────────
/// Ensure the state directory for a repository exists and has a `latest` file.
/// If `latest` does not exist, create it with a random value.
@@ -233,7 +230,6 @@ impl DiskCache {
Ok(())
}
// ── Cache Key Computation ────────────────────────────────────────
/// Compute a cache key for an info/refs request.
pub fn compute_info_refs_key(&self, relative_path: &str, protocol: &str) -> GitResult<String> {
@@ -272,7 +268,6 @@ impl DiskCache {
Ok(sha256_digest(parts))
}
// ── Cache Lookup & Insert ────────────────────────────────────────
/// Look up a cached response for the given namespace and digest.
/// Returns the cached bytes if found and not expired.