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,114 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package gitks;
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
import "commit.proto";
|
||||
import "oid.proto";
|
||||
import "repository.proto";
|
||||
|
||||
message BranchUpstream {
|
||||
string remote_name = 1;
|
||||
string remote_url = 2;
|
||||
string remote_branch_name = 3;
|
||||
string local_branch_name = 4;
|
||||
}
|
||||
|
||||
message Branch {
|
||||
string name = 1;
|
||||
string full_ref = 2;
|
||||
Oid target_oid = 3;
|
||||
Commit commit = 4;
|
||||
BranchUpstream upstream = 5;
|
||||
bool is_default = 6;
|
||||
bool is_head = 7;
|
||||
bool is_merged = 8;
|
||||
bool is_detached = 9;
|
||||
}
|
||||
|
||||
// Backward-compatible payload name used by earlier clients.
|
||||
message PayloadBranch {
|
||||
PayloadCommit commit = 1;
|
||||
string name = 2;
|
||||
BranchUpstream upstream = 3;
|
||||
bool is_head = 4;
|
||||
}
|
||||
|
||||
message RequestBranchInit {}
|
||||
|
||||
message ListBranchesRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
string pattern = 2;
|
||||
bool merged_into_head = 3;
|
||||
bool not_merged_into_head = 4;
|
||||
Pagination pagination = 5;
|
||||
SortDirection sort_direction = 6;
|
||||
}
|
||||
|
||||
message ListBranchesResponse {
|
||||
repeated Branch branches = 1;
|
||||
PageInfo page_info = 2;
|
||||
}
|
||||
|
||||
message GetBranchRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
string name = 2;
|
||||
}
|
||||
|
||||
message CreateBranchRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
string name = 2;
|
||||
ObjectSelector start_point = 3;
|
||||
bool force = 4;
|
||||
}
|
||||
|
||||
message DeleteBranchRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
string name = 2;
|
||||
bool force = 3;
|
||||
}
|
||||
|
||||
message RenameBranchRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
string old_name = 2;
|
||||
string new_name = 3;
|
||||
}
|
||||
|
||||
message UpdateBranchTargetRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
string name = 2;
|
||||
Oid expected_old_oid = 3;
|
||||
Oid new_oid = 4;
|
||||
bool force = 5;
|
||||
}
|
||||
|
||||
message SetBranchUpstreamRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
string name = 2;
|
||||
BranchUpstream upstream = 3;
|
||||
}
|
||||
|
||||
message CompareBranchRequest {
|
||||
RepositoryHeader repository = 1;
|
||||
string source_branch = 2;
|
||||
string target_branch = 3;
|
||||
}
|
||||
|
||||
message CompareBranchResponse {
|
||||
bool ahead = 1;
|
||||
bool behind = 2;
|
||||
uint32 ahead_by = 3;
|
||||
uint32 behind_by = 4;
|
||||
Oid merge_base = 5;
|
||||
}
|
||||
|
||||
service BranchService {
|
||||
rpc ListBranches(ListBranchesRequest) returns (ListBranchesResponse);
|
||||
rpc GetBranch(GetBranchRequest) returns (Branch);
|
||||
rpc CreateBranch(CreateBranchRequest) returns (Branch);
|
||||
rpc DeleteBranch(DeleteBranchRequest) returns (google.protobuf.Empty);
|
||||
rpc RenameBranch(RenameBranchRequest) returns (Branch);
|
||||
rpc UpdateBranchTarget(UpdateBranchTargetRequest) returns (Branch);
|
||||
rpc SetBranchUpstream(SetBranchUpstreamRequest) returns (Branch);
|
||||
rpc CompareBranch(CompareBranchRequest) returns (CompareBranchResponse);
|
||||
}
|
||||
Reference in New Issue
Block a user