Files
gitks/proto/diff.proto
T
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

141 lines
3.0 KiB
Protocol Buffer

syntax = "proto3";
package gitks;
import "oid.proto";
import "repository.proto";
message DiffOptions {
enum WhitespaceMode {
DIFF_WHITESPACE_MODE_UNSPECIFIED = 0;
DIFF_WHITESPACE_MODE_DEFAULT = 1;
DIFF_WHITESPACE_MODE_IGNORE_ALL = 2;
DIFF_WHITESPACE_MODE_IGNORE_CHANGE = 3;
DIFF_WHITESPACE_MODE_IGNORE_EOL = 4;
}
bool recursive = 1;
bool include_binary = 2;
bool include_patch = 3;
bool rename_detection = 4;
bool copy_detection = 5;
uint32 context_lines = 6;
repeated string pathspec = 7;
WhitespaceMode whitespace_mode = 8;
uint64 max_files = 9;
uint64 max_bytes = 10;
}
message DiffLine {
enum LineType {
DIFF_LINE_TYPE_UNSPECIFIED = 0;
DIFF_LINE_TYPE_CONTEXT = 1;
DIFF_LINE_TYPE_ADDED = 2;
DIFF_LINE_TYPE_DELETED = 3;
DIFF_LINE_TYPE_HUNK_HEADER = 4;
DIFF_LINE_TYPE_NO_NEWLINE = 5;
}
LineType type = 1;
int32 old_line = 2;
int32 new_line = 3;
bytes content = 4;
bool truncated = 5;
}
message DiffHunk {
string header = 1;
uint32 old_start = 2;
uint32 old_lines = 3;
uint32 new_start = 4;
uint32 new_lines = 5;
repeated DiffLine lines = 6;
}
message DiffFile {
enum ChangeType {
DIFF_FILE_CHANGE_TYPE_UNSPECIFIED = 0;
DIFF_FILE_CHANGE_TYPE_ADDED = 1;
DIFF_FILE_CHANGE_TYPE_MODIFIED = 2;
DIFF_FILE_CHANGE_TYPE_DELETED = 3;
DIFF_FILE_CHANGE_TYPE_RENAMED = 4;
DIFF_FILE_CHANGE_TYPE_COPIED = 5;
DIFF_FILE_CHANGE_TYPE_TYPE_CHANGED = 6;
DIFF_FILE_CHANGE_TYPE_UNMERGED = 7;
}
string old_path = 1;
string new_path = 2;
Oid old_oid = 3;
Oid new_oid = 4;
uint32 old_mode = 5;
uint32 new_mode = 6;
ChangeType change_type = 7;
bool binary = 8;
bool too_large = 9;
uint32 additions = 10;
uint32 deletions = 11;
repeated DiffHunk hunks = 12;
bytes patch = 13;
double similarity = 14;
}
message DiffStats {
uint32 additions = 1;
uint32 deletions = 2;
uint32 changed_files = 3;
}
message Diff {
repeated DiffFile files = 1;
DiffStats stats = 2;
bool overflow = 3;
}
message GetDiffRequest {
RepositoryHeader repository = 1;
ObjectSelector base = 2;
ObjectSelector head = 3;
DiffOptions options = 4;
Pagination pagination = 5;
}
message GetDiffResponse {
repeated DiffFile files = 1;
DiffStats stats = 2;
PageInfo page_info = 3;
bool overflow = 4;
}
message GetCommitDiffRequest {
RepositoryHeader repository = 1;
ObjectSelector commit = 2;
DiffOptions options = 3;
Pagination pagination = 4;
}
message GetPatchRequest {
RepositoryHeader repository = 1;
ObjectSelector base = 2;
ObjectSelector head = 3;
DiffOptions options = 4;
}
message GetPatchResponse {
bytes data = 1;
}
message GetDiffStatsRequest {
RepositoryHeader repository = 1;
ObjectSelector base = 2;
ObjectSelector head = 3;
DiffOptions options = 4;
}
service DiffService {
rpc GetDiff(GetDiffRequest) returns (GetDiffResponse);
rpc GetCommitDiff(GetCommitDiffRequest) returns (GetDiffResponse);
rpc GetPatch(GetPatchRequest) returns (stream GetPatchResponse);
rpc GetDiffStats(GetDiffStatsRequest) returns (DiffStats);
}