Monorepo for Tangled
0

Configure Feed

Select the types of activity you want to include in your feed.

slop

Signed-off-by: Seongmin Lee <git@boltless.me>

Seongmin Lee (Jul 2, 2026, 12:51 PM +0900) 42f221ab b728491d

+635 -82
+7 -6
Cargo.lock
··· 1724 1724 "gix", 1725 1725 "line-numbers", 1726 1726 "prost", 1727 + "prost-types", 1727 1728 "rustc-hash", 1728 1729 "tempfile", 1729 1730 "tokio", ··· 4110 4111 4111 4112 [[package]] 4112 4113 name = "prost" 4113 - version = "0.14.3" 4114 + version = "0.14.4" 4114 4115 source = "registry+https://github.com/rust-lang/crates.io-index" 4115 - checksum = "d2ea70524a2f82d518bce41317d0fae74151505651af45faf1ffbd6fd33f0568" 4116 + checksum = "528ac67416ff8646872a3c02cad9cc4ee5dc9f9540c9b10771855c95cb2e5ae1" 4116 4117 dependencies = [ 4117 4118 "bytes", 4118 4119 "prost-derive", ··· 4141 4142 4142 4143 [[package]] 4143 4144 name = "prost-derive" 4144 - version = "0.14.3" 4145 + version = "0.14.4" 4145 4146 source = "registry+https://github.com/rust-lang/crates.io-index" 4146 - checksum = "27c6023962132f4b30eb4c172c91ce92d933da334c59c23cddee82358ddafb0b" 4147 + checksum = "b570b25f7617e43d59005d0990ccb79e950a423952cea19671b7a876da390adf" 4147 4148 dependencies = [ 4148 4149 "anyhow", 4149 4150 "itertools 0.14.0", ··· 4221 4222 4222 4223 [[package]] 4223 4224 name = "prost-types" 4224 - version = "0.14.3" 4225 + version = "0.14.4" 4225 4226 source = "registry+https://github.com/rust-lang/crates.io-index" 4226 - checksum = "8991c4cbdb8bc5b11f0b074ffe286c30e523de90fee5ba8132f1399f23cb3dd7" 4227 + checksum = "f94967dc7688f3054c7fac87473ffae4cc4c3904800e2d9f5b857246d8963b0a" 4227 4228 dependencies = [ 4228 4229 "prost", 4229 4230 ]
+1
gitmirror/Cargo.toml
··· 18 18 line-numbers = "0.4.0" 19 19 rustc-hash = "2.1.2" 20 20 gix = { version = "0.84", features = ["parallel", "blob-diff", "merge", "sha1", "sha256", "revision", "tree-editor"] } 21 + prost-types = "0.14.4" 21 22 22 23 [build-dependencies] 23 24 tonic-prost-build = { workspace = true }
+392 -72
gitmirror/proto/gen/gitmirror.pb.go
··· 9 9 import ( 10 10 protoreflect "google.golang.org/protobuf/reflect/protoreflect" 11 11 protoimpl "google.golang.org/protobuf/runtime/protoimpl" 12 + timestamppb "google.golang.org/protobuf/types/known/timestamppb" 12 13 reflect "reflect" 13 14 sync "sync" 14 15 unsafe "unsafe" ··· 75 76 return "" 76 77 } 77 78 79 + type CommitLogRequest struct { 80 + state protoimpl.MessageState `protogen:"open.v1"` 81 + // repo DID 82 + Repo string `protobuf:"bytes,1,opt,name=repo,proto3" json:"repo,omitempty"` 83 + // Ranges to include in the git log (revspec, "A..B", "A...B", etc.). 84 + // At least one range, or all_refs must be specified. 85 + Ranges [][]byte `protobuf:"bytes,2,rep,name=ranges,proto3" json:"ranges,omitempty"` 86 + // If true, all refs are searched for commits. 87 + // Must not be true when ranges are given. 88 + AllRefs bool `protobuf:"varint,3,opt,name=all_refs,json=allRefs,proto3" json:"all_refs,omitempty"` 89 + // After is an optional parameter to specify the earliest commit to consider. 90 + After *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=after,proto3" json:"after,omitempty"` 91 + // Before is an optional parameter to specify the latest commit to consider. 92 + Before *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=before,proto3" json:"before,omitempty"` 93 + // MaxCommits is an optional parameter to specify the maximum number of commits 94 + // to return. If max_commits is 0, all commits that match the criteria will be 95 + // returned. 96 + MaxCommits uint32 `protobuf:"varint,6,opt,name=max_commits,json=maxCommits,proto3" json:"max_commits,omitempty"` 97 + // Skip is an optional parameter to specify the number of commits to skip. 98 + // This can be used to implement a poor mans pagination. 99 + Skip uint32 `protobuf:"varint,7,opt,name=skip,proto3" json:"skip,omitempty"` 100 + unknownFields protoimpl.UnknownFields 101 + sizeCache protoimpl.SizeCache 102 + } 103 + 104 + func (x *CommitLogRequest) Reset() { 105 + *x = CommitLogRequest{} 106 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[1] 107 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 108 + ms.StoreMessageInfo(mi) 109 + } 110 + 111 + func (x *CommitLogRequest) String() string { 112 + return protoimpl.X.MessageStringOf(x) 113 + } 114 + 115 + func (*CommitLogRequest) ProtoMessage() {} 116 + 117 + func (x *CommitLogRequest) ProtoReflect() protoreflect.Message { 118 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[1] 119 + if x != nil { 120 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 121 + if ms.LoadMessageInfo() == nil { 122 + ms.StoreMessageInfo(mi) 123 + } 124 + return ms 125 + } 126 + return mi.MessageOf(x) 127 + } 128 + 129 + // Deprecated: Use CommitLogRequest.ProtoReflect.Descriptor instead. 130 + func (*CommitLogRequest) Descriptor() ([]byte, []int) { 131 + return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{1} 132 + } 133 + 134 + func (x *CommitLogRequest) GetRepo() string { 135 + if x != nil { 136 + return x.Repo 137 + } 138 + return "" 139 + } 140 + 141 + func (x *CommitLogRequest) GetRanges() [][]byte { 142 + if x != nil { 143 + return x.Ranges 144 + } 145 + return nil 146 + } 147 + 148 + func (x *CommitLogRequest) GetAllRefs() bool { 149 + if x != nil { 150 + return x.AllRefs 151 + } 152 + return false 153 + } 154 + 155 + func (x *CommitLogRequest) GetAfter() *timestamppb.Timestamp { 156 + if x != nil { 157 + return x.After 158 + } 159 + return nil 160 + } 161 + 162 + func (x *CommitLogRequest) GetBefore() *timestamppb.Timestamp { 163 + if x != nil { 164 + return x.Before 165 + } 166 + return nil 167 + } 168 + 169 + func (x *CommitLogRequest) GetMaxCommits() uint32 { 170 + if x != nil { 171 + return x.MaxCommits 172 + } 173 + return 0 174 + } 175 + 176 + func (x *CommitLogRequest) GetSkip() uint32 { 177 + if x != nil { 178 + return x.Skip 179 + } 180 + return 0 181 + } 182 + 183 + type CommitLogResponse struct { 184 + state protoimpl.MessageState `protogen:"open.v1"` 185 + Commits []*GitCommit `protobuf:"bytes,1,rep,name=commits,proto3" json:"commits,omitempty"` 186 + unknownFields protoimpl.UnknownFields 187 + sizeCache protoimpl.SizeCache 188 + } 189 + 190 + func (x *CommitLogResponse) Reset() { 191 + *x = CommitLogResponse{} 192 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[2] 193 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 194 + ms.StoreMessageInfo(mi) 195 + } 196 + 197 + func (x *CommitLogResponse) String() string { 198 + return protoimpl.X.MessageStringOf(x) 199 + } 200 + 201 + func (*CommitLogResponse) ProtoMessage() {} 202 + 203 + func (x *CommitLogResponse) ProtoReflect() protoreflect.Message { 204 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[2] 205 + if x != nil { 206 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 207 + if ms.LoadMessageInfo() == nil { 208 + ms.StoreMessageInfo(mi) 209 + } 210 + return ms 211 + } 212 + return mi.MessageOf(x) 213 + } 214 + 215 + // Deprecated: Use CommitLogResponse.ProtoReflect.Descriptor instead. 216 + func (*CommitLogResponse) Descriptor() ([]byte, []int) { 217 + return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{2} 218 + } 219 + 220 + func (x *CommitLogResponse) GetCommits() []*GitCommit { 221 + if x != nil { 222 + return x.Commits 223 + } 224 + return nil 225 + } 226 + 78 227 // One chunk of a blob's raw bytes; concatenate in arrival order. 79 228 type BlobChunk struct { 80 229 state protoimpl.MessageState `protogen:"open.v1"` ··· 85 234 86 235 func (x *BlobChunk) Reset() { 87 236 *x = BlobChunk{} 88 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[1] 237 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[3] 89 238 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 90 239 ms.StoreMessageInfo(mi) 91 240 } ··· 97 246 func (*BlobChunk) ProtoMessage() {} 98 247 99 248 func (x *BlobChunk) ProtoReflect() protoreflect.Message { 100 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[1] 249 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[3] 101 250 if x != nil { 102 251 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 103 252 if ms.LoadMessageInfo() == nil { ··· 110 259 111 260 // Deprecated: Use BlobChunk.ProtoReflect.Descriptor instead. 112 261 func (*BlobChunk) Descriptor() ([]byte, []int) { 113 - return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{1} 262 + return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{3} 114 263 } 115 264 116 265 func (x *BlobChunk) GetData() []byte { ··· 131 280 132 281 func (x *CommitsRequest) Reset() { 133 282 *x = CommitsRequest{} 134 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[2] 283 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[4] 135 284 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 136 285 ms.StoreMessageInfo(mi) 137 286 } ··· 143 292 func (*CommitsRequest) ProtoMessage() {} 144 293 145 294 func (x *CommitsRequest) ProtoReflect() protoreflect.Message { 146 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[2] 295 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[4] 147 296 if x != nil { 148 297 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 149 298 if ms.LoadMessageInfo() == nil { ··· 156 305 157 306 // Deprecated: Use CommitsRequest.ProtoReflect.Descriptor instead. 158 307 func (*CommitsRequest) Descriptor() ([]byte, []int) { 159 - return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{2} 308 + return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{4} 160 309 } 161 310 162 311 func (x *CommitsRequest) GetRepo() string { ··· 181 330 182 331 func (x *CommitsOptions) Reset() { 183 332 *x = CommitsOptions{} 184 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[3] 333 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[5] 185 334 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 186 335 ms.StoreMessageInfo(mi) 187 336 } ··· 193 342 func (*CommitsOptions) ProtoMessage() {} 194 343 195 344 func (x *CommitsOptions) ProtoReflect() protoreflect.Message { 196 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[3] 345 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[5] 197 346 if x != nil { 198 347 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 199 348 if ms.LoadMessageInfo() == nil { ··· 206 355 207 356 // Deprecated: Use CommitsOptions.ProtoReflect.Descriptor instead. 208 357 func (*CommitsOptions) Descriptor() ([]byte, []int) { 209 - return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{3} 358 + return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{5} 210 359 } 211 360 212 361 type CommitsResponse struct { ··· 219 368 220 369 func (x *CommitsResponse) Reset() { 221 370 *x = CommitsResponse{} 222 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[4] 371 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[6] 223 372 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 224 373 ms.StoreMessageInfo(mi) 225 374 } ··· 231 380 func (*CommitsResponse) ProtoMessage() {} 232 381 233 382 func (x *CommitsResponse) ProtoReflect() protoreflect.Message { 234 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[4] 383 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[6] 235 384 if x != nil { 236 385 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 237 386 if ms.LoadMessageInfo() == nil { ··· 244 393 245 394 // Deprecated: Use CommitsResponse.ProtoReflect.Descriptor instead. 246 395 func (*CommitsResponse) Descriptor() ([]byte, []int) { 247 - return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{4} 396 + return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{6} 248 397 } 249 398 250 399 func (x *CommitsResponse) GetCommits() []string { ··· 267 416 268 417 func (x *DiffRequest) Reset() { 269 418 *x = DiffRequest{} 270 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[5] 419 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[7] 271 420 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 272 421 ms.StoreMessageInfo(mi) 273 422 } ··· 279 428 func (*DiffRequest) ProtoMessage() {} 280 429 281 430 func (x *DiffRequest) ProtoReflect() protoreflect.Message { 282 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[5] 431 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[7] 283 432 if x != nil { 284 433 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 285 434 if ms.LoadMessageInfo() == nil { ··· 292 441 293 442 // Deprecated: Use DiffRequest.ProtoReflect.Descriptor instead. 294 443 func (*DiffRequest) Descriptor() ([]byte, []int) { 295 - return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{5} 444 + return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{7} 296 445 } 297 446 298 447 func (x *DiffRequest) GetRepo() string { ··· 331 480 332 481 func (x *InterdiffRequest) Reset() { 333 482 *x = InterdiffRequest{} 334 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[6] 483 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[8] 335 484 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 336 485 ms.StoreMessageInfo(mi) 337 486 } ··· 343 492 func (*InterdiffRequest) ProtoMessage() {} 344 493 345 494 func (x *InterdiffRequest) ProtoReflect() protoreflect.Message { 346 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[6] 495 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[8] 347 496 if x != nil { 348 497 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 349 498 if ms.LoadMessageInfo() == nil { ··· 356 505 357 506 // Deprecated: Use InterdiffRequest.ProtoReflect.Descriptor instead. 358 507 func (*InterdiffRequest) Descriptor() ([]byte, []int) { 359 - return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{6} 508 + return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{8} 360 509 } 361 510 362 511 func (x *InterdiffRequest) GetRepo() string { ··· 407 556 408 557 func (x *FileContent) Reset() { 409 558 *x = FileContent{} 410 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[7] 559 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[9] 411 560 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 412 561 ms.StoreMessageInfo(mi) 413 562 } ··· 419 568 func (*FileContent) ProtoMessage() {} 420 569 421 570 func (x *FileContent) ProtoReflect() protoreflect.Message { 422 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[7] 571 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[9] 423 572 if x != nil { 424 573 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 425 574 if ms.LoadMessageInfo() == nil { ··· 432 581 433 582 // Deprecated: Use FileContent.ProtoReflect.Descriptor instead. 434 583 func (*FileContent) Descriptor() ([]byte, []int) { 435 - return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{7} 584 + return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{9} 436 585 } 437 586 438 587 func (x *FileContent) GetPath() string { ··· 481 630 482 631 func (x *LinePair) Reset() { 483 632 *x = LinePair{} 484 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[8] 633 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[10] 485 634 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 486 635 ms.StoreMessageInfo(mi) 487 636 } ··· 493 642 func (*LinePair) ProtoMessage() {} 494 643 495 644 func (x *LinePair) ProtoReflect() protoreflect.Message { 496 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[8] 645 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[10] 497 646 if x != nil { 498 647 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 499 648 if ms.LoadMessageInfo() == nil { ··· 506 655 507 656 // Deprecated: Use LinePair.ProtoReflect.Descriptor instead. 508 657 func (*LinePair) Descriptor() ([]byte, []int) { 509 - return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{8} 658 + return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{10} 510 659 } 511 660 512 661 func (x *LinePair) GetLhs() uint32 { ··· 535 684 536 685 func (x *Hunk) Reset() { 537 686 *x = Hunk{} 538 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[9] 687 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[11] 539 688 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 540 689 ms.StoreMessageInfo(mi) 541 690 } ··· 547 696 func (*Hunk) ProtoMessage() {} 548 697 549 698 func (x *Hunk) ProtoReflect() protoreflect.Message { 550 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[9] 699 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[11] 551 700 if x != nil { 552 701 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 553 702 if ms.LoadMessageInfo() == nil { ··· 560 709 561 710 // Deprecated: Use Hunk.ProtoReflect.Descriptor instead. 562 711 func (*Hunk) Descriptor() ([]byte, []int) { 563 - return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{9} 712 + return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{11} 564 713 } 565 714 566 715 func (x *Hunk) GetNovelLhs() []uint32 { ··· 595 744 596 745 func (x *ByteChanges) Reset() { 597 746 *x = ByteChanges{} 598 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[10] 747 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[12] 599 748 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 600 749 ms.StoreMessageInfo(mi) 601 750 } ··· 607 756 func (*ByteChanges) ProtoMessage() {} 608 757 609 758 func (x *ByteChanges) ProtoReflect() protoreflect.Message { 610 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[10] 759 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[12] 611 760 if x != nil { 612 761 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 613 762 if ms.LoadMessageInfo() == nil { ··· 620 769 621 770 // Deprecated: Use ByteChanges.ProtoReflect.Descriptor instead. 622 771 func (*ByteChanges) Descriptor() ([]byte, []int) { 623 - return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{10} 772 + return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{12} 624 773 } 625 774 626 775 func (x *ByteChanges) GetLhs() uint64 { ··· 650 799 651 800 func (x *FileDiff) Reset() { 652 801 *x = FileDiff{} 653 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[11] 802 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[13] 654 803 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 655 804 ms.StoreMessageInfo(mi) 656 805 } ··· 662 811 func (*FileDiff) ProtoMessage() {} 663 812 664 813 func (x *FileDiff) ProtoReflect() protoreflect.Message { 665 - mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[11] 814 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[13] 666 815 if x != nil { 667 816 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 668 817 if ms.LoadMessageInfo() == nil { ··· 675 824 676 825 // Deprecated: Use FileDiff.ProtoReflect.Descriptor instead. 677 826 func (*FileDiff) Descriptor() ([]byte, []int) { 678 - return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{11} 827 + return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{13} 679 828 } 680 829 681 830 func (x *FileDiff) GetLhsSrc() *FileContent { ··· 713 862 return false 714 863 } 715 864 865 + type GitCommit struct { 866 + state protoimpl.MessageState `protogen:"open.v1"` 867 + Oid string `protobuf:"bytes,1,opt,name=oid,proto3" json:"oid,omitempty"` 868 + Author *GitSignature `protobuf:"bytes,2,opt,name=author,proto3" json:"author,omitempty"` 869 + Committer *GitSignature `protobuf:"bytes,3,opt,name=committer,proto3" json:"committer,omitempty"` 870 + Message []byte `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"` 871 + Parents []string `protobuf:"bytes,5,rep,name=parents,proto3" json:"parents,omitempty"` 872 + unknownFields protoimpl.UnknownFields 873 + sizeCache protoimpl.SizeCache 874 + } 875 + 876 + func (x *GitCommit) Reset() { 877 + *x = GitCommit{} 878 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[14] 879 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 880 + ms.StoreMessageInfo(mi) 881 + } 882 + 883 + func (x *GitCommit) String() string { 884 + return protoimpl.X.MessageStringOf(x) 885 + } 886 + 887 + func (*GitCommit) ProtoMessage() {} 888 + 889 + func (x *GitCommit) ProtoReflect() protoreflect.Message { 890 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[14] 891 + if x != nil { 892 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 893 + if ms.LoadMessageInfo() == nil { 894 + ms.StoreMessageInfo(mi) 895 + } 896 + return ms 897 + } 898 + return mi.MessageOf(x) 899 + } 900 + 901 + // Deprecated: Use GitCommit.ProtoReflect.Descriptor instead. 902 + func (*GitCommit) Descriptor() ([]byte, []int) { 903 + return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{14} 904 + } 905 + 906 + func (x *GitCommit) GetOid() string { 907 + if x != nil { 908 + return x.Oid 909 + } 910 + return "" 911 + } 912 + 913 + func (x *GitCommit) GetAuthor() *GitSignature { 914 + if x != nil { 915 + return x.Author 916 + } 917 + return nil 918 + } 919 + 920 + func (x *GitCommit) GetCommitter() *GitSignature { 921 + if x != nil { 922 + return x.Committer 923 + } 924 + return nil 925 + } 926 + 927 + func (x *GitCommit) GetMessage() []byte { 928 + if x != nil { 929 + return x.Message 930 + } 931 + return nil 932 + } 933 + 934 + func (x *GitCommit) GetParents() []string { 935 + if x != nil { 936 + return x.Parents 937 + } 938 + return nil 939 + } 940 + 941 + type GitSignature struct { 942 + state protoimpl.MessageState `protogen:"open.v1"` 943 + Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` 944 + Email []byte `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` 945 + Date *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=date,proto3" json:"date,omitempty"` 946 + unknownFields protoimpl.UnknownFields 947 + sizeCache protoimpl.SizeCache 948 + } 949 + 950 + func (x *GitSignature) Reset() { 951 + *x = GitSignature{} 952 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[15] 953 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 954 + ms.StoreMessageInfo(mi) 955 + } 956 + 957 + func (x *GitSignature) String() string { 958 + return protoimpl.X.MessageStringOf(x) 959 + } 960 + 961 + func (*GitSignature) ProtoMessage() {} 962 + 963 + func (x *GitSignature) ProtoReflect() protoreflect.Message { 964 + mi := &file_gitmirror_v1_gitmirror_proto_msgTypes[15] 965 + if x != nil { 966 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 967 + if ms.LoadMessageInfo() == nil { 968 + ms.StoreMessageInfo(mi) 969 + } 970 + return ms 971 + } 972 + return mi.MessageOf(x) 973 + } 974 + 975 + // Deprecated: Use GitSignature.ProtoReflect.Descriptor instead. 976 + func (*GitSignature) Descriptor() ([]byte, []int) { 977 + return file_gitmirror_v1_gitmirror_proto_rawDescGZIP(), []int{15} 978 + } 979 + 980 + func (x *GitSignature) GetName() []byte { 981 + if x != nil { 982 + return x.Name 983 + } 984 + return nil 985 + } 986 + 987 + func (x *GitSignature) GetEmail() []byte { 988 + if x != nil { 989 + return x.Email 990 + } 991 + return nil 992 + } 993 + 994 + func (x *GitSignature) GetDate() *timestamppb.Timestamp { 995 + if x != nil { 996 + return x.Date 997 + } 998 + return nil 999 + } 1000 + 716 1001 var File_gitmirror_v1_gitmirror_proto protoreflect.FileDescriptor 717 1002 718 1003 const file_gitmirror_v1_gitmirror_proto_rawDesc = "" + 719 1004 "\n" + 720 - "\x1cgitmirror/v1/gitmirror.proto\x12\fgitmirror.v1\"6\n" + 1005 + "\x1cgitmirror/v1/gitmirror.proto\x12\fgitmirror.v1\x1a\x1fgoogle/protobuf/timestamp.proto\"6\n" + 721 1006 "\x0eGetBlobRequest\x12\x12\n" + 722 1007 "\x04repo\x18\x01 \x01(\tR\x04repo\x12\x10\n" + 723 - "\x03oid\x18\x02 \x01(\tR\x03oid\"\x1f\n" + 1008 + "\x03oid\x18\x02 \x01(\tR\x03oid\"\xf4\x01\n" + 1009 + "\x10CommitLogRequest\x12\x12\n" + 1010 + "\x04repo\x18\x01 \x01(\tR\x04repo\x12\x16\n" + 1011 + "\x06ranges\x18\x02 \x03(\fR\x06ranges\x12\x19\n" + 1012 + "\ball_refs\x18\x03 \x01(\bR\aallRefs\x120\n" + 1013 + "\x05after\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\x05after\x122\n" + 1014 + "\x06before\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampR\x06before\x12\x1f\n" + 1015 + "\vmax_commits\x18\x06 \x01(\rR\n" + 1016 + "maxCommits\x12\x12\n" + 1017 + "\x04skip\x18\a \x01(\rR\x04skip\"F\n" + 1018 + "\x11CommitLogResponse\x121\n" + 1019 + "\acommits\x18\x01 \x03(\v2\x17.gitmirror.v1.GitCommitR\acommits\"\x1f\n" + 724 1020 "\tBlobChunk\x12\x12\n" + 725 1021 "\x04data\x18\x01 \x01(\fR\x04data\"\\\n" + 726 1022 "\x0eCommitsRequest\x12\x12\n" + ··· 763 1059 "\x05hunks\x18\x03 \x03(\v2\x12.gitmirror.v1.HunkR\x05hunks\x12H\n" + 764 1060 "\x10has_byte_changes\x18\x04 \x01(\v2\x19.gitmirror.v1.ByteChangesH\x00R\x0ehasByteChanges\x88\x01\x01\x122\n" + 765 1061 "\x15has_syntactic_changes\x18\x05 \x01(\bR\x13hasSyntacticChangesB\x13\n" + 766 - "\x11_has_byte_changes2\xa2\x02\n" + 1062 + "\x11_has_byte_changes\"\xbf\x01\n" + 1063 + "\tGitCommit\x12\x10\n" + 1064 + "\x03oid\x18\x01 \x01(\tR\x03oid\x122\n" + 1065 + "\x06author\x18\x02 \x01(\v2\x1a.gitmirror.v1.GitSignatureR\x06author\x128\n" + 1066 + "\tcommitter\x18\x03 \x01(\v2\x1a.gitmirror.v1.GitSignatureR\tcommitter\x12\x18\n" + 1067 + "\amessage\x18\x04 \x01(\fR\amessage\x12\x18\n" + 1068 + "\aparents\x18\x05 \x03(\tR\aparents\"h\n" + 1069 + "\fGitSignature\x12\x12\n" + 1070 + "\x04name\x18\x01 \x01(\fR\x04name\x12\x14\n" + 1071 + "\x05email\x18\x02 \x01(\fR\x05email\x12.\n" + 1072 + "\x04date\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\x04date2\xf2\x02\n" + 767 1073 "\x10GitMirrorService\x12F\n" + 768 1074 "\aCommits\x12\x1c.gitmirror.v1.CommitsRequest\x1a\x1d.gitmirror.v1.CommitsResponse\x12;\n" + 769 1075 "\x04Diff\x12\x19.gitmirror.v1.DiffRequest\x1a\x16.gitmirror.v1.FileDiff0\x01\x12E\n" + 770 1076 "\tInterdiff\x12\x1e.gitmirror.v1.InterdiffRequest\x1a\x16.gitmirror.v1.FileDiff0\x01\x12B\n" + 771 - "\aGetBlob\x12\x1c.gitmirror.v1.GetBlobRequest\x1a\x17.gitmirror.v1.BlobChunk0\x01B2Z0tangled.org/core/gitmirror/proto/gen;gitmirrorv1b\x06proto3" 1077 + "\aGetBlob\x12\x1c.gitmirror.v1.GetBlobRequest\x1a\x17.gitmirror.v1.BlobChunk0\x01\x12N\n" + 1078 + "\tCommitLog\x12\x1e.gitmirror.v1.CommitLogRequest\x1a\x1f.gitmirror.v1.CommitLogResponse0\x01B2Z0tangled.org/core/gitmirror/proto/gen;gitmirrorv1b\x06proto3" 772 1079 773 1080 var ( 774 1081 file_gitmirror_v1_gitmirror_proto_rawDescOnce sync.Once ··· 782 1089 return file_gitmirror_v1_gitmirror_proto_rawDescData 783 1090 } 784 1091 785 - var file_gitmirror_v1_gitmirror_proto_msgTypes = make([]protoimpl.MessageInfo, 12) 1092 + var file_gitmirror_v1_gitmirror_proto_msgTypes = make([]protoimpl.MessageInfo, 16) 786 1093 var file_gitmirror_v1_gitmirror_proto_goTypes = []any{ 787 - (*GetBlobRequest)(nil), // 0: gitmirror.v1.GetBlobRequest 788 - (*BlobChunk)(nil), // 1: gitmirror.v1.BlobChunk 789 - (*CommitsRequest)(nil), // 2: gitmirror.v1.CommitsRequest 790 - (*CommitsOptions)(nil), // 3: gitmirror.v1.CommitsOptions 791 - (*CommitsResponse)(nil), // 4: gitmirror.v1.CommitsResponse 792 - (*DiffRequest)(nil), // 5: gitmirror.v1.DiffRequest 793 - (*InterdiffRequest)(nil), // 6: gitmirror.v1.InterdiffRequest 794 - (*FileContent)(nil), // 7: gitmirror.v1.FileContent 795 - (*LinePair)(nil), // 8: gitmirror.v1.LinePair 796 - (*Hunk)(nil), // 9: gitmirror.v1.Hunk 797 - (*ByteChanges)(nil), // 10: gitmirror.v1.ByteChanges 798 - (*FileDiff)(nil), // 11: gitmirror.v1.FileDiff 1094 + (*GetBlobRequest)(nil), // 0: gitmirror.v1.GetBlobRequest 1095 + (*CommitLogRequest)(nil), // 1: gitmirror.v1.CommitLogRequest 1096 + (*CommitLogResponse)(nil), // 2: gitmirror.v1.CommitLogResponse 1097 + (*BlobChunk)(nil), // 3: gitmirror.v1.BlobChunk 1098 + (*CommitsRequest)(nil), // 4: gitmirror.v1.CommitsRequest 1099 + (*CommitsOptions)(nil), // 5: gitmirror.v1.CommitsOptions 1100 + (*CommitsResponse)(nil), // 6: gitmirror.v1.CommitsResponse 1101 + (*DiffRequest)(nil), // 7: gitmirror.v1.DiffRequest 1102 + (*InterdiffRequest)(nil), // 8: gitmirror.v1.InterdiffRequest 1103 + (*FileContent)(nil), // 9: gitmirror.v1.FileContent 1104 + (*LinePair)(nil), // 10: gitmirror.v1.LinePair 1105 + (*Hunk)(nil), // 11: gitmirror.v1.Hunk 1106 + (*ByteChanges)(nil), // 12: gitmirror.v1.ByteChanges 1107 + (*FileDiff)(nil), // 13: gitmirror.v1.FileDiff 1108 + (*GitCommit)(nil), // 14: gitmirror.v1.GitCommit 1109 + (*GitSignature)(nil), // 15: gitmirror.v1.GitSignature 1110 + (*timestamppb.Timestamp)(nil), // 16: google.protobuf.Timestamp 799 1111 } 800 1112 var file_gitmirror_v1_gitmirror_proto_depIdxs = []int32{ 801 - 3, // 0: gitmirror.v1.CommitsRequest.options:type_name -> gitmirror.v1.CommitsOptions 802 - 8, // 1: gitmirror.v1.Hunk.lines:type_name -> gitmirror.v1.LinePair 803 - 7, // 2: gitmirror.v1.FileDiff.lhs_src:type_name -> gitmirror.v1.FileContent 804 - 7, // 3: gitmirror.v1.FileDiff.rhs_src:type_name -> gitmirror.v1.FileContent 805 - 9, // 4: gitmirror.v1.FileDiff.hunks:type_name -> gitmirror.v1.Hunk 806 - 10, // 5: gitmirror.v1.FileDiff.has_byte_changes:type_name -> gitmirror.v1.ByteChanges 807 - 2, // 6: gitmirror.v1.GitMirrorService.Commits:input_type -> gitmirror.v1.CommitsRequest 808 - 5, // 7: gitmirror.v1.GitMirrorService.Diff:input_type -> gitmirror.v1.DiffRequest 809 - 6, // 8: gitmirror.v1.GitMirrorService.Interdiff:input_type -> gitmirror.v1.InterdiffRequest 810 - 0, // 9: gitmirror.v1.GitMirrorService.GetBlob:input_type -> gitmirror.v1.GetBlobRequest 811 - 4, // 10: gitmirror.v1.GitMirrorService.Commits:output_type -> gitmirror.v1.CommitsResponse 812 - 11, // 11: gitmirror.v1.GitMirrorService.Diff:output_type -> gitmirror.v1.FileDiff 813 - 11, // 12: gitmirror.v1.GitMirrorService.Interdiff:output_type -> gitmirror.v1.FileDiff 814 - 1, // 13: gitmirror.v1.GitMirrorService.GetBlob:output_type -> gitmirror.v1.BlobChunk 815 - 10, // [10:14] is the sub-list for method output_type 816 - 6, // [6:10] is the sub-list for method input_type 817 - 6, // [6:6] is the sub-list for extension type_name 818 - 6, // [6:6] is the sub-list for extension extendee 819 - 0, // [0:6] is the sub-list for field type_name 1113 + 16, // 0: gitmirror.v1.CommitLogRequest.after:type_name -> google.protobuf.Timestamp 1114 + 16, // 1: gitmirror.v1.CommitLogRequest.before:type_name -> google.protobuf.Timestamp 1115 + 14, // 2: gitmirror.v1.CommitLogResponse.commits:type_name -> gitmirror.v1.GitCommit 1116 + 5, // 3: gitmirror.v1.CommitsRequest.options:type_name -> gitmirror.v1.CommitsOptions 1117 + 10, // 4: gitmirror.v1.Hunk.lines:type_name -> gitmirror.v1.LinePair 1118 + 9, // 5: gitmirror.v1.FileDiff.lhs_src:type_name -> gitmirror.v1.FileContent 1119 + 9, // 6: gitmirror.v1.FileDiff.rhs_src:type_name -> gitmirror.v1.FileContent 1120 + 11, // 7: gitmirror.v1.FileDiff.hunks:type_name -> gitmirror.v1.Hunk 1121 + 12, // 8: gitmirror.v1.FileDiff.has_byte_changes:type_name -> gitmirror.v1.ByteChanges 1122 + 15, // 9: gitmirror.v1.GitCommit.author:type_name -> gitmirror.v1.GitSignature 1123 + 15, // 10: gitmirror.v1.GitCommit.committer:type_name -> gitmirror.v1.GitSignature 1124 + 16, // 11: gitmirror.v1.GitSignature.date:type_name -> google.protobuf.Timestamp 1125 + 4, // 12: gitmirror.v1.GitMirrorService.Commits:input_type -> gitmirror.v1.CommitsRequest 1126 + 7, // 13: gitmirror.v1.GitMirrorService.Diff:input_type -> gitmirror.v1.DiffRequest 1127 + 8, // 14: gitmirror.v1.GitMirrorService.Interdiff:input_type -> gitmirror.v1.InterdiffRequest 1128 + 0, // 15: gitmirror.v1.GitMirrorService.GetBlob:input_type -> gitmirror.v1.GetBlobRequest 1129 + 1, // 16: gitmirror.v1.GitMirrorService.CommitLog:input_type -> gitmirror.v1.CommitLogRequest 1130 + 6, // 17: gitmirror.v1.GitMirrorService.Commits:output_type -> gitmirror.v1.CommitsResponse 1131 + 13, // 18: gitmirror.v1.GitMirrorService.Diff:output_type -> gitmirror.v1.FileDiff 1132 + 13, // 19: gitmirror.v1.GitMirrorService.Interdiff:output_type -> gitmirror.v1.FileDiff 1133 + 3, // 20: gitmirror.v1.GitMirrorService.GetBlob:output_type -> gitmirror.v1.BlobChunk 1134 + 2, // 21: gitmirror.v1.GitMirrorService.CommitLog:output_type -> gitmirror.v1.CommitLogResponse 1135 + 17, // [17:22] is the sub-list for method output_type 1136 + 12, // [12:17] is the sub-list for method input_type 1137 + 12, // [12:12] is the sub-list for extension type_name 1138 + 12, // [12:12] is the sub-list for extension extendee 1139 + 0, // [0:12] is the sub-list for field type_name 820 1140 } 821 1141 822 1142 func init() { file_gitmirror_v1_gitmirror_proto_init() } ··· 824 1144 if File_gitmirror_v1_gitmirror_proto != nil { 825 1145 return 826 1146 } 827 - file_gitmirror_v1_gitmirror_proto_msgTypes[8].OneofWrappers = []any{} 828 - file_gitmirror_v1_gitmirror_proto_msgTypes[11].OneofWrappers = []any{} 1147 + file_gitmirror_v1_gitmirror_proto_msgTypes[10].OneofWrappers = []any{} 1148 + file_gitmirror_v1_gitmirror_proto_msgTypes[13].OneofWrappers = []any{} 829 1149 type x struct{} 830 1150 out := protoimpl.TypeBuilder{ 831 1151 File: protoimpl.DescBuilder{ 832 1152 GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 833 1153 RawDescriptor: unsafe.Slice(unsafe.StringData(file_gitmirror_v1_gitmirror_proto_rawDesc), len(file_gitmirror_v1_gitmirror_proto_rawDesc)), 834 1154 NumEnums: 0, 835 - NumMessages: 12, 1155 + NumMessages: 16, 836 1156 NumExtensions: 0, 837 1157 NumServices: 1, 838 1158 },
+42 -1
gitmirror/proto/gen/gitmirror_grpc.pb.go
··· 1 1 // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 2 2 // versions: 3 - // - protoc-gen-go-grpc v1.6.0 3 + // - protoc-gen-go-grpc v1.6.2 4 4 // - protoc (unknown) 5 5 // source: gitmirror/v1/gitmirror.proto 6 6 ··· 23 23 GitMirrorService_Diff_FullMethodName = "/gitmirror.v1.GitMirrorService/Diff" 24 24 GitMirrorService_Interdiff_FullMethodName = "/gitmirror.v1.GitMirrorService/Interdiff" 25 25 GitMirrorService_GetBlob_FullMethodName = "/gitmirror.v1.GitMirrorService/GetBlob" 26 + GitMirrorService_CommitLog_FullMethodName = "/gitmirror.v1.GitMirrorService/CommitLog" 26 27 ) 27 28 28 29 // GitMirrorServiceClient is the client API for GitMirrorService service. ··· 34 35 Interdiff(ctx context.Context, in *InterdiffRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[FileDiff], error) 35 36 // GetBlob streams a blob's raw bytes by OID, in chunks. 36 37 GetBlob(ctx context.Context, in *GetBlobRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[BlobChunk], error) 38 + CommitLog(ctx context.Context, in *CommitLogRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[CommitLogResponse], error) 37 39 } 38 40 39 41 type gitMirrorServiceClient struct { ··· 111 113 // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. 112 114 type GitMirrorService_GetBlobClient = grpc.ServerStreamingClient[BlobChunk] 113 115 116 + func (c *gitMirrorServiceClient) CommitLog(ctx context.Context, in *CommitLogRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[CommitLogResponse], error) { 117 + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 118 + stream, err := c.cc.NewStream(ctx, &GitMirrorService_ServiceDesc.Streams[3], GitMirrorService_CommitLog_FullMethodName, cOpts...) 119 + if err != nil { 120 + return nil, err 121 + } 122 + x := &grpc.GenericClientStream[CommitLogRequest, CommitLogResponse]{ClientStream: stream} 123 + if err := x.ClientStream.SendMsg(in); err != nil { 124 + return nil, err 125 + } 126 + if err := x.ClientStream.CloseSend(); err != nil { 127 + return nil, err 128 + } 129 + return x, nil 130 + } 131 + 132 + // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. 133 + type GitMirrorService_CommitLogClient = grpc.ServerStreamingClient[CommitLogResponse] 134 + 114 135 // GitMirrorServiceServer is the server API for GitMirrorService service. 115 136 // All implementations must embed UnimplementedGitMirrorServiceServer 116 137 // for forward compatibility. ··· 120 141 Interdiff(*InterdiffRequest, grpc.ServerStreamingServer[FileDiff]) error 121 142 // GetBlob streams a blob's raw bytes by OID, in chunks. 122 143 GetBlob(*GetBlobRequest, grpc.ServerStreamingServer[BlobChunk]) error 144 + CommitLog(*CommitLogRequest, grpc.ServerStreamingServer[CommitLogResponse]) error 123 145 mustEmbedUnimplementedGitMirrorServiceServer() 124 146 } 125 147 ··· 141 163 } 142 164 func (UnimplementedGitMirrorServiceServer) GetBlob(*GetBlobRequest, grpc.ServerStreamingServer[BlobChunk]) error { 143 165 return status.Error(codes.Unimplemented, "method GetBlob not implemented") 166 + } 167 + func (UnimplementedGitMirrorServiceServer) CommitLog(*CommitLogRequest, grpc.ServerStreamingServer[CommitLogResponse]) error { 168 + return status.Error(codes.Unimplemented, "method CommitLog not implemented") 144 169 } 145 170 func (UnimplementedGitMirrorServiceServer) mustEmbedUnimplementedGitMirrorServiceServer() {} 146 171 func (UnimplementedGitMirrorServiceServer) testEmbeddedByValue() {} ··· 214 239 // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. 215 240 type GitMirrorService_GetBlobServer = grpc.ServerStreamingServer[BlobChunk] 216 241 242 + func _GitMirrorService_CommitLog_Handler(srv interface{}, stream grpc.ServerStream) error { 243 + m := new(CommitLogRequest) 244 + if err := stream.RecvMsg(m); err != nil { 245 + return err 246 + } 247 + return srv.(GitMirrorServiceServer).CommitLog(m, &grpc.GenericServerStream[CommitLogRequest, CommitLogResponse]{ServerStream: stream}) 248 + } 249 + 250 + // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. 251 + type GitMirrorService_CommitLogServer = grpc.ServerStreamingServer[CommitLogResponse] 252 + 217 253 // GitMirrorService_ServiceDesc is the grpc.ServiceDesc for GitMirrorService service. 218 254 // It's only intended for direct use with grpc.RegisterService, 219 255 // and not to be introspected or modified (even as a copy) ··· 240 276 { 241 277 StreamName: "GetBlob", 242 278 Handler: _GitMirrorService_GetBlob_Handler, 279 + ServerStreams: true, 280 + }, 281 + { 282 + StreamName: "CommitLog", 283 + Handler: _GitMirrorService_CommitLog_Handler, 243 284 ServerStreams: true, 244 285 }, 245 286 },
+42
gitmirror/proto/gitmirror/v1/gitmirror.proto
··· 2 2 3 3 package gitmirror.v1; 4 4 5 + import "google/protobuf/timestamp.proto"; 6 + 5 7 option go_package = "tangled.org/core/gitmirror/proto/gen;gitmirrorv1"; 6 8 7 9 service GitMirrorService { ··· 10 12 rpc Interdiff(InterdiffRequest) returns (stream FileDiff); 11 13 // GetBlob streams a blob's raw bytes by OID, in chunks. 12 14 rpc GetBlob(GetBlobRequest) returns (stream BlobChunk); 15 + rpc CommitLog(CommitLogRequest) returns (stream CommitLogResponse); 13 16 } 14 17 15 18 message GetBlobRequest { ··· 17 20 string repo = 1; 18 21 // oid is the blob object id (hex). 19 22 string oid = 2; 23 + } 24 + 25 + message CommitLogRequest { 26 + // repo DID 27 + string repo = 1; 28 + // Ranges to include in the git log (revspec, "A..B", "A...B", etc.). 29 + // At least one range, or all_refs must be specified. 30 + repeated bytes ranges = 2; 31 + // If true, all refs are searched for commits. 32 + // Must not be true when ranges are given. 33 + bool all_refs = 3; 34 + // After is an optional parameter to specify the earliest commit to consider. 35 + google.protobuf.Timestamp after = 4; 36 + // Before is an optional parameter to specify the latest commit to consider. 37 + google.protobuf.Timestamp before = 5; 38 + // MaxCommits is an optional parameter to specify the maximum number of commits 39 + // to return. If max_commits is 0, all commits that match the criteria will be 40 + // returned. 41 + uint32 max_commits = 6; 42 + // Skip is an optional parameter to specify the number of commits to skip. 43 + // This can be used to implement a poor mans pagination. 44 + uint32 skip = 7; 45 + } 46 + message CommitLogResponse { 47 + repeated GitCommit commits = 1; 20 48 } 21 49 22 50 // One chunk of a blob's raw bytes; concatenate in arrival order. ··· 95 123 bool has_syntactic_changes = 5; 96 124 // TODO: lhs_positions / rhs_positions (MatchedPos) — AST, added later. 97 125 } 126 + 127 + message GitCommit { 128 + string oid = 1; 129 + GitSignature author = 2; 130 + GitSignature committer = 3; 131 + bytes message = 4; 132 + repeated string parents = 5; 133 + } 134 + 135 + message GitSignature { 136 + bytes name = 1; 137 + bytes email = 2; 138 + google.protobuf.Timestamp date = 3; 139 + }
+148 -3
gitmirror/src/main.rs
··· 6 6 use tracing::info; 7 7 8 8 mod diff; 9 + mod protocol; 9 10 10 11 pub mod gitmirror { 11 12 pub mod v1 { ··· 18 19 19 20 use gix::bstr::ByteSlice as _; 20 21 use tokio::sync::mpsc; 22 + use tokio_stream::wrappers::ReceiverStream; 21 23 use tokio_stream::Stream; 22 - use tokio_stream::wrappers::ReceiverStream; 24 + 25 + use gix::revision::plumbing::Spec as RevSpec; 26 + use gix::revision::walk::Sorting; 23 27 24 28 use gitmirror::v1::git_mirror_service_server::{GitMirrorService, GitMirrorServiceServer}; 25 29 use gitmirror::v1::{ 26 - BlobChunk, ByteChanges, CommitsRequest, CommitsResponse, DiffRequest, FileContent, FileDiff, 27 - GetBlobRequest, Hunk, InterdiffRequest, LinePair, 30 + BlobChunk, ByteChanges, CommitLogRequest, CommitLogResponse, CommitsRequest, CommitsResponse, 31 + DiffRequest, FileContent, FileDiff, GetBlobRequest, GitCommit, GitSignature, Hunk, 32 + InterdiffRequest, LinePair, 28 33 }; 29 34 30 35 type FileDiffStream = Pin<Box<dyn Stream<Item = Result<FileDiff, Status>> + Send>>; 31 36 type BlobChunkStream = Pin<Box<dyn Stream<Item = Result<BlobChunk, Status>> + Send>>; 37 + type CommitLogResponseStream = Pin<Box<dyn Stream<Item = Result<CommitLogResponse, Status>> + Send>>; 32 38 33 39 /// Blob bytes are streamed in chunks of this size. 34 40 const BLOB_CHUNK_SIZE: usize = 64 * 1024; 41 + /// GitCommits are streamed in batches of this size. 42 + const COMMIT_LOG_BATCH_SIZE: usize = 128; 35 43 36 44 #[derive(Parser)] 37 45 #[command(name = "gitmirror", about = "Git mirror gRPC service")] ··· 57 65 gix::open(self.repo_base.join(did)) 58 66 .map_err(|e| Status::not_found(format!("repo not found: {e}"))) 59 67 } 68 + 69 + } 70 + 71 + /// Resolve tips/hidden commits from a [`CommitLogRequest`] and return the resulting gix walk, 72 + /// sorted newest-first to match `git log`'s default order. 73 + fn commit_log_walk<'repo>( 74 + repo: &'repo gix::Repository, 75 + req: &CommitLogRequest, 76 + ) -> anyhow::Result<gix::revision::Walk<'repo>> { 77 + let mut tips = Vec::new(); 78 + let mut hidden = Vec::new(); 79 + 80 + if req.all_refs { 81 + for r in repo.references()?.all()? { 82 + let mut r = r.map_err(|e| anyhow::anyhow!(e))?; 83 + if let Ok(commit) = r.peel_to_commit() { 84 + tips.push(commit.id); 85 + } 86 + } 87 + } else { 88 + for range in &req.ranges { 89 + let revspec = repo.rev_parse(range.as_bstr())?; 90 + let spec = revspec.detach(); 91 + match spec { 92 + RevSpec::Include(id) => tips.push(id), 93 + RevSpec::Range { from, to } => { 94 + tips.push(to); 95 + hidden.push(from); 96 + } 97 + _ => { 98 + anyhow::bail!("The spec isn't currently supported: {spec:?}") 99 + } 100 + } 101 + } 102 + } 103 + 104 + Ok(repo 105 + .rev_walk(tips) 106 + .sorting(Sorting::ByCommitTime(Default::default())) 107 + .with_hidden(hidden) 108 + .all()?) 60 109 } 61 110 62 111 #[tonic::async_trait] ··· 147 196 148 197 Ok(Response::new(Box::pin(ReceiverStream::new(rx)))) 149 198 } 199 + 200 + type CommitLogStream = CommitLogResponseStream; 201 + 202 + async fn commit_log( 203 + &self, 204 + request: Request<CommitLogRequest>, 205 + ) -> Result<Response<Self::CommitLogStream>, Status> { 206 + let req = request.into_inner(); 207 + if req.all_refs == req.ranges.is_empty() { 208 + return Err(Status::invalid_argument( 209 + "specify exactly one of `ranges` or `all_refs`", 210 + )); 211 + } 212 + let repo = self.open_repo(&req.repo)?; 213 + let safe = repo.into_sync(); 214 + 215 + let (tx, rx) = mpsc::channel::<Result<CommitLogResponse, Status>>(16); 216 + tokio::task::spawn_blocking(move || { 217 + let repo = safe.to_thread_local(); 218 + let run = || -> anyhow::Result<()> { 219 + let after = req.after.map(|t| t.seconds); 220 + let before = req.before.map(|t| t.seconds); 221 + let max_commits = req.max_commits as usize; 222 + let mut skip = req.skip as usize; 223 + let mut sent = 0usize; 224 + let mut batch = Vec::with_capacity(COMMIT_LOG_BATCH_SIZE); 225 + 226 + for info in commit_log_walk(&repo, &req)? { 227 + let info = info?; 228 + let commit_time = info.commit_time(); 229 + if before.is_some_and(|b| commit_time > b) { 230 + continue; 231 + } 232 + if after.is_some_and(|a| commit_time < a) { 233 + break; // newest-first order: nothing older will match either 234 + } 235 + if skip > 0 { 236 + skip -= 1; 237 + continue; 238 + } 239 + if max_commits != 0 && sent >= max_commits { 240 + break; 241 + } 242 + batch.push(GitCommit::try_from(&info.object()?)?); 243 + sent += 1; 244 + if batch.len() == COMMIT_LOG_BATCH_SIZE { 245 + let msg = CommitLogResponse { 246 + commits: std::mem::take(&mut batch), 247 + }; 248 + if tx.blocking_send(Ok(msg)).is_err() { 249 + return Ok(()); // client hung up 250 + } 251 + } 252 + } 253 + if !batch.is_empty() { 254 + let _ = tx.blocking_send(Ok(CommitLogResponse { commits: batch })); 255 + } 256 + Ok(()) 257 + }; 258 + if let Err(e) = run() { 259 + let _ = tx.blocking_send(Err(Status::internal(e.to_string()))); 260 + } 261 + }); 262 + 263 + Ok(Response::new(Box::pin(ReceiverStream::new(rx)))) 264 + } 150 265 } 151 266 152 267 /// Resolve a commit-ish ref string (oid, short oid, branch/tag) to its tree oid. ··· 181 296 size: f.size as u64, 182 297 is_binary: f.is_binary, 183 298 is_submodule: f.is_submodule, 299 + } 300 + } 301 + 302 + impl TryFrom<&gix::Commit<'_>> for GitCommit { 303 + type Error = anyhow::Error; 304 + 305 + fn try_from(commit: &gix::Commit<'_>) -> anyhow::Result<Self> { 306 + Ok(GitCommit { 307 + oid: commit.id.to_string(), 308 + author: Some(commit.author()?.try_into()?), 309 + committer: Some(commit.committer()?.try_into()?), 310 + message: commit.message_raw()?.to_vec(), 311 + parents: commit.parent_ids().map(|id| id.to_string()).collect(), 312 + }) 313 + } 314 + } 315 + 316 + impl TryFrom<gix::actor::SignatureRef<'_>> for GitSignature { 317 + type Error = anyhow::Error; 318 + 319 + fn try_from(sig: gix::actor::SignatureRef<'_>) -> anyhow::Result<Self> { 320 + let time = sig.time()?; 321 + Ok(GitSignature { 322 + name: sig.name.to_vec(), 323 + email: sig.email.to_vec(), 324 + date: Some(prost_types::Timestamp { 325 + seconds: time.seconds, 326 + nanos: 0, 327 + }), 328 + }) 184 329 } 185 330 } 186 331
+3
gitmirror/src/protocol.rs
··· 1 + // pub mod v1 { 2 + // tonic::include_proto!("gitmirror.v1"); 3 + // }