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:
@@ -0,0 +1,157 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package gitks;
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
import "oid.proto";
|
||||
|
||||
// Repository identity used by storage-facing RPCs.
|
||||
message RepositoryHeader {
|
||||
// Logical storage shard or disk name.
|
||||
string storage_name = 1;
|
||||
// Path relative to the storage root, usually ending in `.git` for bare repos.
|
||||
string relative_path = 2;
|
||||
// Optional absolute path for embedded/local deployments.
|
||||
string storage_path = 3;
|
||||
}
|
||||
|
||||
message Repository {
|
||||
RepositoryHeader header = 1;
|
||||
bool bare = 2;
|
||||
bool empty = 3;
|
||||
ObjectFormat object_format = 4;
|
||||
string default_branch = 5;
|
||||
string git_object_directory = 6;
|
||||
repeated string git_alternate_object_directories = 7;
|
||||
}
|
||||
|
||||
message RepositoryStatistics {
|
||||
uint64 size_bytes = 1;
|
||||
uint64 loose_object_count = 2;
|
||||
uint64 packed_object_count = 3;
|
||||
uint64 packfile_count = 4;
|
||||
uint64 reference_count = 5;
|
||||
uint64 commit_graph_size_bytes = 6;
|
||||
uint64 multi_pack_index_size_bytes = 7;
|
||||
}
|
||||
|
||||
message RepositoryConfigEntry {
|
||||
string key = 1;
|
||||
repeated string values = 2;
|
||||
}
|
||||
|
||||
message RepositoryObjectFormatRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
}
|
||||
|
||||
message RepositoryObjectFormatResponse {
|
||||
ObjectFormat object_format = 1;
|
||||
}
|
||||
|
||||
message GetRepositoryRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
}
|
||||
|
||||
message InitRepositoryRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
bool bare = 2;
|
||||
ObjectFormat object_format = 3;
|
||||
string initial_branch = 4;
|
||||
}
|
||||
|
||||
message DeleteRepositoryRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
}
|
||||
|
||||
message RepositoryExistsRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
}
|
||||
|
||||
message RepositoryExistsResponse {
|
||||
bool exists = 1;
|
||||
}
|
||||
|
||||
message GetDefaultBranchRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
}
|
||||
|
||||
message GetDefaultBranchResponse {
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message SetDefaultBranchRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
string name = 2;
|
||||
}
|
||||
|
||||
message GetRepositoryConfigRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
repeated string keys = 2;
|
||||
}
|
||||
|
||||
message GetRepositoryConfigResponse {
|
||||
repeated RepositoryConfigEntry entries = 1;
|
||||
}
|
||||
|
||||
message SetRepositoryConfigRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
repeated RepositoryConfigEntry entries = 2;
|
||||
}
|
||||
|
||||
message RepositoryStatisticsRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
}
|
||||
|
||||
message RepositoryHealthRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
bool connectivity_only = 2;
|
||||
}
|
||||
|
||||
message RepositoryHealthResponse {
|
||||
bool ok = 1;
|
||||
repeated string warnings = 2;
|
||||
repeated string errors = 3;
|
||||
RepositoryStatistics statistics = 4;
|
||||
}
|
||||
|
||||
message GarbageCollectRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
bool prune = 2;
|
||||
bool aggressive = 3;
|
||||
}
|
||||
|
||||
message RepackRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
bool full = 2;
|
||||
bool write_bitmaps = 3;
|
||||
bool write_multi_pack_index = 4;
|
||||
}
|
||||
|
||||
message WriteCommitGraphRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
bool replace = 2;
|
||||
bool split = 3;
|
||||
}
|
||||
|
||||
message RepositoryMaintenanceResponse {
|
||||
bool ok = 1;
|
||||
string stdout = 2;
|
||||
string stderr = 3;
|
||||
}
|
||||
|
||||
service RepositoryService {
|
||||
rpc GetRepository(GetRepositoryRequest) returns (Repository);
|
||||
rpc InitRepository(InitRepositoryRequest) returns (Repository);
|
||||
rpc DeleteRepository(DeleteRepositoryRequest) returns (google.protobuf.Empty);
|
||||
rpc RepositoryExists(RepositoryExistsRequest) returns (RepositoryExistsResponse);
|
||||
rpc GetObjectFormat(RepositoryObjectFormatRequest) returns (RepositoryObjectFormatResponse);
|
||||
rpc GetDefaultBranch(GetDefaultBranchRequest) returns (GetDefaultBranchResponse);
|
||||
rpc SetDefaultBranch(SetDefaultBranchRequest) returns (google.protobuf.Empty);
|
||||
rpc GetRepositoryConfig(GetRepositoryConfigRequest) returns (GetRepositoryConfigResponse);
|
||||
rpc SetRepositoryConfig(SetRepositoryConfigRequest) returns (google.protobuf.Empty);
|
||||
rpc GetRepositoryStatistics(RepositoryStatisticsRequest) returns (RepositoryStatistics);
|
||||
rpc CheckRepositoryHealth(RepositoryHealthRequest) returns (RepositoryHealthResponse);
|
||||
rpc GarbageCollect(GarbageCollectRequest) returns (RepositoryMaintenanceResponse);
|
||||
rpc Repack(RepackRequest) returns (RepositoryMaintenanceResponse);
|
||||
rpc WriteCommitGraph(WriteCommitGraphRequest) returns (RepositoryMaintenanceResponse);
|
||||
}
|
||||
Reference in New Issue
Block a user