Files
zhenyi dcb0fb74c5 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
2026-06-04 13:05:38 +08:00

140 lines
3.2 KiB
Protocol Buffer

syntax = "proto3";
package gitks;
import "commit.proto";
import "diff.proto";
import "oid.proto";
import "repository.proto";
import "tagger.proto";
message MergeOptions {
enum Strategy {
MERGE_STRATEGY_UNSPECIFIED = 0;
MERGE_STRATEGY_RECURSIVE = 1;
MERGE_STRATEGY_ORT = 2;
MERGE_STRATEGY_RESOLVE = 3;
MERGE_STRATEGY_OCTOPUS = 4;
MERGE_STRATEGY_OURS = 5;
MERGE_STRATEGY_SUBTREE = 6;
}
enum FastForwardMode {
MERGE_FAST_FORWARD_MODE_UNSPECIFIED = 0;
MERGE_FAST_FORWARD_MODE_ALLOWED = 1;
MERGE_FAST_FORWARD_MODE_ONLY = 2;
MERGE_FAST_FORWARD_MODE_NO_FF = 3;
}
Strategy strategy = 1;
FastForwardMode fast_forward = 2;
bool squash = 3;
bool no_commit = 4;
bool allow_unrelated_histories = 5;
repeated string strategy_options = 6;
}
message MergeConflictSection {
string label = 1;
bytes content = 2;
}
message MergeConflict {
string path = 1;
uint32 mode = 2;
Oid base_oid = 3;
Oid ours_oid = 4;
Oid theirs_oid = 5;
repeated MergeConflictSection sections = 6;
bool binary = 7;
}
message MergeResult {
enum Status {
MERGE_RESULT_STATUS_UNSPECIFIED = 0;
MERGE_RESULT_STATUS_MERGED = 1;
MERGE_RESULT_STATUS_FAST_FORWARD = 2;
MERGE_RESULT_STATUS_ALREADY_UP_TO_DATE = 3;
MERGE_RESULT_STATUS_CONFLICTS = 4;
MERGE_RESULT_STATUS_ABORTED = 5;
}
Status status = 1;
Commit commit = 2;
Oid merge_base = 3;
repeated MergeConflict conflicts = 4;
DiffStats stats = 5;
string message = 6;
}
message MergeRequest {
RepositoryHeader repository = 1;
string target_branch = 2;
ObjectSelector source = 3;
Signature committer = 4;
string message = 5;
MergeOptions options = 6;
}
message CheckMergeRequest {
RepositoryHeader repository = 1;
ObjectSelector target = 2;
ObjectSelector source = 3;
MergeOptions options = 4;
}
message ListMergeConflictsRequest {
RepositoryHeader repository = 1;
ObjectSelector target = 2;
ObjectSelector source = 3;
Pagination pagination = 4;
}
message ListMergeConflictsResponse {
repeated MergeConflict conflicts = 1;
PageInfo page_info = 2;
}
message ResolveMergeConflict {
string path = 1;
bytes content = 2;
}
message ResolveMergeConflictsRequest {
RepositoryHeader repository = 1;
string target_branch = 2;
ObjectSelector source = 3;
repeated ResolveMergeConflict resolutions = 4;
Signature committer = 5;
string message = 6;
}
message RebaseRequest {
RepositoryHeader repository = 1;
string branch = 2;
ObjectSelector upstream = 3;
Signature committer = 4;
}
message RebaseResult {
enum Status {
REBASE_RESULT_STATUS_UNSPECIFIED = 0;
REBASE_RESULT_STATUS_REBASED = 1;
REBASE_RESULT_STATUS_ALREADY_UP_TO_DATE = 2;
REBASE_RESULT_STATUS_CONFLICTS = 3;
REBASE_RESULT_STATUS_ABORTED = 4;
}
Status status = 1;
Commit head = 2;
repeated MergeConflict conflicts = 3;
}
service MergeService {
rpc CheckMerge(CheckMergeRequest) returns (MergeResult);
rpc Merge(MergeRequest) returns (MergeResult);
rpc ListMergeConflicts(ListMergeConflictsRequest) returns (ListMergeConflictsResponse);
rpc ResolveMergeConflicts(ResolveMergeConflictsRequest) returns (MergeResult);
rpc Rebase(RebaseRequest) returns (RebaseResult);
}