feat(core): implement Git repository operations with gRPC services

- Add advertise_refs functionality for Git protocol communication
- Implement archive service with TAR/ZIP format support and streaming
- Create blame service for Git file annotation with line tracking
- Add branch management including create, delete, rename and compare operations
- Implement merge checking with conflict detection and fast-forward handling
- Add cherry-pick functionality for applying commits between branches
- Integrate gix library for Git repository operations and object handling
- Add comprehensive test suite covering all Git operations
- Implement proper error handling and repository validation
- Add pagination support for large result sets
- Create protobuf definitions for all Git operations and data structures
- Add build system for gRPC code generation and dependency management
This commit is contained in:
zhenyi
2026-06-04 13:05:38 +08:00
commit dcb0fb74c5
98 changed files with 20569 additions and 0 deletions
+118
View File
@@ -0,0 +1,118 @@
syntax = "proto3";
package gitks;
import "oid.proto";
import "repository.proto";
message TreeEntry {
enum EntryType {
TREE_ENTRY_TYPE_UNSPECIFIED = 0;
TREE_ENTRY_TYPE_TREE = 1;
TREE_ENTRY_TYPE_BLOB = 2;
TREE_ENTRY_TYPE_COMMIT = 3;
TREE_ENTRY_TYPE_SYMLINK = 4;
TREE_ENTRY_TYPE_EXECUTABLE = 5;
}
string name = 1;
string path = 2;
Oid oid = 3;
EntryType type = 4;
uint32 mode = 5;
int64 size = 6;
}
message Tree {
Oid oid = 1;
string path = 2;
repeated TreeEntry entries = 3;
bool truncated = 4;
}
message Blob {
Oid oid = 1;
string path = 2;
uint32 mode = 3;
int64 size = 4;
bytes data = 5;
string encoding = 6;
bool binary = 7;
bool truncated = 8;
}
message FileMetadata {
string path = 1;
Oid oid = 2;
uint32 mode = 3;
int64 size = 4;
ObjectType type = 5;
bool binary = 6;
}
message ListTreeRequest {
RepositoryHeader repository = 1;
ObjectSelector revision = 2;
string path = 3;
bool recursive = 4;
Pagination pagination = 5;
}
message ListTreeResponse {
repeated TreeEntry entries = 1;
PageInfo page_info = 2;
bool truncated = 3;
}
message GetTreeRequest {
RepositoryHeader repository = 1;
ObjectSelector revision = 2;
string path = 3;
}
message GetBlobRequest {
RepositoryHeader repository = 1;
ObjectSelector revision = 2;
string path = 3;
Oid oid = 4;
uint64 max_bytes = 5;
}
message GetRawBlobRequest {
RepositoryHeader repository = 1;
ObjectSelector revision = 2;
string path = 3;
Oid oid = 4;
}
message GetRawBlobResponse {
bytes data = 1;
}
message GetFileMetadataRequest {
RepositoryHeader repository = 1;
ObjectSelector revision = 2;
string path = 3;
}
message FindFilesRequest {
RepositoryHeader repository = 1;
ObjectSelector revision = 2;
string pattern = 3;
repeated string pathspec = 4;
Pagination pagination = 5;
}
message FindFilesResponse {
repeated FileMetadata files = 1;
PageInfo page_info = 2;
}
service TreeService {
rpc ListTree(ListTreeRequest) returns (ListTreeResponse);
rpc GetTree(GetTreeRequest) returns (Tree);
rpc GetBlob(GetBlobRequest) returns (Blob);
rpc GetRawBlob(GetRawBlobRequest) returns (stream GetRawBlobResponse);
rpc GetFileMetadata(GetFileMetadataRequest) returns (FileMetadata);
rpc FindFiles(FindFilesRequest) returns (FindFilesResponse);
}