Welcome to mirror list, hosted at ThFree Co, Russian Federation.

diff.proto « proto - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f2a961bf6fb44f66febb82df6333e11e28488ec6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
syntax = "proto3";

package gitaly;

import "lint.proto";
import "shared.proto";

option go_package = "gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb";

// DiffService is a service which provides RPCs to inspect differences
// introduced between a set of commits.
service DiffService {

  // CommitDiff returns stream of CommitDiffResponse with patches chunked over messages.
  rpc CommitDiff(CommitDiffRequest) returns (stream CommitDiffResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // CommitDelta returns a stream so we can divide the response in chunks of deltas.
  rpc CommitDelta(CommitDeltaRequest) returns (stream CommitDeltaResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // RawDiff ...
  rpc RawDiff(RawDiffRequest) returns (stream RawDiffResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // RawPatch ...
  rpc RawPatch(RawPatchRequest) returns (stream RawPatchResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // DiffStats ...
  rpc DiffStats(DiffStatsRequest) returns (stream DiffStatsResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // FindChangedPaths returns a list of files changed along with the status of each file
  rpc FindChangedPaths(FindChangedPathsRequest) returns (stream FindChangedPathsResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // GetPatchID computes a patch ID for a patch. Patch IDs are a unique ID computed by hashing
  // a patch with some parameters like line numbers ignored. The patch ID can thus be used to compare
  // whether diffs make the same change. Please refer to git-patch-id(1) for further information.
  // If the difference between old and new change is empty then this RPC returns an error.
  rpc GetPatchID(GetPatchIDRequest) returns (GetPatchIDResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }
}

// CommitDiffRequest ...
message CommitDiffRequest {
  // DiffMode ...
  enum DiffMode {
    // DEFAULT is the standard diff mode and results in a linewise diff for textfiles.
    DEFAULT = 0; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH
    // WORDDIFF is a word diff and computes the diff for whitespace separated words instead of for whole lines.
    WORDDIFF = 1; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
  }

  // WhitespaceChanges states which whitespace changes we should ignore. These options correlate to
  // the ones present in git-diff(1).
  enum WhitespaceChanges {
    // WHITESPACE_CHANGES_UNSPECIFIED is used to not ignore any whitespace changes.
    WHITESPACE_CHANGES_UNSPECIFIED = 0;
    // WHITESPACE_CHANGES_IGNORE specifies to use the `--ignore-space-change` flag of git-diff(1).
    // Only changes in amount of whitespace are ignored.
    WHITESPACE_CHANGES_IGNORE = 1;
    // WHITESPACE_CHANGES_IGNORE_ALL specifies to use the `--ignore-all-space` flag of git-diff(1).
    // all whitespace characters are ignored when comparing lines.
    WHITESPACE_CHANGES_IGNORE_ALL = 2;
  }

  // repository ...
  Repository repository = 1 [(target_repository)=true];
  // left_commit_id ...
  string left_commit_id = 2;
  // right_commit_id ...
  string right_commit_id = 3;
  // This field is deprecated, use the `whitespace_changes` field instead.
  reserved "ignore_whitespace_change";
  reserved 4;
  // paths ...
  repeated bytes paths = 5;
  // collapse_diffs ...
  bool collapse_diffs = 6;
  // enforce_limits ...
  bool enforce_limits = 7;

  // max_files ...
  // The following set of limits are only enforced when enforce_limits == true.
  int32 max_files = 8;
  // max_lines ...
  int32 max_lines = 9;
  // max_bytes ...
  int32 max_bytes = 10;
  // max_patch_bytes is the limitation of a single diff patch,
  // patches surpassing this limit are pruned by default.
  // If this is 0 you will get back empty patches.
  int32 max_patch_bytes = 14;

  // safe_max_files...
  // These limits are only enforced if collapse_diffs == true.
  int32 safe_max_files = 11;
  // safe_max_lines ...
  int32 safe_max_lines = 12;
  // safe_max_bytes ...
  int32 safe_max_bytes = 13;

  // diff_mode is the mode used for generating the diff. Please refer to the enum declaration for supported modes.
  DiffMode diff_mode = 15;

  // max_patch_bytes_for_file_extension is a map of file extension to max patch bytes for
  // that extension. It overrides max patch bytes for file extension. If the file does not
  // have an extension (eg Dockerfile), then the file name is used for matching.
  // For files with more than on extension (eg file.html.tmpl) only the last extension is matched.
  map<string, int32> max_patch_bytes_for_file_extension = 16;

  // whitespace_changes states which whitespace changes should be included in the diff.
  // Please refer to the enum declaration for supported modes.
  WhitespaceChanges whitespace_changes = 17;

  // collect_all_paths can be set when you want to get back all files,
  // even when the enforced limits are hit. Responses sent when the limits
  // were hit will have the path filled in, have the `overflow_marker` set,
  // but have no patch data.
  bool collect_all_paths = 18;
}

// CommitDiffResponse corresponds to a single changed file in a commit.
message CommitDiffResponse {
  reserved 8;

  // from_path ...
  bytes from_path = 1;
  // to_path ...
  bytes to_path = 2;
  // from_id is the blob ID as returned via `git diff --full-index`.
  string from_id = 3;
  // to_id ...
  string to_id = 4;
  // old_mode ...
  int32 old_mode = 5;
  // new_mode ...
  int32 new_mode = 6;
  // binary ...
  bool binary = 7;
  // raw_patch_data ...
  bytes raw_patch_data = 9;
  // end_of_patch ...
  bool end_of_patch = 10;
  // overflow_marker Indicates if the diff file exceeded limitations, in which case
  // there will be no patch data sent, only information about the patch.
  bool overflow_marker = 11;
  // collapsed indicates the patch surpassed a "safe" limit and was therefore pruned, but
  // the client may still request the full patch on a separate request.
  bool collapsed = 12;
  // too_large indicates the patch was pruned since it surpassed a hard limit, and can
  // therefore not be expanded.
  bool too_large = 13;
}

// CommitDeltaRequest ...
message CommitDeltaRequest {
  // repository ...
  Repository repository = 1 [(target_repository)=true];
  // left_commit_id ...
  string left_commit_id = 2;
  // right_commit_id ...
  string right_commit_id = 3;
  // paths ...
  repeated bytes paths = 4;
}

// CommitDelta ...
message CommitDelta {
  // from_path ...
  bytes from_path = 1;
  // to_path ...
  bytes to_path = 2;
  // from_id is the blob ID as returned via `git diff --full-index`.
  string from_id = 3;
  // to_id ...
  string to_id = 4;
  // old_mode ...
  int32 old_mode = 5;
  // new_mode ...
  int32 new_mode = 6;
}

// CommitDeltaResponse ...
message CommitDeltaResponse {
  // deltas ...
  repeated CommitDelta deltas = 1;
}

// RawDiffRequest ...
message RawDiffRequest {
  // repository ...
  Repository repository = 1 [(target_repository)=true];
  // left_commit_id ...
  string left_commit_id = 2;
  // right_commit_id ...
  string right_commit_id = 3;
}

// RawDiffResponse ...
message RawDiffResponse {
  // data ...
  bytes data = 1;
}

// RawPatchRequest ...
message RawPatchRequest {
  // repository ...
  Repository repository = 1 [(target_repository)=true];
  // left_commit_id ...
  string left_commit_id = 2;
  // right_commit_id ...
  string right_commit_id = 3;
}

// RawPatchResponse ...
message RawPatchResponse {
  // data ...
  bytes data = 1;
}

// DiffStatsRequest ...
message DiffStatsRequest {
  // repository ...
  Repository repository = 1 [(target_repository)=true];
  // left_commit_id ...
  string left_commit_id = 2;
  // right_commit_id ...
  string right_commit_id = 3;
}

// DiffStats ...
message DiffStats {
  // path ...
  bytes path = 1;
  // additions ...
  int32 additions = 2;
  // deletions ...
  int32 deletions = 3;
  // old_path ...
  bytes old_path = 4;
}

// DiffStatsResponse ...
message DiffStatsResponse {
  // stats ...
  repeated DiffStats stats = 1;
}

// FindChangedPathsRequest is the request for the FindChangedPaths RPC.
// Given a list of commits, return the files changed. Each commit is compared
// to its parent. Merge commits will show files which are different to all of
// its parents.
message FindChangedPathsRequest {
  // MergeCommitDiffMode controls which mode to use to produce diff output for merge commits
  enum MergeCommitDiffMode {
    // MERGE_COMMIT_DIFF_MODE_UNSPECIFIED is the default value.
    // It is equivalent to DIFF_MODE_INCLUDE_MERGES.
    MERGE_COMMIT_DIFF_MODE_UNSPECIFIED = 0;
    // MERGE_COMMIT_DIFF_MODE_INCLUDE_MERGES tells git to also show differences for merge commits.
    // Please refer to the documentation of the `-m` flag of git-diff-tree(1).
    MERGE_COMMIT_DIFF_MODE_INCLUDE_MERGES = 1;
    // MERGE_COMMIT_DIFF_MODE_ALL_PARENTS tells git to only show differences for
    // files which were modified from all parents.
    // Please refer to the documentation of the `-c` flag of git-diff-tree(1).
    MERGE_COMMIT_DIFF_MODE_ALL_PARENTS = 2;
  }

  // Request is a single request to pass to git diff-tree.
  message Request {
    // TreeRequest compares two trees.
    message TreeRequest {
      // left_tree_revision is the revision of the left tree to compare. Accepts any revision that
      // peels to a tree object.
      string left_tree_revision = 1;
      // right_tree_revision is the revision of the right tree to compare. Accepts any revision that
      // peels to a tree object.
      string right_tree_revision = 2;
    }

    // CommitRequest compares a commit to its parents (or some other commits.)
    message CommitRequest {
      // commit_revision is the revision of the commit that should be compared. If no `parent_commit_revisions`
      // are given, then the commit will be compared against its parents. The revision needs to peel to a
      // commit object.
      string commit_revision = 1;
      // parent_commit_revisions are the revisions of commits to treat as the commit's parents. This is an
      // optional field: if not specified, the actual parents of the commit referred to by `commit_revision`
      // are used.
      repeated string parent_commit_revisions = 2;
    }

    oneof type {
      // tree_request is a request comparing two trees with each other.
      TreeRequest tree_request = 1;
      // commit_request is a request comparing one or more commits with each other.
      CommitRequest commit_request = 2;
    }
  }

  // repository ...
  Repository repository = 1 [(target_repository)=true];
  // commits is the list of commits to compare to their parents. This field is deprecated. To adapt to the new calling
  // convention you can create one `CommitRequest` per commit, where each `CommitRequest` has only the `commit_revision`
  // field.
  repeated string commits = 2 [deprecated=true];
  // requests specifies the requests of what to compare.
  repeated Request requests = 3;

  // merge_commit_diff_mode controls how merge commits are treated.
  MergeCommitDiffMode merge_commit_diff_mode = 4;
}

// FindChangedPathsResponse is the response for the FindChangedPaths RPC.
// Returns a list of files that have been changed in the commits given.
message FindChangedPathsResponse {
  // paths contains the attributes for one changed file. In case of merge
  // commits, or when comparing three or more commits, a file might be included
  // more than once if it was changed between multiple commits.
  repeated ChangedPaths paths = 1;
}

// ChangedPaths includes the path of the file, and the status of the change.
message ChangedPaths {
  // Status ...
  enum Status {
    // ADDED ...
    ADDED = 0; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH
    // MODIFIED ...
    MODIFIED = 1; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
    // DELETED ...
    DELETED = 2; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
    // TYPE_CHANGE ...
    TYPE_CHANGE = 3; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
    // COPIED ...
    COPIED = 4; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
  }

  // path ...
  bytes path = 1;
  // status ...
  Status status = 2;
  // old_mode is the mode of the changed path previous to the change. May be one of the following values:
  //
  //   - 0o000000 if the path does not exist.
  //   - 0o100644 if the path refers to a normal file.
  //   - 0o100755 if the path refers to an executable file.
  //   - 0o040000 if the path refers to a tree entry.
  //   - 0o160000 if the path refers to a submodule.
  int32 old_mode = 3;
  // new_mode is the mode of the changed path after the change. Please refer to `old_mode` for a list of potential values.
  int32 new_mode = 4;
}

// GetPatchIDRequest is a request for the GetPatchID RPC.
message GetPatchIDRequest {
  // repository is the repository the patch ID shall be computed in.
  Repository repository = 1 [(target_repository)=true];
  // old_revision is the old revision that shall be used to compute the patch
  // from that will then be passed to git-patch-id(1). Accepts revisions as
  // specified in gitrevisions(5).
  bytes old_revision = 2;
  // new_revision is the new revision that shall be used to compute the patch
  // from that will then be passed to git-patch-id(1). Accepts revisions as
  // specified in gitrevisions(5).
  bytes new_revision = 3;
}

// GetPatchIDResponse is a response for the GetPatchID RPC.
message GetPatchIDResponse {
  // patch_id is the patch ID that was generated by hashing the diff of the
  // given old and new revision.
  string patch_id = 1;
}