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

commit.proto « proto - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a19376bbbc3c6ec18413000b57b4c663a51542c7 (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
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
syntax = "proto3";

package gitaly;

import "errors.proto";
import "google/protobuf/timestamp.proto";
import "lint.proto";
import "shared.proto";

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

// CommitService is a service which provides RPCs that interact with Git
// commits.
service CommitService {

  // ListCommits lists all commits reachable via a set of references by doing a
  // graph walk. This deprecates FindAllCommits and FindCommits (except Follow
  // is not yet supported). Any unknown revisions will cause the RPC to fail.
  rpc ListCommits(ListCommitsRequest) returns (stream ListCommitsResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // ListAllCommits lists all commits present in the repository, including
  // those not reachable by any reference.
  rpc ListAllCommits(ListAllCommitsRequest) returns (stream ListAllCommitsResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // CommitIsAncestor checks whether a provided commit is the ancestor of
  // another commit.
  rpc CommitIsAncestor(CommitIsAncestorRequest) returns (CommitIsAncestorResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // TreeEntry provides the tree entry for the provided path and revision. The data
  // is broken into chunks and streamed.
  rpc TreeEntry(TreeEntryRequest) returns (stream TreeEntryResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // CountCommits provides the number of commits which adhere to the given filters.
  rpc CountCommits(CountCommitsRequest) returns (CountCommitsResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // CountDivergingCommits provides the number of diverging commits between two revisions.
  rpc CountDivergingCommits(CountDivergingCommitsRequest) returns (CountDivergingCommitsResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // GetTreeEntries provides the tree entries for the provided path and revision. This includes
  // subtrees present under the tree with the option of recursive fetching.
  rpc GetTreeEntries(GetTreeEntriesRequest) returns (stream GetTreeEntriesResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // ListFiles lists all the files (including files in sub-dirs) present in the working tree
  // of a given treeish.
  rpc ListFiles(ListFilesRequest) returns (stream ListFilesResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // FindCommit finds a commit for a given commitish. Returns nil if the commit is not found.
  rpc FindCommit(FindCommitRequest) returns (FindCommitResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // CommitStats provides the stats for a given commitish.
  rpc CommitStats(CommitStatsRequest) returns (CommitStatsResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // FindAllCommits lists all the commits which can be traversed from the
  // provided commitish.
  rpc FindAllCommits(FindAllCommitsRequest) returns (stream FindAllCommitsResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // FindCommits lists all the commits which are associated with the provided revision
  // and paths.
  rpc FindCommits(FindCommitsRequest) returns (stream FindCommitsResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // CommitLanguages detects the source code languages of the whole tree for a
  // given commit. Returns an error in case no languages could be detected.
  rpc CommitLanguages(CommitLanguagesRequest) returns (CommitLanguagesResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // RawBlame blames lines in a blob to when they have last been changed. Returns the raw output of the git-blame(1)
  // command.
  rpc RawBlame(RawBlameRequest) returns (stream RawBlameResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // LastCommitForPath returns the last commit that has changed a given path.
  //
  // The following special cases apply and have grown historically:
  //
  // - Absolute paths that or relative paths that escape the repository root will cause an error.
  // - A nonexistent path inside the repository leads to a successful but empty response.
  rpc LastCommitForPath(LastCommitForPathRequest) returns (LastCommitForPathResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // ListLastCommitsForTree lists the last commits for a given tree.
  rpc ListLastCommitsForTree(ListLastCommitsForTreeRequest) returns (stream ListLastCommitsForTreeResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // CommitsByMessage list commits which match the provided query.
  rpc CommitsByMessage(CommitsByMessageRequest) returns (stream CommitsByMessageResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // ListCommitsByOid lists the commits for the provided commitish object IDs.
  rpc ListCommitsByOid(ListCommitsByOidRequest) returns (stream ListCommitsByOidResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // ListCommitsByRefName lists the commits for the provided references.
  rpc ListCommitsByRefName(ListCommitsByRefNameRequest) returns (stream ListCommitsByRefNameResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // FilterShasWithSignatures filters out signed commits.
  rpc FilterShasWithSignatures(stream FilterShasWithSignaturesRequest) returns (stream FilterShasWithSignaturesResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // GetCommitSignatures parses the commit signature information for the provided commitish object IDs.
  rpc GetCommitSignatures(GetCommitSignaturesRequest) returns (stream GetCommitSignaturesResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // GetCommitMessages returns the commits messages for the provided commitish object IDs.
  rpc GetCommitMessages(GetCommitMessagesRequest) returns (stream GetCommitMessagesResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // CheckObjectsExist will check for the existence of revisions against a
  // repository. It returns two sets of data. An array containing the revisions
  // from the input that it found on the repository, and an array that contains all
  // revisions from the input it did not find on the repository.
  rpc CheckObjectsExist(stream CheckObjectsExistRequest) returns (stream CheckObjectsExistResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

}

// ListCommitsRequest is a request for the ListCommits RPC.
message ListCommitsRequest {
  // Order is the order in which commits should be traversed.
  enum Order {
    // NONE defaults to reverse chronological order.
    NONE = 0; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH
    // TOPO order will cause no parents to be shown before all of its children
    // are shown. Furthermore, multiple lines of history will not be
    // intermixed.
    TOPO = 1; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
    // DATE order will cause no parents to be shown before all of its children
    // are shown. Otherwise, commits are shown in commit timestamp order. This
    // can cause history to be shown intermixed.
    DATE = 2; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
  };

  // repository is the repository in which commits should be searched for.
  Repository repository = 1 [(target_repository)=true];

  // revisions is the set of revisions which should be walked to enumerate
  // commits. Accepts all notation as documented in gitrevisions(7) as well as
  // the pseudo-revisions `--not` and `--all` as documented in git-rev-list(1).
  // Must not be empty.
  repeated string revisions = 2;

  // pagination_params controls paging. Refer to PaginationParameter documentation for
  // further info.
  PaginationParameter pagination_params = 3;

  // order is the order in which commits should be traversed. Please refer to
  // the enum's documentation for further information.
  Order order = 4;

  // reverse will cause all commits to be listed in reverse.
  bool reverse = 11;

  // max_parents will skip all commits which have more than the specified number
  // of parents. If set to `0`, no filtering by parents will happen. If set to
  // `1`, all merge commits will be omitted.
  uint32 max_parents = 5;

  // disable_walk will disable walking the graph. As a result, only commits
  // which are immediately referenced by Revisions will be returned.
  bool disable_walk = 6;

  // first_parent will cause the graph walk to only go down the first-parent
  // chain of commits. Merge commits will thus only cause the mainline to be
  // enumerated.
  bool first_parent = 7;

  // after will only list commits which are more recent than the specified date.
  google.protobuf.Timestamp after = 8;

  // before will only list commits which are older than the specified date.
  google.protobuf.Timestamp before = 9;

  // author will only list commits whose author matches the given pattern,
  // which is a regular expression.
  bytes author = 10;

  // ignore_case will apply case-sensitive behaviour while regex matching.
  bool ignore_case = 12;

  // commit_message_patterns will only list commits whose commit message matches
  // any of the given patterns.
  repeated bytes commit_message_patterns = 13;
}

// ListCommitsResponse is a response for the ListCommits RPC. The response will be
// chunked into multiple message if the returned data exceeds gRPC message limits.
message ListCommitsResponse {
  // commits is the list of commits found.
  repeated GitCommit commits = 1;
}

// ListAllCommitsRequest is a request for the ListAllCommits RPC.
message ListAllCommitsRequest {
  // repository is the repository in which commits should be searched for.
  Repository repository = 1 [(target_repository)=true];

  // pagination_params controls paging. Refer to PaginationParameter documentation for
  // further info.
  PaginationParameter pagination_params = 2;
}

// ListAllCommitsResponse is a response for the ListAllCommits RPC. The response will be
// chunked into multiple message if the returned data exceeds gRPC message limits.
message ListAllCommitsResponse {
  // commits is the list of commits found.
  repeated GitCommit commits = 1;
}


// CommitStatsRequest is the request for the CommitStats RPC.
message CommitStatsRequest {
  // repository is the repository in which the commit is present.
  Repository repository = 1 [(target_repository)=true];
  // revision is a commitish for which we want to get the stats.
  bytes revision = 2;
}

// CommitStatsResponse is the request for the CommitStats RPC.
message CommitStatsResponse {
  // oid is the commit object ID. It is empty if the commit is not found.
  string oid = 1;
  // additions refers to the number of lines added in the commit.
  int32 additions = 2;
  // deletions refers to the number of lines deleted in the commit.
  int32 deletions = 3;
}

// CommitIsAncestorRequest is the request for the CommitIsAncestor RPC.
message CommitIsAncestorRequest {
  // repository is the repository for which we need to check the ancestry.
  Repository repository = 1 [(target_repository)=true];
  // ancestor_id is the object ID of the commit which needs to be checked as ancestor.
  string ancestor_id = 2;
  // child_id is the object ID of the commit whose ancestor needs to be confirmed.
  string child_id = 3;
}

// CommitIsAncestorResponse is the response for the CommitIsAncestor RPC.
message CommitIsAncestorResponse {
  // value denotes whether the provided commit is the ancestor or not.
  bool value = 1;
}

// TreeEntryRequest is a request for the TreeEntry RPC.
message TreeEntryRequest {
  // repository is the repository for which to read the tree entry.
  Repository repository = 1 [(target_repository)=true];
  // revision is the commitish at which the tree entry is to be read.
  bytes revision = 2;
  // path is the path of the entry that shall be read, relative to the tree of the specified revision.
  bytes path = 3;
  // limit is the maximum number of bytes to fetch. If object is bigger, remaining bytes are not sent
  // 0 means there is no limit.
  int64 limit = 4;
  // max_size is the maximum allowed object size. If bigger, a FailedPrecondition error is returned
  // 0 means there is no maximum size.
  int64 max_size = 5;
}

// TreeEntryResponse is a response for the TreeEntry RPC. The response will be
// chunked into multiple message if the returned data exceeds gRPC message limits.
message TreeEntryResponse {
  // ObjectType is the type of the returned tree entry.
  //
  // TODO: Replace this enum with ObjectType in shared.proto
  enum ObjectType {
    // COMMIT indicates that the tree entry is a commit, which may be the case for submodules.
    COMMIT = 0; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH
    // BLOB indicates that the tree entry is a blob.
    BLOB = 1; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
    // TREE indicates that the tree entry is a tree, which may be the case for subdirectories.
    TREE = 2; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
    // TAG indicates that the tree entry is a tag. This case should never happen.
    TAG = 3; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
  }

  // type is the object type of the tree entry.
  ObjectType type = 1;
  // oid is the object ID of the tree entry. In case of submodules, it contains the commit ID that the submodule
  // currently refers to.
  string oid = 2;
  // size is the size of the tree entry.
  int64 size = 3;
  // mode is the mode of the tree entry.
  int32 mode = 4;
  // data contains the raw object contents. This data may be split up across multiple messages.
  bytes data = 5;
}

// CountCommitsRequest is the request for the CountCommits RPC.
message CountCommitsRequest {
  // repository is the repository in which we want to count the number of commits.
  Repository repository = 1 [(target_repository)=true];
  // revision is a commitish which is the start point for the traversal of commits.
  bytes revision = 2;
  // after is used to filter commits more recent than a specific date.
  google.protobuf.Timestamp after = 3;
  // before is used to filter commits older than a specific date.
  google.protobuf.Timestamp before = 4;
  // path is used to filter commits which modify the provided path.
  bytes path = 5;
  // max_count is used to cap the number of commits.
  int32 max_count = 6;
  // all is used to consider all refs (including HEAD) as the start point for the traversal.
  // all and Revision options are mutually exclusive.
  bool all = 7;
  // first_parent ensures that only the first parent commit is followed in the traversal.
  bool first_parent = 8;
  // global_options contains the global options used to modify the behaviour of Git.
  GlobalOptions global_options = 9;
}

// CountCommitsResponse is the response for the CountCommits RPC.
message CountCommitsResponse {
  // count denotes the number of commits found as per the given filters.
  int32 count = 1;
}

// CountDivergingCommitsRequest is the request for the CountDivergingCommits RPC.
message CountDivergingCommitsRequest {
  // repository is the repository in which we want to find the number of diverging commits.
  Repository repository = 1 [(target_repository)=true];
  // from is the object ID of one of the commits against which we want to check the
  // number of diverging commits. The From and To fields are interchangeable.
  bytes from = 2;
  // to is the object ID of one of the commits against which we want to check the
  // number of diverging commits. The To and From fields are interchangeable.
  bytes to = 3;
  reserved 4;
  reserved 5;
  reserved 6;
  // max_count denotes the cap for the number of diverging commits to be reported.
  int32 max_count = 7;
}

// CountDivergingCommitsResponse is the response for the CountDivergingCommits RPC.
message CountDivergingCommitsResponse {
  // left_count denotes the number of diverging commits present in the 'From' commit provided.
  int32 left_count = 1;
  // right_count denotes the number of diverging commits present in the 'To' commit provided.
  int32 right_count = 2;
}

// TreeEntry denotes a single tree entry.
message TreeEntry {
  // EntryType denotes the different types of tree entry.
  enum EntryType {
    // BLOB indicates that the tree entry is a blob.
    BLOB = 0; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH
    // TREE indicates that the tree entry is a tree, which may be the case for subdirectories.
    TREE = 1; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
    // COMMIT indicates that the tree entry is a commit, which may be the case for submodules.
    COMMIT = 3; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
  }

  // oid of the object this tree entry points to.
  string oid = 1;
  // path is the path of the entry relative to the tree of the specified revision.
  bytes path = 3;
  // type denotes the type of the tree entry.
  EntryType type = 4;
  // mode is the mode of the tree entry.
  int32 mode = 5;
  // commit_oid is the commit object via which this entry was retrieved.
  string commit_oid = 6;
  // flat_path is the relative path of the first subdir that doesn't have only one directory descendant.
  bytes flat_path = 7;

  // RootOid used to refer to the resolved object ID of the root tree. This field has been removed
  // with no replacement.
  reserved "root_oid";
  reserved 2;
}

// GetTreeEntriesRequest is the request for the GetTreeEntries RPC.
message GetTreeEntriesRequest {
  // SortBy provides the sorting parameters.
  enum SortBy {
    // DEFAULT preserves the order of git ls-tree.
    DEFAULT = 0; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH
    // TREES_FIRST sorts the entries by trees, blobs and submodules.
    TREES_FIRST = 1; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
  }

  // repository is the repository to get the tree entries from.
  Repository repository = 1 [(target_repository)=true];
  // revision is the commitish at which the tree entries is to be read.
  bytes revision = 2;
  // path is the path of the entry that shall be read, relative to the tree of the specified revision.
  bytes path = 3;
  // recursive denotes wether to recursively fetch sub-trees.
  bool recursive = 4;
  // sort defines the sorting parameter.
  SortBy sort = 5;
  // pagination_params controls paging. Refer to PaginationParameter documentation for
  // further info.
  PaginationParameter pagination_params = 6;
  // skip_flat_paths is an option to skip the expensive operation of populating flat paths.
  bool skip_flat_paths = 7;
}

// GetTreeEntriesResponse is the response for the GetTreeEntries RPC. The response will be
// chunked into multiple message if the returned data exceeds gRPC message limits.
message GetTreeEntriesResponse {
  // entries denotes a list of tree entries.
  repeated TreeEntry entries = 1;
  // pagination_cursor defines the offset for subsequent requests. Refer to PaginationCursor
  // documentation for further info.
  PaginationCursor pagination_cursor = 2;
}

// GetTreeEntriesError may be returned when GetTreeEntries fails with a specific root
// cause.
message GetTreeEntriesError {
  oneof error {
    // resolve_tree is set when the provided revision ID could not be resolved.
    ResolveRevisionError resolve_tree = 1;
    // path is set when the provided path is not valid.
    PathError path = 2;
  }
}

// ListFilesRequest is the request for the ListFiles RPC.
message ListFilesRequest {
  // repository is the repository to list the files from.
  Repository repository = 1 [(target_repository)=true];
  // revision is a commitish against which we list all files.
  bytes revision = 2;
}

// ListFilesResponse is the response for the ListFiles RPC. The response will be
// chunked into multiple message if the returned data exceeds gRPC message limits.
message ListFilesResponse {
  // paths is the list of paths found for the requested revision. Clients must
  // remember to force utf-8 encoding.
  repeated bytes paths = 1;
}

// FindCommitRequest is the request for the FindCommit RPC.
message FindCommitRequest {
  // repository is the repository in which we want to find the commit.
  Repository repository = 1 [(target_repository)=true];
  // revision is a commitish which is to be resolved to a commit.
  bytes revision = 2;
  // trailers if set, parses and adds the trailing information of the commit.
  bool trailers = 3;
}

// FindCommitResponse is the request for the FindCommit RPC. Returns empty response
// if the commit is not found.
message FindCommitResponse {
  // commit is the requested commit, it is nil when the commit was not found.
  GitCommit commit = 1;
}

// ListCommitsByOidRequest is the request for the ListCommitsByOid RPC.
message ListCommitsByOidRequest {
  // repository is the repository to list commits from.
  Repository repository = 1 [(target_repository)=true];
  // oid is a set of commitish object IDs to list commits for.
  // If there is no commit against a provided object ID, no error is thrown. It is simply ignored.
  repeated string oid = 2; // protolint:disable:this REPEATED_FIELD_NAMES_PLURALIZED
}

// ListCommitsByOidResponse is the response for the ListCommitsByOid RPC.
message ListCommitsByOidResponse {
  // commits are the list of commits for the provided object IDs from the request.
  repeated GitCommit commits = 1;
}

// ListCommitsByRefNameRequest is the request for the ListCommitsByRefName RPC.
message ListCommitsByRefNameRequest {
  // repository is the repository to list commits from.
  Repository repository = 1 [(target_repository)=true];
  // ref_names is a set of references to obtain commits for.
  // If there is no commit against a provided reference, no error is thrown. It is simply ignored.
  repeated bytes ref_names = 2;
}

// ListCommitsByRefNameResponse is the response for the ListCommitsByRefName RPC.
message ListCommitsByRefNameResponse {
  reserved 1;

  // CommitForRef holds the commit for a given reference.
  message CommitForRef {
    // commit is the commit object against the reference.
    GitCommit commit = 1;
    // ref_name is a reference from the repository.
    bytes ref_name = 2;
  }

  // commit_refs is a list of CommitForRef objects which provides the commits
  // against the requested references.
  repeated CommitForRef commit_refs = 2;
}

// FindAllCommitsRequest is the request for the FindAllCommits RPC.
message FindAllCommitsRequest {
  // Order is the order in which commits should be traversed.
  enum Order {
    // NONE denotes the default ordering where the commits are shown in
    // reverse chronological order.
    NONE = 0; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH
    // TOPO order will cause no parents to be shown before all of its children
    // are shown. Furthermore, multiple lines of history will not be
    // intermixed.
    TOPO = 1; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
    // DATE order will cause no parents to be shown before all of its children
    // are shown. Otherwise, commits are shown in commit timestamp order. This
    // can cause history to be shown intermixed.
    DATE = 2; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
  }

  // repository is the repository from which we will list the commits.
  Repository repository = 1 [(target_repository)=true];
  // revision is the commitish which is the starting point for the traversal. When nil,
  // return all commits reachable by any branch in the repo.
  bytes revision = 2;
  // max_count is the maximum number of commits to list.
  int32 max_count = 3;
  // skip is the number of commits to skip before starting to show the
  // commit output.
  int32 skip = 4;
  // order is the order in which commits should be traversed. Refer to
  // the enum's documentation for further information.
  Order order = 5;
}

// FindAllCommitsResponse is the response for the FindAllCommits RPC. The response will be
// chunked into multiple message if the returned data exceeds gRPC message limits.
message FindAllCommitsResponse {
  // commits is a list of commits produced as per the request.
  repeated GitCommit commits = 1;
}

// FindCommitsRequest is the request for the FindCommits RPC.
message FindCommitsRequest {
  // Order is the order in which commits should be traversed.
  enum Order {
    // NONE defaults to reverse chronological order.
    NONE = 0; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH
    // TOPO order will cause no parents to be shown before all of its children
    // are shown. Furthermore, multiple lines of history will not be
    // intermixed.
    TOPO = 1; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
  }

  // repository is the repository from which the commits are listed.
  Repository repository = 1 [(target_repository)=true];
  // revision is a commitish against which the commits for the provided
  // paths are listed. If there is no revision provided, the default branch
  // is considered. It is mutually exclusive with the `All` option.
  bytes revision = 2;
  // limit is maximum number of commits to list.
  int32 limit = 3;
  // offset is the number of commits to skip before starting the traversal.
  int32 offset = 4;
  // paths is a list of non-empty paths for which we want to list commits.
  repeated bytes paths = 5;
  // follow is used to list the history of a file beyond renames (works only for
  // a single file).
  bool follow = 6;
  // skip_merges is used to skip merge commits.
  bool skip_merges = 7;
  // disable_walk is no longer supported.
  bool disable_walk = 8 [deprecated = true];
  // after will only list commits which are more recent than the specified date.
  google.protobuf.Timestamp after = 9;
  // before will only list commits which are older than the specified date.
  google.protobuf.Timestamp before = 10;
  // all is used to consider all refs (including HEAD) as the start point for the traversal.
  // `all` and `revision` options are mutually exclusive.
  bool all = 11;
  // first_parent ensures that only the first parent commit is followed in the traversal.
  bool first_parent = 12;
  // author will only list commits whose author matches the given pattern,
  // which is a regular expression.
  bytes author = 13;
  // order is the order in which commits should be traversed. Please refer to
  // the enum's documentation for further information.
  Order order = 14;
  // global_options contains the global options used to modify the behaviour of Git.
  GlobalOptions global_options = 15;
  // trailers if set, parses and adds the trailing information of the commit.
  bool trailers = 16;
  // include_shortstat determines whether to include the number of lines and files
  // changed in the commits. Populates the `ShortStats` field.
  bool include_shortstat = 17;
  // include_referenced_by determines whether to include references that point to a
  // commit in the response. The field contains patterns that are matched against
  // references. Only matching references are included in the response. For
  // example, one can get tags pointing to a commit with `refs/tags`, or branches
  // respectively with `refs/heads`. By sending both, the response will include all
  // references that match either pattern.
  repeated bytes include_referenced_by = 18; // protolint:disable:this REPEATED_FIELD_NAMES_PLURALIZED
}

// FindCommitsResponse is the response for the FindCommits RPC. The response will be
// chunked into multiple message if the returned data exceeds gRPC message limits.
message FindCommitsResponse {
  // commits is a list of commits produced as per the request.
  repeated GitCommit commits = 1;
}

// FindCommitsError is an error returned by the FindCommits RPC when no commit is found.
message FindCommitsError {

  // error denotes the type of error encountered.
  oneof error {
    // bad_object is returned when the revision cannot be found in the git repository.
    BadObjectError bad_object = 1;
    // ambiguous_ref is returned when the given revision cannot be found.
    AmbiguousReferenceError ambiguous_ref = 2;
    // invalid_range is returned when the provided revision-range cannot be found in the git repository.
    InvalidRevisionRange invalid_range = 3;
  }
}

// CommitLanguagesRequest requests to detect the source code languages.
message CommitLanguagesRequest {
  // repository is the repository where to detect the languages in.
  Repository repository = 1 [(target_repository)=true];
  // revision tells for which commitish the languages should be detected. If it's
  // omitted, the HEAD commit of the default branch is used.
  bytes revision = 2;
}

// CommitLanguagesResponse returns the language statistics.
message CommitLanguagesResponse {
  // Language specifies the statistics for one language.
  message Language {
    // name is the name of the detected language, for example: Ruby, Go, HTML
    // A full list of language names can be found at:
    // https://github.com/github/linguist/blob/master/lib/linguist/languages.yml
    string name = 1;
    // share is the percentual share (value between 0 and 100) of this language
    // in relation to other languages that exist in the given revision.
    float share = 2;
    // color specifies the associated color for this language, for example #3fd5e0.
    string color = 3;
    // FileCount was a uint32 that stored how many files with this language were found.
    // However, it was never used and there is no client demand for it.
    // See: https://gitlab.com/gitlab-org/gitaly/-/issues/4293.
    reserved 4;
    reserved "file_count";
    // bytes is the total amount of bytes written in this language
    uint64 bytes = 5;
  }

  // languages is a set of all the detected languages and their statistics.
  repeated Language languages = 1;
}

// RawBlameRequest is a request for the RawBlame RPC.
message RawBlameRequest {
  // repository is the repository to perform the blame on.
  Repository repository = 1 [(target_repository)=true];
  // revision is the commitish at which to start the blame.
  bytes revision = 2;
  // path is the path of the blob that should be blamed.
  bytes path = 3;
  // range is the comma-separated range of line numbers to perform the blame on, e.g. "1,1000". Optional - if no range
  // is provided, the whole file will be blamed.
  bytes range = 4;
}

// RawBlameResponse is a response for the RawBlame RPC. The response will be
// chunked into multiple message if the returned data exceeds gRPC message limits.
message RawBlameResponse {
  // data is the raw data as generated by git-blame(1).
  bytes data = 1;
}

// RawBlameError is used as error detail when the RawBlame RPC fails in a specific way.
message RawBlameError {
  // OutOfRangeError indicates that the specified file range that is to be blamed exceeds the length of the blamed
  // file.
  message OutOfRangeError {
    // actual_lines contains the actual number of lines that can be blamed in the file.
    uint64 actual_lines = 1;
  }

  // error denotes the type of error encountered.
  oneof error {
    // path_not_found is returned when the blamed path cannot be found in the revision.
    PathNotFoundError path_not_found = 1;
    // out_of_range is returned when the specified blamed range exceeds the file length.
    OutOfRangeError out_of_range = 2;
  }
}

// LastCommitForPathRequest is a request for the LastCommitForPath RPC.
message LastCommitForPathRequest {
  // repository is the repository to run the query in.
  Repository repository = 1 [(target_repository)=true];
  // revision is the commitish that is used as the start commit to perform the search.
  bytes revision = 2;
  // path is the path for which the last commit should be searched. This path can either point to a blob or to a
  // tree. The path must be relative and must not escape the repository root. If the path is empty or "/", then the
  // repository root will be searched instead.
  bytes path = 3;
  // literal_pathspec will treat the path literally. No globbing or pathspec magic is performed. This option is
  // deprecated in favor of GlobalOptions.
  bool literal_pathspec = 4;
  // global_options contains the global options used to modify the behaviour of Git.
  GlobalOptions global_options = 5;
}

// LastCommitForPathResponse is a response for the LastCommitForPath RPC.
message LastCommitForPathResponse {
  // commit is the commit that has last modified the given path. Unset in case the path could not be found.
  GitCommit commit = 1;
}

// ListLastCommitsForTreeRequest is the request for the ListLastCommitsForTree RPC.
message ListLastCommitsForTreeRequest {
  // repository is the repository to run the query in.
  Repository repository = 1 [(target_repository)=true];
  // revision is the treeish to retrieve commits against.
  string revision = 2;
  // path is the relative path to further filter against the treeish revision. This path can either point to a blob
  // or to a tree. The path must be relative and must not escape the repository root. If the path is empty or "/", then
  // it will be replaced with the root of of the repository.
  bytes path = 3;
  // limit is the number of tree entries to limit the response to.
  int32 limit = 4;
  // offset is the offset of the tree entries from which to start the response.
  int32 offset = 5;
  // literal_pathspec is deprecated.
  bool literal_pathspec = 6 [deprecated = true];
  // global_options contains the global options used to modify the behaviour of Git.
  GlobalOptions global_options = 7;
}

// ListLastCommitsForTreeResponse is the response for the ListLastCommitsForTree RPC.
message ListLastCommitsForTreeResponse {
  // CommitForTree denotes the last commit for associated path.
  message CommitForTree {
    reserved 1;

    // commit is the commit that has last modified the path.
    GitCommit commit = 2;
    reserved 3;
    // path_bytes is the path associated with the commit.
    bytes path_bytes = 4;
  }

  // commits is a set of CommitForTree objects.
  repeated CommitForTree commits = 1;
}

// CommitsByMessageRequest is the request for the CommitsByMessage RPC.
message CommitsByMessageRequest {
  // repository is the repository to run the query in.
  Repository repository = 1 [(target_repository)=true];
  // revision is the commitish to retrieve commits against.
  bytes revision = 2;
  // offset is the offset from which to list commits.
  int32 offset = 3;
  // limit is the maximum number of commits to list.
  int32 limit = 4;
  // path is the relative path to filter the commits to.
  bytes path = 5;
  // query is the search param to search commit messages against.
  string query = 6;
  // global_options contains the global options used to modify the behaviour of Git.
  GlobalOptions global_options = 7;
}

// CommitsByMessageResponse is the response for the CommitsByMessage RPC.
// One 'page' of the paginated response of CommitsByMessage.
message CommitsByMessageResponse {
  // commits is the list of commits which match the query from the request.
  repeated GitCommit commits = 1;
}

// FilterShasWithSignaturesRequest is the request for the FilterShasWithSignatures RPC.
message FilterShasWithSignaturesRequest {
  // repository is the repository to retrieve the commits from.
  Repository repository = 1 [(target_repository)=true];
  // shas is a set of commitish object IDs. If there is no corresponding commit for a
  // provided sha, no error will be thrown. Only signed commits will be returned in the
  // response.
  repeated bytes shas = 2;
}

// FilterShasWithSignaturesResponse is the response for the FilterShasWithSignatures RPC.
message FilterShasWithSignaturesResponse {
  // shas is the filtered list of shas from the request which have an associated signed
  // commit.
  repeated bytes shas = 1;
}

// GetCommitSignaturesRequest is the request for the GetCommitSignatures RPC.
message GetCommitSignaturesRequest {
  // repository is the repository to retrieve the commits from.
  Repository repository = 1 [(target_repository)=true];
  // commit_ids is the list of commitish object IDs for whom we want to retrieve
  // signature information. If a commit doesn't have associated signature information
  // it will be omitted from the results.
  repeated string commit_ids = 2;
}

// GetCommitSignaturesResponse is the response for the GetCommitSignatures RPC.
message GetCommitSignaturesResponse {
  // Signer of the commit. A commit can be signed either by a user or by Gitaly itself.
  enum Signer {
    // SIGNER_UNSPECIFIED indicates that the signer has not been specified.
    SIGNER_UNSPECIFIED = 0;
    // SIGNER_USER indicates that the commit has been signed by a user.
    SIGNER_USER = 1;
    // SIGNER_SYSTEM indicates that the commit has been signed by Gitaly itself.
    SIGNER_SYSTEM = 2;
  }

  // commit_id of the signature.
  string commit_id = 1;
  // signature of the commit (GPG or SSH).
  bytes signature = 2;
  // signed_text is text that is used to verify the signature.
  bytes signed_text = 3;
  // signer of the commit
  Signer signer = 4;
}

// GetCommitMessagesRequest is the request for the GetCommitMessages RPC.
message GetCommitMessagesRequest {
  // repository is the repository to retrieve the commits from.
  Repository repository = 1 [(target_repository)=true];
  // commit_ids is the list of commitish object IDs for whom we want to retrieve
  // the commit message.
  repeated string commit_ids = 2;
}

// GetCommitMessagesResponse is the response for the GetCommitMessages RPC.
message GetCommitMessagesResponse {
  // commit_id is the commit object ID. A response with commit_id set, will be followed with
  // response with the message field set with the commit message for that commit.
  string commit_id = 1;
  // message is the commit message for the commit.
  bytes message = 2;
}

// CheckObjectsExistRequest is a request for the CheckObjectsExist RPC.
message CheckObjectsExistRequest {
  // repository is the repository in which existence of objects and refs
  // are checked. Only the initial request must contain a repository, the repository of all
  // subsequent requests will be ignored.
  Repository repository = 1 [(target_repository)=true];
  // revisions contains the revisions that shall be checked for existence. This accepts all revisions
  // as documented in gitrevisions(7).
  repeated bytes revisions = 2;
}

// CheckObjectsExistResponse is a response for the CheckObjectsExist RPC.
message CheckObjectsExistResponse {
  // RevisionExistence lists a revision with information about its existence.
  message RevisionExistence {
    // name refers to the revision.
    bytes name = 1;
    // exists is true if the revision exists in the repository.
    bool exists = 2;
  };

  // revisions is the list of RevisionExistence objects used to indicate which
  // revisions exist.
  repeated RevisionExistence revisions = 1;
}