add commit details to webhook payload (#175)

This commit is contained in:
Johannes Batzill 2023-01-11 10:51:28 -08:00 committed by GitHub
parent 927e8a7e8c
commit d1dd518b3f
16 changed files with 771 additions and 400 deletions

View File

@ -124,7 +124,7 @@ func initSystem(ctx context.Context, config *types.Config) (*system, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
webhookServer, err := webhook.ProvideServer(ctx, webhookConfig, readerFactory, webhookStore, webhookExecutionStore, repoStore, provider, principalStore) webhookServer, err := webhook.ProvideServer(ctx, webhookConfig, readerFactory, webhookStore, webhookExecutionStore, repoStore, provider, principalStore, gitrpcInterface)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -85,7 +85,7 @@ func initSystem(ctx context.Context, config *types.Config) (*system, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
webhookServer, err := webhook.ProvideServer(ctx, webhookConfig, readerFactory, webhookStore, webhookExecutionStore, repoStore, provider, principalStore) webhookServer, err := webhook.ProvideServer(ctx, webhookConfig, readerFactory, webhookStore, webhookExecutionStore, repoStore, provider, principalStore, gitrpcInterface)
if err != nil { if err != nil {
return nil, err return nil, err
} }

199
gitrpc/commit.go Normal file
View File

@ -0,0 +1,199 @@
// Copyright 2022 Harness Inc. All rights reserved.
// Use of this source code is governed by the Polyform Free Trial License
// that can be found in the LICENSE.md file for this repository.
package gitrpc
import (
"context"
"errors"
"fmt"
"io"
"time"
"github.com/harness/gitness/gitrpc/rpc"
"github.com/rs/zerolog/log"
)
type GetCommitParams struct {
ReadParams
// SHA is the git commit sha
SHA string
}
type GetCommitOutput struct {
Commit Commit
}
type Commit struct {
SHA string
Title string
Message string
Author Signature
Committer Signature
}
type Signature struct {
Identity Identity
When time.Time
}
type Identity struct {
Name string
Email string
}
func (c *Client) GetCommit(ctx context.Context, params *GetCommitParams) (*GetCommitOutput, error) {
if params == nil {
return nil, ErrNoParamsProvided
}
result, err := c.repoService.GetCommit(ctx, &rpc.GetCommitRequest{
Base: mapToRPCReadRequest(params.ReadParams),
Sha: params.SHA,
})
if err != nil {
return nil, fmt.Errorf("failed to get commit: %w", err)
}
commit, err := mapRPCCommit(result.GetCommit())
if err != nil {
return nil, fmt.Errorf("failed to map rpc commit: %w", err)
}
return &GetCommitOutput{
Commit: *commit,
}, nil
}
type ListCommitsParams struct {
ReadParams
// GitREF is a git reference (branch / tag / commit SHA)
GitREF string
// After is a git reference (branch / tag / commit SHA)
// If provided, commits only up to that reference will be returned (exlusive)
After string
Page int32
Limit int32
}
type ListCommitsOutput struct {
Commits []Commit
}
func (c *Client) ListCommits(ctx context.Context, params *ListCommitsParams) (*ListCommitsOutput, error) {
if params == nil {
return nil, ErrNoParamsProvided
}
stream, err := c.repoService.ListCommits(ctx, &rpc.ListCommitsRequest{
Base: mapToRPCReadRequest(params.ReadParams),
GitRef: params.GitREF,
After: params.After,
Page: params.Page,
Limit: params.Limit,
})
if err != nil {
return nil, fmt.Errorf("failed to start stream for commits: %w", err)
}
// NOTE: don't use PageSize as initial slice capacity - as that theoretically could be MaxInt
output := &ListCommitsOutput{
Commits: make([]Commit, 0, 16),
}
for {
var next *rpc.ListCommitsResponse
next, err = stream.Recv()
if errors.Is(err, io.EOF) {
log.Ctx(ctx).Debug().Msg("received end of stream")
break
}
if err != nil {
return nil, processRPCErrorf(err, "received unexpected error from server")
}
if next.GetCommit() == nil {
return nil, fmt.Errorf("expected commit message")
}
var commit *Commit
commit, err = mapRPCCommit(next.GetCommit())
if err != nil {
return nil, fmt.Errorf("failed to map rpc commit: %w", err)
}
output.Commits = append(output.Commits, *commit)
}
return output, nil
}
type GetCommitDivergencesParams struct {
ReadParams
MaxCount int32
Requests []CommitDivergenceRequest
}
type GetCommitDivergencesOutput struct {
Divergences []CommitDivergence
}
// CommitDivergenceRequest contains the refs for which the converging commits should be counted.
type CommitDivergenceRequest struct {
// From is the ref from which the counting of the diverging commits starts.
From string
// To is the ref at which the counting of the diverging commits ends.
To string
}
// CommitDivergence contains the information of the count of converging commits between two refs.
type CommitDivergence struct {
// Ahead is the count of commits the 'From' ref is ahead of the 'To' ref.
Ahead int32
// Behind is the count of commits the 'From' ref is behind the 'To' ref.
Behind int32
}
func (c *Client) GetCommitDivergences(ctx context.Context,
params *GetCommitDivergencesParams) (*GetCommitDivergencesOutput, error) {
if params == nil {
return nil, ErrNoParamsProvided
}
// build rpc request
req := &rpc.GetCommitDivergencesRequest{
Base: mapToRPCReadRequest(params.ReadParams),
MaxCount: params.MaxCount,
Requests: make([]*rpc.CommitDivergenceRequest, len(params.Requests)),
}
for i := range params.Requests {
req.Requests[i] = &rpc.CommitDivergenceRequest{
From: params.Requests[i].From,
To: params.Requests[i].To,
}
}
resp, err := c.repoService.GetCommitDivergences(ctx, req)
if err != nil {
return nil, processRPCErrorf(err, "failed to get diverging commits from server")
}
divergences := resp.GetDivergences()
if divergences == nil {
return nil, fmt.Errorf("server response divergences were nil")
}
// build output
output := &GetCommitDivergencesOutput{
Divergences: make([]CommitDivergence, len(divergences)),
}
for i := range divergences {
if divergences[i] == nil {
return nil, fmt.Errorf("server returned nil divergence")
}
output.Divergences[i] = CommitDivergence{
Ahead: divergences[i].Ahead,
Behind: divergences[i].Behind,
}
}
return output, nil
}

View File

@ -23,6 +23,7 @@ type Interface interface {
/* /*
* Commits service * Commits service
*/ */
GetCommit(ctx context.Context, params *GetCommitParams) (*GetCommitOutput, error)
ListCommits(ctx context.Context, params *ListCommitsParams) (*ListCommitsOutput, error) ListCommits(ctx context.Context, params *ListCommitsParams) (*ListCommitsOutput, error)
ListCommitTags(ctx context.Context, params *ListCommitTagsParams) (*ListCommitTagsOutput, error) ListCommitTags(ctx context.Context, params *ListCommitTagsParams) (*ListCommitTagsOutput, error)
GetCommitDivergences(ctx context.Context, params *GetCommitDivergencesParams) (*GetCommitDivergencesOutput, error) GetCommitDivergences(ctx context.Context, params *GetCommitDivergencesParams) (*GetCommitDivergencesOutput, error)

View File

@ -15,6 +15,36 @@ import (
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
) )
func (s RepositoryService) GetCommit(ctx context.Context,
request *rpc.GetCommitRequest) (*rpc.GetCommitResponse, error) {
base := request.GetBase()
if base == nil {
return nil, types.ErrBaseCannotBeEmpty
}
// ensure the provided SHA is valid (and not a reference)
sha := request.GetSha()
if !isValidGitSHA(sha) {
return nil, status.Errorf(codes.InvalidArgument, "the provided commit sha '%s' is of invalid format.", sha)
}
repoPath := getFullPathForRepo(s.reposRoot, base.GetRepoUid())
gitCommit, err := s.adapter.GetCommit(ctx, repoPath, sha)
if err != nil {
return nil, processGitErrorf(err, "failed to get commit")
}
commit, err := mapGitCommit(gitCommit)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to map git commit: %v", err)
}
return &rpc.GetCommitResponse{
Commit: commit,
}, nil
}
func (s RepositoryService) ListCommits(request *rpc.ListCommitsRequest, func (s RepositoryService) ListCommits(request *rpc.ListCommitsRequest,
stream rpc.RepositoryService_ListCommitsServer) error { stream rpc.RepositoryService_ListCommitsServer) error {
base := request.GetBase() base := request.GetBase()

View File

@ -12,6 +12,7 @@ import (
"io" "io"
"os" "os"
"path" "path"
"regexp"
"github.com/harness/gitness/gitrpc/internal/types" "github.com/harness/gitness/gitrpc/internal/types"
"github.com/harness/gitness/gitrpc/rpc" "github.com/harness/gitness/gitrpc/rpc"
@ -39,6 +40,11 @@ var (
} }
gitServerHookNames = []string{"pre-receive", "update", "post-receive"} gitServerHookNames = []string{"pre-receive", "update", "post-receive"}
// gitSHARegex defines the valid SHA format accepted by GIT (full form and short forms).
// Note: as of now SHA is at most 40 characters long, but in the future it's moving to sha256
// which is 64 chars - keep this forward-compatible.
gitSHARegex = regexp.MustCompile("^[0-9a-f]{4,64}$")
) )
type Storage interface { type Storage interface {
@ -176,3 +182,8 @@ func (s RepositoryService) CreateRepository(stream rpc.RepositoryService_CreateR
log.Info().Msgf("repository created. Path: %s", repoPath) log.Info().Msgf("repository created. Path: %s", repoPath)
return nil return nil
} }
// isValidGitSHA returns true iff the provided string is a valid git sha (short or long form).
func isValidGitSHA(sha string) bool {
return gitSHARegex.MatchString(sha)
}

View File

@ -11,163 +11,10 @@ import (
"errors" "errors"
"fmt" "fmt"
"io" "io"
"time"
"github.com/harness/gitness/gitrpc/rpc" "github.com/harness/gitness/gitrpc/rpc"
"github.com/rs/zerolog/log"
) )
type ListCommitsParams struct {
ReadParams
// GitREF is a git reference (branch / tag / commit SHA)
GitREF string
// After is a git reference (branch / tag / commit SHA)
// If provided, commits only up to that reference will be returned (exlusive)
After string
Page int32
Limit int32
}
type ListCommitsOutput struct {
Commits []Commit
}
type Commit struct {
SHA string
Title string
Message string
Author Signature
Committer Signature
}
type Signature struct {
Identity Identity
When time.Time
}
type Identity struct {
Name string
Email string
}
func (c *Client) ListCommits(ctx context.Context, params *ListCommitsParams) (*ListCommitsOutput, error) {
if params == nil {
return nil, ErrNoParamsProvided
}
stream, err := c.repoService.ListCommits(ctx, &rpc.ListCommitsRequest{
Base: mapToRPCReadRequest(params.ReadParams),
GitRef: params.GitREF,
After: params.After,
Page: params.Page,
Limit: params.Limit,
})
if err != nil {
return nil, fmt.Errorf("failed to start stream for commits: %w", err)
}
// NOTE: don't use PageSize as initial slice capacity - as that theoretically could be MaxInt
output := &ListCommitsOutput{
Commits: make([]Commit, 0, 16),
}
for {
var next *rpc.ListCommitsResponse
next, err = stream.Recv()
if errors.Is(err, io.EOF) {
log.Ctx(ctx).Debug().Msg("received end of stream")
break
}
if err != nil {
return nil, processRPCErrorf(err, "received unexpected error from server")
}
if next.GetCommit() == nil {
return nil, fmt.Errorf("expected commit message")
}
var commit *Commit
commit, err = mapRPCCommit(next.GetCommit())
if err != nil {
return nil, fmt.Errorf("failed to map rpc commit: %w", err)
}
output.Commits = append(output.Commits, *commit)
}
return output, nil
}
type GetCommitDivergencesParams struct {
ReadParams
MaxCount int32
Requests []CommitDivergenceRequest
}
type GetCommitDivergencesOutput struct {
Divergences []CommitDivergence
}
// CommitDivergenceRequest contains the refs for which the converging commits should be counted.
type CommitDivergenceRequest struct {
// From is the ref from which the counting of the diverging commits starts.
From string
// To is the ref at which the counting of the diverging commits ends.
To string
}
// CommitDivergence contains the information of the count of converging commits between two refs.
type CommitDivergence struct {
// Ahead is the count of commits the 'From' ref is ahead of the 'To' ref.
Ahead int32
// Behind is the count of commits the 'From' ref is behind the 'To' ref.
Behind int32
}
func (c *Client) GetCommitDivergences(ctx context.Context,
params *GetCommitDivergencesParams) (*GetCommitDivergencesOutput, error) {
if params == nil {
return nil, ErrNoParamsProvided
}
// build rpc request
req := &rpc.GetCommitDivergencesRequest{
Base: mapToRPCReadRequest(params.ReadParams),
MaxCount: params.MaxCount,
Requests: make([]*rpc.CommitDivergenceRequest, len(params.Requests)),
}
for i := range params.Requests {
req.Requests[i] = &rpc.CommitDivergenceRequest{
From: params.Requests[i].From,
To: params.Requests[i].To,
}
}
resp, err := c.repoService.GetCommitDivergences(ctx, req)
if err != nil {
return nil, processRPCErrorf(err, "failed to get diverging commits from server")
}
divergences := resp.GetDivergences()
if divergences == nil {
return nil, fmt.Errorf("server response divergences were nil")
}
// build output
output := &GetCommitDivergencesOutput{
Divergences: make([]CommitDivergence, len(divergences)),
}
for i := range divergences {
if divergences[i] == nil {
return nil, fmt.Errorf("server returned nil divergence")
}
output.Divergences[i] = CommitDivergence{
Ahead: divergences[i].Ahead,
Behind: divergences[i].Behind,
}
}
return output, nil
}
type FileAction string type FileAction string
const ( const (

View File

@ -13,6 +13,7 @@ service RepositoryService {
rpc GetSubmodule(GetSubmoduleRequest) returns (GetSubmoduleResponse); rpc GetSubmodule(GetSubmoduleRequest) returns (GetSubmoduleResponse);
rpc GetBlob(GetBlobRequest) returns (GetBlobResponse); rpc GetBlob(GetBlobRequest) returns (GetBlobResponse);
rpc ListCommits(ListCommitsRequest) returns (stream ListCommitsResponse); rpc ListCommits(ListCommitsRequest) returns (stream ListCommitsResponse);
rpc GetCommit(GetCommitRequest) returns (GetCommitResponse);
rpc GetCommitDivergences(GetCommitDivergencesRequest) returns (GetCommitDivergencesResponse); rpc GetCommitDivergences(GetCommitDivergencesRequest) returns (GetCommitDivergencesResponse);
} }
@ -77,6 +78,15 @@ enum TreeNodeMode {
TreeNodeModeCommit = 4; TreeNodeModeCommit = 4;
} }
message GetCommitRequest {
ReadRequest base = 1;
string sha = 2;
}
message GetCommitResponse {
Commit commit = 1;
}
message ListCommitsRequest { message ListCommitsRequest {
ReadRequest base = 1; ReadRequest base = 1;
string git_ref = 2; string git_ref = 2;

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.1 // protoc-gen-go v1.28.1
// protoc v3.21.9 // protoc v3.21.11
// source: repo.proto // source: repo.proto
package rpc package rpc
@ -130,7 +130,6 @@ type CreateRepositoryRequest struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// Types that are assignable to Data: // Types that are assignable to Data:
//
// *CreateRepositoryRequest_Header // *CreateRepositoryRequest_Header
// *CreateRepositoryRequest_File // *CreateRepositoryRequest_File
Data isCreateRepositoryRequest_Data `protobuf_oneof:"data"` Data isCreateRepositoryRequest_Data `protobuf_oneof:"data"`
@ -637,6 +636,108 @@ func (x *TreeNode) GetPath() string {
return "" return ""
} }
type GetCommitRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Base *ReadRequest `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
Sha string `protobuf:"bytes,2,opt,name=sha,proto3" json:"sha,omitempty"`
}
func (x *GetCommitRequest) Reset() {
*x = GetCommitRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_repo_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetCommitRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetCommitRequest) ProtoMessage() {}
func (x *GetCommitRequest) ProtoReflect() protoreflect.Message {
mi := &file_repo_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetCommitRequest.ProtoReflect.Descriptor instead.
func (*GetCommitRequest) Descriptor() ([]byte, []int) {
return file_repo_proto_rawDescGZIP(), []int{8}
}
func (x *GetCommitRequest) GetBase() *ReadRequest {
if x != nil {
return x.Base
}
return nil
}
func (x *GetCommitRequest) GetSha() string {
if x != nil {
return x.Sha
}
return ""
}
type GetCommitResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Commit *Commit `protobuf:"bytes,1,opt,name=commit,proto3" json:"commit,omitempty"`
}
func (x *GetCommitResponse) Reset() {
*x = GetCommitResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_repo_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetCommitResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetCommitResponse) ProtoMessage() {}
func (x *GetCommitResponse) ProtoReflect() protoreflect.Message {
mi := &file_repo_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetCommitResponse.ProtoReflect.Descriptor instead.
func (*GetCommitResponse) Descriptor() ([]byte, []int) {
return file_repo_proto_rawDescGZIP(), []int{9}
}
func (x *GetCommitResponse) GetCommit() *Commit {
if x != nil {
return x.Commit
}
return nil
}
type ListCommitsRequest struct { type ListCommitsRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -652,7 +753,7 @@ type ListCommitsRequest struct {
func (x *ListCommitsRequest) Reset() { func (x *ListCommitsRequest) Reset() {
*x = ListCommitsRequest{} *x = ListCommitsRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_repo_proto_msgTypes[8] mi := &file_repo_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -665,7 +766,7 @@ func (x *ListCommitsRequest) String() string {
func (*ListCommitsRequest) ProtoMessage() {} func (*ListCommitsRequest) ProtoMessage() {}
func (x *ListCommitsRequest) ProtoReflect() protoreflect.Message { func (x *ListCommitsRequest) ProtoReflect() protoreflect.Message {
mi := &file_repo_proto_msgTypes[8] mi := &file_repo_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -678,7 +779,7 @@ func (x *ListCommitsRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListCommitsRequest.ProtoReflect.Descriptor instead. // Deprecated: Use ListCommitsRequest.ProtoReflect.Descriptor instead.
func (*ListCommitsRequest) Descriptor() ([]byte, []int) { func (*ListCommitsRequest) Descriptor() ([]byte, []int) {
return file_repo_proto_rawDescGZIP(), []int{8} return file_repo_proto_rawDescGZIP(), []int{10}
} }
func (x *ListCommitsRequest) GetBase() *ReadRequest { func (x *ListCommitsRequest) GetBase() *ReadRequest {
@ -727,7 +828,7 @@ type ListCommitsResponse struct {
func (x *ListCommitsResponse) Reset() { func (x *ListCommitsResponse) Reset() {
*x = ListCommitsResponse{} *x = ListCommitsResponse{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_repo_proto_msgTypes[9] mi := &file_repo_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -740,7 +841,7 @@ func (x *ListCommitsResponse) String() string {
func (*ListCommitsResponse) ProtoMessage() {} func (*ListCommitsResponse) ProtoMessage() {}
func (x *ListCommitsResponse) ProtoReflect() protoreflect.Message { func (x *ListCommitsResponse) ProtoReflect() protoreflect.Message {
mi := &file_repo_proto_msgTypes[9] mi := &file_repo_proto_msgTypes[11]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -753,7 +854,7 @@ func (x *ListCommitsResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListCommitsResponse.ProtoReflect.Descriptor instead. // Deprecated: Use ListCommitsResponse.ProtoReflect.Descriptor instead.
func (*ListCommitsResponse) Descriptor() ([]byte, []int) { func (*ListCommitsResponse) Descriptor() ([]byte, []int) {
return file_repo_proto_rawDescGZIP(), []int{9} return file_repo_proto_rawDescGZIP(), []int{11}
} }
func (x *ListCommitsResponse) GetCommit() *Commit { func (x *ListCommitsResponse) GetCommit() *Commit {
@ -776,7 +877,7 @@ type GetBlobRequest struct {
func (x *GetBlobRequest) Reset() { func (x *GetBlobRequest) Reset() {
*x = GetBlobRequest{} *x = GetBlobRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_repo_proto_msgTypes[10] mi := &file_repo_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -789,7 +890,7 @@ func (x *GetBlobRequest) String() string {
func (*GetBlobRequest) ProtoMessage() {} func (*GetBlobRequest) ProtoMessage() {}
func (x *GetBlobRequest) ProtoReflect() protoreflect.Message { func (x *GetBlobRequest) ProtoReflect() protoreflect.Message {
mi := &file_repo_proto_msgTypes[10] mi := &file_repo_proto_msgTypes[12]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -802,7 +903,7 @@ func (x *GetBlobRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetBlobRequest.ProtoReflect.Descriptor instead. // Deprecated: Use GetBlobRequest.ProtoReflect.Descriptor instead.
func (*GetBlobRequest) Descriptor() ([]byte, []int) { func (*GetBlobRequest) Descriptor() ([]byte, []int) {
return file_repo_proto_rawDescGZIP(), []int{10} return file_repo_proto_rawDescGZIP(), []int{12}
} }
func (x *GetBlobRequest) GetBase() *ReadRequest { func (x *GetBlobRequest) GetBase() *ReadRequest {
@ -837,7 +938,7 @@ type GetBlobResponse struct {
func (x *GetBlobResponse) Reset() { func (x *GetBlobResponse) Reset() {
*x = GetBlobResponse{} *x = GetBlobResponse{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_repo_proto_msgTypes[11] mi := &file_repo_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -850,7 +951,7 @@ func (x *GetBlobResponse) String() string {
func (*GetBlobResponse) ProtoMessage() {} func (*GetBlobResponse) ProtoMessage() {}
func (x *GetBlobResponse) ProtoReflect() protoreflect.Message { func (x *GetBlobResponse) ProtoReflect() protoreflect.Message {
mi := &file_repo_proto_msgTypes[11] mi := &file_repo_proto_msgTypes[13]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -863,7 +964,7 @@ func (x *GetBlobResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetBlobResponse.ProtoReflect.Descriptor instead. // Deprecated: Use GetBlobResponse.ProtoReflect.Descriptor instead.
func (*GetBlobResponse) Descriptor() ([]byte, []int) { func (*GetBlobResponse) Descriptor() ([]byte, []int) {
return file_repo_proto_rawDescGZIP(), []int{11} return file_repo_proto_rawDescGZIP(), []int{13}
} }
func (x *GetBlobResponse) GetBlob() *Blob { func (x *GetBlobResponse) GetBlob() *Blob {
@ -886,7 +987,7 @@ type Blob struct {
func (x *Blob) Reset() { func (x *Blob) Reset() {
*x = Blob{} *x = Blob{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_repo_proto_msgTypes[12] mi := &file_repo_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -899,7 +1000,7 @@ func (x *Blob) String() string {
func (*Blob) ProtoMessage() {} func (*Blob) ProtoMessage() {}
func (x *Blob) ProtoReflect() protoreflect.Message { func (x *Blob) ProtoReflect() protoreflect.Message {
mi := &file_repo_proto_msgTypes[12] mi := &file_repo_proto_msgTypes[14]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -912,7 +1013,7 @@ func (x *Blob) ProtoReflect() protoreflect.Message {
// Deprecated: Use Blob.ProtoReflect.Descriptor instead. // Deprecated: Use Blob.ProtoReflect.Descriptor instead.
func (*Blob) Descriptor() ([]byte, []int) { func (*Blob) Descriptor() ([]byte, []int) {
return file_repo_proto_rawDescGZIP(), []int{12} return file_repo_proto_rawDescGZIP(), []int{14}
} }
func (x *Blob) GetSha() string { func (x *Blob) GetSha() string {
@ -949,7 +1050,7 @@ type GetSubmoduleRequest struct {
func (x *GetSubmoduleRequest) Reset() { func (x *GetSubmoduleRequest) Reset() {
*x = GetSubmoduleRequest{} *x = GetSubmoduleRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_repo_proto_msgTypes[13] mi := &file_repo_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -962,7 +1063,7 @@ func (x *GetSubmoduleRequest) String() string {
func (*GetSubmoduleRequest) ProtoMessage() {} func (*GetSubmoduleRequest) ProtoMessage() {}
func (x *GetSubmoduleRequest) ProtoReflect() protoreflect.Message { func (x *GetSubmoduleRequest) ProtoReflect() protoreflect.Message {
mi := &file_repo_proto_msgTypes[13] mi := &file_repo_proto_msgTypes[15]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -975,7 +1076,7 @@ func (x *GetSubmoduleRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetSubmoduleRequest.ProtoReflect.Descriptor instead. // Deprecated: Use GetSubmoduleRequest.ProtoReflect.Descriptor instead.
func (*GetSubmoduleRequest) Descriptor() ([]byte, []int) { func (*GetSubmoduleRequest) Descriptor() ([]byte, []int) {
return file_repo_proto_rawDescGZIP(), []int{13} return file_repo_proto_rawDescGZIP(), []int{15}
} }
func (x *GetSubmoduleRequest) GetBase() *ReadRequest { func (x *GetSubmoduleRequest) GetBase() *ReadRequest {
@ -1010,7 +1111,7 @@ type GetSubmoduleResponse struct {
func (x *GetSubmoduleResponse) Reset() { func (x *GetSubmoduleResponse) Reset() {
*x = GetSubmoduleResponse{} *x = GetSubmoduleResponse{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_repo_proto_msgTypes[14] mi := &file_repo_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -1023,7 +1124,7 @@ func (x *GetSubmoduleResponse) String() string {
func (*GetSubmoduleResponse) ProtoMessage() {} func (*GetSubmoduleResponse) ProtoMessage() {}
func (x *GetSubmoduleResponse) ProtoReflect() protoreflect.Message { func (x *GetSubmoduleResponse) ProtoReflect() protoreflect.Message {
mi := &file_repo_proto_msgTypes[14] mi := &file_repo_proto_msgTypes[16]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -1036,7 +1137,7 @@ func (x *GetSubmoduleResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetSubmoduleResponse.ProtoReflect.Descriptor instead. // Deprecated: Use GetSubmoduleResponse.ProtoReflect.Descriptor instead.
func (*GetSubmoduleResponse) Descriptor() ([]byte, []int) { func (*GetSubmoduleResponse) Descriptor() ([]byte, []int) {
return file_repo_proto_rawDescGZIP(), []int{14} return file_repo_proto_rawDescGZIP(), []int{16}
} }
func (x *GetSubmoduleResponse) GetSubmodule() *Submodule { func (x *GetSubmoduleResponse) GetSubmodule() *Submodule {
@ -1058,7 +1159,7 @@ type Submodule struct {
func (x *Submodule) Reset() { func (x *Submodule) Reset() {
*x = Submodule{} *x = Submodule{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_repo_proto_msgTypes[15] mi := &file_repo_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -1071,7 +1172,7 @@ func (x *Submodule) String() string {
func (*Submodule) ProtoMessage() {} func (*Submodule) ProtoMessage() {}
func (x *Submodule) ProtoReflect() protoreflect.Message { func (x *Submodule) ProtoReflect() protoreflect.Message {
mi := &file_repo_proto_msgTypes[15] mi := &file_repo_proto_msgTypes[17]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -1084,7 +1185,7 @@ func (x *Submodule) ProtoReflect() protoreflect.Message {
// Deprecated: Use Submodule.ProtoReflect.Descriptor instead. // Deprecated: Use Submodule.ProtoReflect.Descriptor instead.
func (*Submodule) Descriptor() ([]byte, []int) { func (*Submodule) Descriptor() ([]byte, []int) {
return file_repo_proto_rawDescGZIP(), []int{15} return file_repo_proto_rawDescGZIP(), []int{17}
} }
func (x *Submodule) GetName() string { func (x *Submodule) GetName() string {
@ -1114,7 +1215,7 @@ type GetCommitDivergencesRequest struct {
func (x *GetCommitDivergencesRequest) Reset() { func (x *GetCommitDivergencesRequest) Reset() {
*x = GetCommitDivergencesRequest{} *x = GetCommitDivergencesRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_repo_proto_msgTypes[16] mi := &file_repo_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -1127,7 +1228,7 @@ func (x *GetCommitDivergencesRequest) String() string {
func (*GetCommitDivergencesRequest) ProtoMessage() {} func (*GetCommitDivergencesRequest) ProtoMessage() {}
func (x *GetCommitDivergencesRequest) ProtoReflect() protoreflect.Message { func (x *GetCommitDivergencesRequest) ProtoReflect() protoreflect.Message {
mi := &file_repo_proto_msgTypes[16] mi := &file_repo_proto_msgTypes[18]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -1140,7 +1241,7 @@ func (x *GetCommitDivergencesRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetCommitDivergencesRequest.ProtoReflect.Descriptor instead. // Deprecated: Use GetCommitDivergencesRequest.ProtoReflect.Descriptor instead.
func (*GetCommitDivergencesRequest) Descriptor() ([]byte, []int) { func (*GetCommitDivergencesRequest) Descriptor() ([]byte, []int) {
return file_repo_proto_rawDescGZIP(), []int{16} return file_repo_proto_rawDescGZIP(), []int{18}
} }
func (x *GetCommitDivergencesRequest) GetBase() *ReadRequest { func (x *GetCommitDivergencesRequest) GetBase() *ReadRequest {
@ -1176,7 +1277,7 @@ type CommitDivergenceRequest struct {
func (x *CommitDivergenceRequest) Reset() { func (x *CommitDivergenceRequest) Reset() {
*x = CommitDivergenceRequest{} *x = CommitDivergenceRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_repo_proto_msgTypes[17] mi := &file_repo_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -1189,7 +1290,7 @@ func (x *CommitDivergenceRequest) String() string {
func (*CommitDivergenceRequest) ProtoMessage() {} func (*CommitDivergenceRequest) ProtoMessage() {}
func (x *CommitDivergenceRequest) ProtoReflect() protoreflect.Message { func (x *CommitDivergenceRequest) ProtoReflect() protoreflect.Message {
mi := &file_repo_proto_msgTypes[17] mi := &file_repo_proto_msgTypes[19]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -1202,7 +1303,7 @@ func (x *CommitDivergenceRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use CommitDivergenceRequest.ProtoReflect.Descriptor instead. // Deprecated: Use CommitDivergenceRequest.ProtoReflect.Descriptor instead.
func (*CommitDivergenceRequest) Descriptor() ([]byte, []int) { func (*CommitDivergenceRequest) Descriptor() ([]byte, []int) {
return file_repo_proto_rawDescGZIP(), []int{17} return file_repo_proto_rawDescGZIP(), []int{19}
} }
func (x *CommitDivergenceRequest) GetFrom() string { func (x *CommitDivergenceRequest) GetFrom() string {
@ -1230,7 +1331,7 @@ type GetCommitDivergencesResponse struct {
func (x *GetCommitDivergencesResponse) Reset() { func (x *GetCommitDivergencesResponse) Reset() {
*x = GetCommitDivergencesResponse{} *x = GetCommitDivergencesResponse{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_repo_proto_msgTypes[18] mi := &file_repo_proto_msgTypes[20]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -1243,7 +1344,7 @@ func (x *GetCommitDivergencesResponse) String() string {
func (*GetCommitDivergencesResponse) ProtoMessage() {} func (*GetCommitDivergencesResponse) ProtoMessage() {}
func (x *GetCommitDivergencesResponse) ProtoReflect() protoreflect.Message { func (x *GetCommitDivergencesResponse) ProtoReflect() protoreflect.Message {
mi := &file_repo_proto_msgTypes[18] mi := &file_repo_proto_msgTypes[20]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -1256,7 +1357,7 @@ func (x *GetCommitDivergencesResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetCommitDivergencesResponse.ProtoReflect.Descriptor instead. // Deprecated: Use GetCommitDivergencesResponse.ProtoReflect.Descriptor instead.
func (*GetCommitDivergencesResponse) Descriptor() ([]byte, []int) { func (*GetCommitDivergencesResponse) Descriptor() ([]byte, []int) {
return file_repo_proto_rawDescGZIP(), []int{18} return file_repo_proto_rawDescGZIP(), []int{20}
} }
func (x *GetCommitDivergencesResponse) GetDivergences() []*CommitDivergence { func (x *GetCommitDivergencesResponse) GetDivergences() []*CommitDivergence {
@ -1278,7 +1379,7 @@ type CommitDivergence struct {
func (x *CommitDivergence) Reset() { func (x *CommitDivergence) Reset() {
*x = CommitDivergence{} *x = CommitDivergence{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_repo_proto_msgTypes[19] mi := &file_repo_proto_msgTypes[21]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -1291,7 +1392,7 @@ func (x *CommitDivergence) String() string {
func (*CommitDivergence) ProtoMessage() {} func (*CommitDivergence) ProtoMessage() {}
func (x *CommitDivergence) ProtoReflect() protoreflect.Message { func (x *CommitDivergence) ProtoReflect() protoreflect.Message {
mi := &file_repo_proto_msgTypes[19] mi := &file_repo_proto_msgTypes[21]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -1304,7 +1405,7 @@ func (x *CommitDivergence) ProtoReflect() protoreflect.Message {
// Deprecated: Use CommitDivergence.ProtoReflect.Descriptor instead. // Deprecated: Use CommitDivergence.ProtoReflect.Descriptor instead.
func (*CommitDivergence) Descriptor() ([]byte, []int) { func (*CommitDivergence) Descriptor() ([]byte, []int) {
return file_repo_proto_rawDescGZIP(), []int{19} return file_repo_proto_rawDescGZIP(), []int{21}
} }
func (x *CommitDivergence) GetAhead() int32 { func (x *CommitDivergence) GetAhead() int32 {
@ -1386,121 +1487,133 @@ var file_repo_proto_rawDesc = []byte{
0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x68, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x68, 0x61, 0x12, 0x12, 0x0a, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x70, 0x61, 0x74, 0x68, 0x22, 0x93, 0x01, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x68, 0x22, 0x4a, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69,
0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x04, 0x62, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x04, 0x62, 0x61, 0x73, 0x65,
0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e,
0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x04, 0x62, 0x61, 0x73,
0x65, 0x12, 0x17, 0x0a, 0x07, 0x67, 0x69, 0x74, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x06, 0x67, 0x69, 0x74, 0x52, 0x65, 0x66, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x66,
0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x66, 0x74, 0x65, 0x72,
0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04,
0x70, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x05, 0x20,
0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x3a, 0x0a, 0x13, 0x4c, 0x69,
0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x23, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x0b, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x06,
0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x22, 0x66, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f,
0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x04, 0x62, 0x61, 0x73, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x61,
0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x04, 0x62, 0x61, 0x73, 0x65, 0x12, 0x10, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x04, 0x62, 0x61, 0x73, 0x65, 0x12, 0x10,
0x0a, 0x03, 0x73, 0x68, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x68, 0x61, 0x0a, 0x03, 0x73, 0x68, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x68, 0x61,
0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x7a, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x22, 0x38, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73,
0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x69, 0x7a, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x30, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18,
0x0a, 0x0f, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6d, 0x6d,
0x65, 0x12, 0x1d, 0x0a, 0x04, 0x62, 0x6c, 0x6f, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x69, 0x74, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x22, 0x93, 0x01, 0x0a, 0x12, 0x4c,
0x09, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x42, 0x6c, 0x6f, 0x62, 0x52, 0x04, 0x62, 0x6c, 0x6f, 0x62, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x22, 0x46, 0x0a, 0x04, 0x42, 0x6c, 0x6f, 0x62, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x68, 0x61, 0x18, 0x74, 0x12, 0x24, 0x0a, 0x04, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x68, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x18, 0x74, 0x52, 0x04, 0x62, 0x61, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x67, 0x69, 0x74, 0x5f, 0x72,
0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x65, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x67, 0x69, 0x74, 0x52, 0x65, 0x66,
0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x68, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x53, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x66, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x05, 0x61, 0x66, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x04,
0x24, 0x0a, 0x04, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69,
0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x6d, 0x69, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74,
0x04, 0x62, 0x61, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x67, 0x69, 0x74, 0x5f, 0x72, 0x65, 0x66, 0x22, 0x3a, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x52,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x67, 0x69, 0x74, 0x52, 0x65, 0x66, 0x12, 0x12, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69,
0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f,
0x74, 0x68, 0x22, 0x44, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x22, 0x66, 0x0a, 0x0e,
0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x09, 0x73, 0x75, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24,
0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x0a, 0x04, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72,
0x72, 0x70, 0x63, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x09, 0x73, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x04,
0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x22, 0x31, 0x0a, 0x09, 0x53, 0x75, 0x62, 0x6d, 0x62, 0x61, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x68, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x09, 0x52, 0x03, 0x73, 0x68, 0x61, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x7a, 0x65, 0x4c, 0x69,
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x69, 0x7a, 0x65, 0x4c,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x22, 0x9a, 0x01, 0x0a, 0x1b, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x30, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x62, 0x52,
0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x44, 0x69, 0x76, 0x65, 0x72, 0x67, 0x65, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x04, 0x62, 0x6c, 0x6f, 0x62, 0x18,
0x6e, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x04, 0x62, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x42, 0x6c, 0x6f, 0x62,
0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x04, 0x62, 0x6c, 0x6f, 0x62, 0x22, 0x46, 0x0a, 0x04, 0x42, 0x6c, 0x6f, 0x62, 0x12, 0x10,
0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x04, 0x62, 0x61, 0x73, 0x0a, 0x03, 0x73, 0x68, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x68, 0x61,
0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04,
0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x38, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18,
0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x68,
0x32, 0x1c, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x44, 0x69, 0x76, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65,
0x65, 0x72, 0x67, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x08, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x04, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20,
0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x22, 0x3d, 0x0a, 0x17, 0x43, 0x6f, 0x6d, 0x6d, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65,
0x69, 0x74, 0x44, 0x69, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x04, 0x62, 0x61, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x67,
0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x69, 0x74, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x67, 0x69,
0x09, 0x52, 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x74, 0x6f, 0x18, 0x02, 0x20, 0x74, 0x52, 0x65, 0x66, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01,
0x01, 0x28, 0x09, 0x52, 0x02, 0x74, 0x6f, 0x22, 0x57, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x44, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x53,
0x6d, 0x6d, 0x69, 0x74, 0x44, 0x69, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x0b, 0x64, 0x69, 0x76, 0x65, 0x72, 0x12, 0x2c, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20,
0x67, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x72, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x6f, 0x64,
0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x44, 0x69, 0x76, 0x65, 0x72, 0x67, 0x65, 0x75, 0x6c, 0x65, 0x52, 0x09, 0x73, 0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x22, 0x31,
0x6e, 0x63, 0x65, 0x52, 0x0b, 0x64, 0x69, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x0a, 0x09, 0x53, 0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e,
0x22, 0x40, 0x0a, 0x10, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x44, 0x69, 0x76, 0x65, 0x72, 0x67, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
0x65, 0x6e, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x68, 0x65, 0x61, 0x64, 0x18, 0x01, 0x20, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72,
0x01, 0x28, 0x05, 0x52, 0x05, 0x61, 0x68, 0x65, 0x61, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x65, 0x6c, 0x22, 0x9a, 0x01, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x44,
0x68, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x65, 0x68, 0x69, 0x69, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x6e, 0x64, 0x2a, 0x52, 0x0a, 0x0c, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x54, 0x79, 0x74, 0x12, 0x24, 0x0a, 0x04, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x54, 0x79, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x70, 0x65, 0x54, 0x72, 0x65, 0x65, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x72, 0x65, 0x65, 0x74, 0x52, 0x04, 0x62, 0x61, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x63,
0x4e, 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x42, 0x6c, 0x6f, 0x62, 0x10, 0x01, 0x12, 0x16, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x43,
0x0a, 0x12, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x38, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73,
0x6d, 0x6d, 0x69, 0x74, 0x10, 0x02, 0x2a, 0x81, 0x01, 0x0a, 0x0c, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6d,
0x6f, 0x64, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6d, 0x69, 0x74, 0x44, 0x69, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71,
0x6f, 0x64, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x75, 0x65, 0x73, 0x74, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x22, 0x3d,
0x13, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x53, 0x79, 0x6d, 0x0a, 0x17, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x44, 0x69, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e,
0x6c, 0x69, 0x6e, 0x6b, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x72, 0x6f,
0x64, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x45, 0x78, 0x65, 0x63, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x12, 0x0e, 0x0a,
0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x54, 0x72, 0x65, 0x65, 0x02, 0x74, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x74, 0x6f, 0x22, 0x57, 0x0a,
0x10, 0x03, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x6f, 0x1c, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x44, 0x69, 0x76, 0x65, 0x72, 0x67,
0x64, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x10, 0x04, 0x32, 0x8e, 0x04, 0x0a, 0x11, 0x52, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a,
0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x0b, 0x64, 0x69, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03,
0x12, 0x51, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x44,
0x74, 0x6f, 0x72, 0x79, 0x12, 0x1c, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0b, 0x64, 0x69, 0x76, 0x65, 0x72,
0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x67, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x22, 0x40, 0x0a, 0x10, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x44, 0x69, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x68,
0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x61, 0x68, 0x65, 0x61, 0x64,
0x65, 0x28, 0x01, 0x12, 0x40, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x65, 0x68, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
0x64, 0x65, 0x12, 0x17, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x72, 0x65, 0x65, 0x52, 0x06, 0x62, 0x65, 0x68, 0x69, 0x6e, 0x64, 0x2a, 0x52, 0x0a, 0x0c, 0x54, 0x72, 0x65, 0x65,
0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x72, 0x70, 0x4e, 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x72, 0x65, 0x65,
0x63, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x54, 0x72, 0x65, 0x65, 0x10, 0x00, 0x12, 0x14,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x72, 0x65, 0x0a, 0x10, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x42, 0x6c,
0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x19, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x6f, 0x62, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65,
0x74, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x10, 0x02, 0x2a, 0x81, 0x01, 0x0a,
0x74, 0x1a, 0x1a, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x72, 0x65, 0x65, 0x0c, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a,
0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x10, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x46, 0x69, 0x6c,
0x43, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x65, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4d,
0x18, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6f, 0x64, 0x65, 0x53, 0x79, 0x6d, 0x6c, 0x69, 0x6e, 0x6b, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10,
0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x45, 0x78, 0x65, 0x63,
0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x6f,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x62, 0x12, 0x64, 0x65, 0x54, 0x72, 0x65, 0x65, 0x10, 0x03, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x72, 0x65, 0x65,
0x13, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x10, 0x04,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x32, 0xca, 0x04, 0x0a, 0x11, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x53,
0x6f, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x0b, 0x4c, 0x69, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x51, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x17, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1c, 0x2e, 0x72, 0x70, 0x63,
0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72,
0x73, 0x74, 0x1a, 0x18, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43,
0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x5b, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52,
0x0a, 0x14, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x44, 0x69, 0x76, 0x65, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x40, 0x0a, 0x0b, 0x47, 0x65, 0x74,
0x67, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x20, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47,
0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x44, 0x69, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x63, 0x65, 0x65, 0x74, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x74, 0x1a, 0x18, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x72, 0x65, 0x65, 0x4e,
0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x0d, 0x4c,
0x69, 0x73, 0x74, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x19, 0x2e, 0x72,
0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69,
0x73, 0x74, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x43, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x6d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x18, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x53,
0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x19, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x6d, 0x6f, 0x64, 0x75,
0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x07, 0x47, 0x65,
0x74, 0x42, 0x6c, 0x6f, 0x62, 0x12, 0x13, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x42,
0x6c, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x70, 0x63,
0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x42, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x12,
0x17, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x4c,
0x69, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x30, 0x01, 0x12, 0x3a, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69,
0x74, 0x12, 0x15, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69,
0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47,
0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x5b, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x44, 0x69, 0x76,
0x65, 0x72, 0x67, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x20, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47,
0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x44, 0x69, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x44, 0x69, 0x76, 0x65, 0x72, 0x67, 0x65, 0x6e,
0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x27, 0x5a, 0x25, 0x67, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x72, 0x70, 0x63,
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x72, 0x6e, 0x65, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x44, 0x69, 0x76, 0x65, 0x72, 0x67,
0x73, 0x2f, 0x67, 0x69, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x2f, 0x67, 0x69, 0x74, 0x72, 0x70, 0x63, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x27, 0x5a,
0x2f, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x72, 0x6e,
0x65, 0x73, 0x73, 0x2f, 0x67, 0x69, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x2f, 0x67, 0x69, 0x74, 0x72,
0x70, 0x63, 0x2f, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -1516,7 +1629,7 @@ func file_repo_proto_rawDescGZIP() []byte {
} }
var file_repo_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_repo_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_repo_proto_msgTypes = make([]protoimpl.MessageInfo, 20) var file_repo_proto_msgTypes = make([]protoimpl.MessageInfo, 22)
var file_repo_proto_goTypes = []interface{}{ var file_repo_proto_goTypes = []interface{}{
(TreeNodeType)(0), // 0: rpc.TreeNodeType (TreeNodeType)(0), // 0: rpc.TreeNodeType
(TreeNodeMode)(0), // 1: rpc.TreeNodeMode (TreeNodeMode)(0), // 1: rpc.TreeNodeMode
@ -1528,63 +1641,69 @@ var file_repo_proto_goTypes = []interface{}{
(*ListTreeNodesRequest)(nil), // 7: rpc.ListTreeNodesRequest (*ListTreeNodesRequest)(nil), // 7: rpc.ListTreeNodesRequest
(*ListTreeNodesResponse)(nil), // 8: rpc.ListTreeNodesResponse (*ListTreeNodesResponse)(nil), // 8: rpc.ListTreeNodesResponse
(*TreeNode)(nil), // 9: rpc.TreeNode (*TreeNode)(nil), // 9: rpc.TreeNode
(*ListCommitsRequest)(nil), // 10: rpc.ListCommitsRequest (*GetCommitRequest)(nil), // 10: rpc.GetCommitRequest
(*ListCommitsResponse)(nil), // 11: rpc.ListCommitsResponse (*GetCommitResponse)(nil), // 11: rpc.GetCommitResponse
(*GetBlobRequest)(nil), // 12: rpc.GetBlobRequest (*ListCommitsRequest)(nil), // 12: rpc.ListCommitsRequest
(*GetBlobResponse)(nil), // 13: rpc.GetBlobResponse (*ListCommitsResponse)(nil), // 13: rpc.ListCommitsResponse
(*Blob)(nil), // 14: rpc.Blob (*GetBlobRequest)(nil), // 14: rpc.GetBlobRequest
(*GetSubmoduleRequest)(nil), // 15: rpc.GetSubmoduleRequest (*GetBlobResponse)(nil), // 15: rpc.GetBlobResponse
(*GetSubmoduleResponse)(nil), // 16: rpc.GetSubmoduleResponse (*Blob)(nil), // 16: rpc.Blob
(*Submodule)(nil), // 17: rpc.Submodule (*GetSubmoduleRequest)(nil), // 17: rpc.GetSubmoduleRequest
(*GetCommitDivergencesRequest)(nil), // 18: rpc.GetCommitDivergencesRequest (*GetSubmoduleResponse)(nil), // 18: rpc.GetSubmoduleResponse
(*CommitDivergenceRequest)(nil), // 19: rpc.CommitDivergenceRequest (*Submodule)(nil), // 19: rpc.Submodule
(*GetCommitDivergencesResponse)(nil), // 20: rpc.GetCommitDivergencesResponse (*GetCommitDivergencesRequest)(nil), // 20: rpc.GetCommitDivergencesRequest
(*CommitDivergence)(nil), // 21: rpc.CommitDivergence (*CommitDivergenceRequest)(nil), // 21: rpc.CommitDivergenceRequest
(*FileUpload)(nil), // 22: rpc.FileUpload (*GetCommitDivergencesResponse)(nil), // 22: rpc.GetCommitDivergencesResponse
(*WriteRequest)(nil), // 23: rpc.WriteRequest (*CommitDivergence)(nil), // 23: rpc.CommitDivergence
(*ReadRequest)(nil), // 24: rpc.ReadRequest (*FileUpload)(nil), // 24: rpc.FileUpload
(*Commit)(nil), // 25: rpc.Commit (*WriteRequest)(nil), // 25: rpc.WriteRequest
(*ReadRequest)(nil), // 26: rpc.ReadRequest
(*Commit)(nil), // 27: rpc.Commit
} }
var file_repo_proto_depIdxs = []int32{ var file_repo_proto_depIdxs = []int32{
3, // 0: rpc.CreateRepositoryRequest.header:type_name -> rpc.CreateRepositoryRequestHeader 3, // 0: rpc.CreateRepositoryRequest.header:type_name -> rpc.CreateRepositoryRequestHeader
22, // 1: rpc.CreateRepositoryRequest.file:type_name -> rpc.FileUpload 24, // 1: rpc.CreateRepositoryRequest.file:type_name -> rpc.FileUpload
23, // 2: rpc.CreateRepositoryRequestHeader.base:type_name -> rpc.WriteRequest 25, // 2: rpc.CreateRepositoryRequestHeader.base:type_name -> rpc.WriteRequest
24, // 3: rpc.GetTreeNodeRequest.base:type_name -> rpc.ReadRequest 26, // 3: rpc.GetTreeNodeRequest.base:type_name -> rpc.ReadRequest
9, // 4: rpc.GetTreeNodeResponse.node:type_name -> rpc.TreeNode 9, // 4: rpc.GetTreeNodeResponse.node:type_name -> rpc.TreeNode
25, // 5: rpc.GetTreeNodeResponse.commit:type_name -> rpc.Commit 27, // 5: rpc.GetTreeNodeResponse.commit:type_name -> rpc.Commit
24, // 6: rpc.ListTreeNodesRequest.base:type_name -> rpc.ReadRequest 26, // 6: rpc.ListTreeNodesRequest.base:type_name -> rpc.ReadRequest
9, // 7: rpc.ListTreeNodesResponse.node:type_name -> rpc.TreeNode 9, // 7: rpc.ListTreeNodesResponse.node:type_name -> rpc.TreeNode
25, // 8: rpc.ListTreeNodesResponse.commit:type_name -> rpc.Commit 27, // 8: rpc.ListTreeNodesResponse.commit:type_name -> rpc.Commit
0, // 9: rpc.TreeNode.type:type_name -> rpc.TreeNodeType 0, // 9: rpc.TreeNode.type:type_name -> rpc.TreeNodeType
1, // 10: rpc.TreeNode.mode:type_name -> rpc.TreeNodeMode 1, // 10: rpc.TreeNode.mode:type_name -> rpc.TreeNodeMode
24, // 11: rpc.ListCommitsRequest.base:type_name -> rpc.ReadRequest 26, // 11: rpc.GetCommitRequest.base:type_name -> rpc.ReadRequest
25, // 12: rpc.ListCommitsResponse.commit:type_name -> rpc.Commit 27, // 12: rpc.GetCommitResponse.commit:type_name -> rpc.Commit
24, // 13: rpc.GetBlobRequest.base:type_name -> rpc.ReadRequest 26, // 13: rpc.ListCommitsRequest.base:type_name -> rpc.ReadRequest
14, // 14: rpc.GetBlobResponse.blob:type_name -> rpc.Blob 27, // 14: rpc.ListCommitsResponse.commit:type_name -> rpc.Commit
24, // 15: rpc.GetSubmoduleRequest.base:type_name -> rpc.ReadRequest 26, // 15: rpc.GetBlobRequest.base:type_name -> rpc.ReadRequest
17, // 16: rpc.GetSubmoduleResponse.submodule:type_name -> rpc.Submodule 16, // 16: rpc.GetBlobResponse.blob:type_name -> rpc.Blob
24, // 17: rpc.GetCommitDivergencesRequest.base:type_name -> rpc.ReadRequest 26, // 17: rpc.GetSubmoduleRequest.base:type_name -> rpc.ReadRequest
19, // 18: rpc.GetCommitDivergencesRequest.requests:type_name -> rpc.CommitDivergenceRequest 19, // 18: rpc.GetSubmoduleResponse.submodule:type_name -> rpc.Submodule
21, // 19: rpc.GetCommitDivergencesResponse.divergences:type_name -> rpc.CommitDivergence 26, // 19: rpc.GetCommitDivergencesRequest.base:type_name -> rpc.ReadRequest
2, // 20: rpc.RepositoryService.CreateRepository:input_type -> rpc.CreateRepositoryRequest 21, // 20: rpc.GetCommitDivergencesRequest.requests:type_name -> rpc.CommitDivergenceRequest
5, // 21: rpc.RepositoryService.GetTreeNode:input_type -> rpc.GetTreeNodeRequest 23, // 21: rpc.GetCommitDivergencesResponse.divergences:type_name -> rpc.CommitDivergence
7, // 22: rpc.RepositoryService.ListTreeNodes:input_type -> rpc.ListTreeNodesRequest 2, // 22: rpc.RepositoryService.CreateRepository:input_type -> rpc.CreateRepositoryRequest
15, // 23: rpc.RepositoryService.GetSubmodule:input_type -> rpc.GetSubmoduleRequest 5, // 23: rpc.RepositoryService.GetTreeNode:input_type -> rpc.GetTreeNodeRequest
12, // 24: rpc.RepositoryService.GetBlob:input_type -> rpc.GetBlobRequest 7, // 24: rpc.RepositoryService.ListTreeNodes:input_type -> rpc.ListTreeNodesRequest
10, // 25: rpc.RepositoryService.ListCommits:input_type -> rpc.ListCommitsRequest 17, // 25: rpc.RepositoryService.GetSubmodule:input_type -> rpc.GetSubmoduleRequest
18, // 26: rpc.RepositoryService.GetCommitDivergences:input_type -> rpc.GetCommitDivergencesRequest 14, // 26: rpc.RepositoryService.GetBlob:input_type -> rpc.GetBlobRequest
4, // 27: rpc.RepositoryService.CreateRepository:output_type -> rpc.CreateRepositoryResponse 12, // 27: rpc.RepositoryService.ListCommits:input_type -> rpc.ListCommitsRequest
6, // 28: rpc.RepositoryService.GetTreeNode:output_type -> rpc.GetTreeNodeResponse 10, // 28: rpc.RepositoryService.GetCommit:input_type -> rpc.GetCommitRequest
8, // 29: rpc.RepositoryService.ListTreeNodes:output_type -> rpc.ListTreeNodesResponse 20, // 29: rpc.RepositoryService.GetCommitDivergences:input_type -> rpc.GetCommitDivergencesRequest
16, // 30: rpc.RepositoryService.GetSubmodule:output_type -> rpc.GetSubmoduleResponse 4, // 30: rpc.RepositoryService.CreateRepository:output_type -> rpc.CreateRepositoryResponse
13, // 31: rpc.RepositoryService.GetBlob:output_type -> rpc.GetBlobResponse 6, // 31: rpc.RepositoryService.GetTreeNode:output_type -> rpc.GetTreeNodeResponse
11, // 32: rpc.RepositoryService.ListCommits:output_type -> rpc.ListCommitsResponse 8, // 32: rpc.RepositoryService.ListTreeNodes:output_type -> rpc.ListTreeNodesResponse
20, // 33: rpc.RepositoryService.GetCommitDivergences:output_type -> rpc.GetCommitDivergencesResponse 18, // 33: rpc.RepositoryService.GetSubmodule:output_type -> rpc.GetSubmoduleResponse
27, // [27:34] is the sub-list for method output_type 15, // 34: rpc.RepositoryService.GetBlob:output_type -> rpc.GetBlobResponse
20, // [20:27] is the sub-list for method input_type 13, // 35: rpc.RepositoryService.ListCommits:output_type -> rpc.ListCommitsResponse
20, // [20:20] is the sub-list for extension type_name 11, // 36: rpc.RepositoryService.GetCommit:output_type -> rpc.GetCommitResponse
20, // [20:20] is the sub-list for extension extendee 22, // 37: rpc.RepositoryService.GetCommitDivergences:output_type -> rpc.GetCommitDivergencesResponse
0, // [0:20] is the sub-list for field type_name 30, // [30:38] is the sub-list for method output_type
22, // [22:30] is the sub-list for method input_type
22, // [22:22] is the sub-list for extension type_name
22, // [22:22] is the sub-list for extension extendee
0, // [0:22] is the sub-list for field type_name
} }
func init() { file_repo_proto_init() } func init() { file_repo_proto_init() }
@ -1691,7 +1810,7 @@ func file_repo_proto_init() {
} }
} }
file_repo_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { file_repo_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListCommitsRequest); i { switch v := v.(*GetCommitRequest); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1703,7 +1822,7 @@ func file_repo_proto_init() {
} }
} }
file_repo_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { file_repo_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListCommitsResponse); i { switch v := v.(*GetCommitResponse); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1715,7 +1834,7 @@ func file_repo_proto_init() {
} }
} }
file_repo_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { file_repo_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetBlobRequest); i { switch v := v.(*ListCommitsRequest); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1727,7 +1846,7 @@ func file_repo_proto_init() {
} }
} }
file_repo_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { file_repo_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetBlobResponse); i { switch v := v.(*ListCommitsResponse); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1739,7 +1858,7 @@ func file_repo_proto_init() {
} }
} }
file_repo_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { file_repo_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Blob); i { switch v := v.(*GetBlobRequest); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1751,7 +1870,7 @@ func file_repo_proto_init() {
} }
} }
file_repo_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { file_repo_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetSubmoduleRequest); i { switch v := v.(*GetBlobResponse); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1763,7 +1882,7 @@ func file_repo_proto_init() {
} }
} }
file_repo_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { file_repo_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetSubmoduleResponse); i { switch v := v.(*Blob); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1775,7 +1894,7 @@ func file_repo_proto_init() {
} }
} }
file_repo_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { file_repo_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Submodule); i { switch v := v.(*GetSubmoduleRequest); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1787,7 +1906,7 @@ func file_repo_proto_init() {
} }
} }
file_repo_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { file_repo_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetCommitDivergencesRequest); i { switch v := v.(*GetSubmoduleResponse); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1799,7 +1918,7 @@ func file_repo_proto_init() {
} }
} }
file_repo_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { file_repo_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CommitDivergenceRequest); i { switch v := v.(*Submodule); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1811,7 +1930,7 @@ func file_repo_proto_init() {
} }
} }
file_repo_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { file_repo_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetCommitDivergencesResponse); i { switch v := v.(*GetCommitDivergencesRequest); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1823,6 +1942,30 @@ func file_repo_proto_init() {
} }
} }
file_repo_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { file_repo_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CommitDivergenceRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_repo_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetCommitDivergencesResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_repo_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CommitDivergence); i { switch v := v.(*CommitDivergence); i {
case 0: case 0:
return &v.state return &v.state
@ -1845,7 +1988,7 @@ func file_repo_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_repo_proto_rawDesc, RawDescriptor: file_repo_proto_rawDesc,
NumEnums: 2, NumEnums: 2,
NumMessages: 20, NumMessages: 22,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions: // versions:
// - protoc-gen-go-grpc v1.2.0 // - protoc-gen-go-grpc v1.2.0
// - protoc v3.21.9 // - protoc v3.21.11
// source: repo.proto // source: repo.proto
package rpc package rpc
@ -28,6 +28,7 @@ type RepositoryServiceClient interface {
GetSubmodule(ctx context.Context, in *GetSubmoduleRequest, opts ...grpc.CallOption) (*GetSubmoduleResponse, error) GetSubmodule(ctx context.Context, in *GetSubmoduleRequest, opts ...grpc.CallOption) (*GetSubmoduleResponse, error)
GetBlob(ctx context.Context, in *GetBlobRequest, opts ...grpc.CallOption) (*GetBlobResponse, error) GetBlob(ctx context.Context, in *GetBlobRequest, opts ...grpc.CallOption) (*GetBlobResponse, error)
ListCommits(ctx context.Context, in *ListCommitsRequest, opts ...grpc.CallOption) (RepositoryService_ListCommitsClient, error) ListCommits(ctx context.Context, in *ListCommitsRequest, opts ...grpc.CallOption) (RepositoryService_ListCommitsClient, error)
GetCommit(ctx context.Context, in *GetCommitRequest, opts ...grpc.CallOption) (*GetCommitResponse, error)
GetCommitDivergences(ctx context.Context, in *GetCommitDivergencesRequest, opts ...grpc.CallOption) (*GetCommitDivergencesResponse, error) GetCommitDivergences(ctx context.Context, in *GetCommitDivergencesRequest, opts ...grpc.CallOption) (*GetCommitDivergencesResponse, error)
} }
@ -164,6 +165,15 @@ func (x *repositoryServiceListCommitsClient) Recv() (*ListCommitsResponse, error
return m, nil return m, nil
} }
func (c *repositoryServiceClient) GetCommit(ctx context.Context, in *GetCommitRequest, opts ...grpc.CallOption) (*GetCommitResponse, error) {
out := new(GetCommitResponse)
err := c.cc.Invoke(ctx, "/rpc.RepositoryService/GetCommit", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *repositoryServiceClient) GetCommitDivergences(ctx context.Context, in *GetCommitDivergencesRequest, opts ...grpc.CallOption) (*GetCommitDivergencesResponse, error) { func (c *repositoryServiceClient) GetCommitDivergences(ctx context.Context, in *GetCommitDivergencesRequest, opts ...grpc.CallOption) (*GetCommitDivergencesResponse, error) {
out := new(GetCommitDivergencesResponse) out := new(GetCommitDivergencesResponse)
err := c.cc.Invoke(ctx, "/rpc.RepositoryService/GetCommitDivergences", in, out, opts...) err := c.cc.Invoke(ctx, "/rpc.RepositoryService/GetCommitDivergences", in, out, opts...)
@ -183,6 +193,7 @@ type RepositoryServiceServer interface {
GetSubmodule(context.Context, *GetSubmoduleRequest) (*GetSubmoduleResponse, error) GetSubmodule(context.Context, *GetSubmoduleRequest) (*GetSubmoduleResponse, error)
GetBlob(context.Context, *GetBlobRequest) (*GetBlobResponse, error) GetBlob(context.Context, *GetBlobRequest) (*GetBlobResponse, error)
ListCommits(*ListCommitsRequest, RepositoryService_ListCommitsServer) error ListCommits(*ListCommitsRequest, RepositoryService_ListCommitsServer) error
GetCommit(context.Context, *GetCommitRequest) (*GetCommitResponse, error)
GetCommitDivergences(context.Context, *GetCommitDivergencesRequest) (*GetCommitDivergencesResponse, error) GetCommitDivergences(context.Context, *GetCommitDivergencesRequest) (*GetCommitDivergencesResponse, error)
mustEmbedUnimplementedRepositoryServiceServer() mustEmbedUnimplementedRepositoryServiceServer()
} }
@ -209,6 +220,9 @@ func (UnimplementedRepositoryServiceServer) GetBlob(context.Context, *GetBlobReq
func (UnimplementedRepositoryServiceServer) ListCommits(*ListCommitsRequest, RepositoryService_ListCommitsServer) error { func (UnimplementedRepositoryServiceServer) ListCommits(*ListCommitsRequest, RepositoryService_ListCommitsServer) error {
return status.Errorf(codes.Unimplemented, "method ListCommits not implemented") return status.Errorf(codes.Unimplemented, "method ListCommits not implemented")
} }
func (UnimplementedRepositoryServiceServer) GetCommit(context.Context, *GetCommitRequest) (*GetCommitResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetCommit not implemented")
}
func (UnimplementedRepositoryServiceServer) GetCommitDivergences(context.Context, *GetCommitDivergencesRequest) (*GetCommitDivergencesResponse, error) { func (UnimplementedRepositoryServiceServer) GetCommitDivergences(context.Context, *GetCommitDivergencesRequest) (*GetCommitDivergencesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetCommitDivergences not implemented") return nil, status.Errorf(codes.Unimplemented, "method GetCommitDivergences not implemented")
} }
@ -347,6 +361,24 @@ func (x *repositoryServiceListCommitsServer) Send(m *ListCommitsResponse) error
return x.ServerStream.SendMsg(m) return x.ServerStream.SendMsg(m)
} }
func _RepositoryService_GetCommit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetCommitRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RepositoryServiceServer).GetCommit(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/rpc.RepositoryService/GetCommit",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RepositoryServiceServer).GetCommit(ctx, req.(*GetCommitRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RepositoryService_GetCommitDivergences_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _RepositoryService_GetCommitDivergences_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetCommitDivergencesRequest) in := new(GetCommitDivergencesRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -384,6 +416,10 @@ var RepositoryService_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetBlob", MethodName: "GetBlob",
Handler: _RepositoryService_GetBlob_Handler, Handler: _RepositoryService_GetBlob_Handler,
}, },
{
MethodName: "GetCommit",
Handler: _RepositoryService_GetCommit_Handler,
},
{ {
MethodName: "GetCommitDivergences", MethodName: "GetCommitDivergences",
Handler: _RepositoryService_GetCommitDivergences_Handler, Handler: _RepositoryService_GetCommitDivergences_Handler,

View File

@ -6,8 +6,11 @@ package webhook
import ( import (
"context" "context"
"errors"
"fmt"
"github.com/harness/gitness/events" "github.com/harness/gitness/events"
"github.com/harness/gitness/gitrpc"
gitevents "github.com/harness/gitness/internal/events/git" gitevents "github.com/harness/gitness/internal/events/git"
"github.com/harness/gitness/types" "github.com/harness/gitness/types"
"github.com/harness/gitness/types/enum" "github.com/harness/gitness/types/enum"
@ -23,6 +26,7 @@ type BranchBody struct {
Ref string `json:"ref"` Ref string `json:"ref"`
Before string `json:"before"` Before string `json:"before"`
After string `json:"after"` After string `json:"after"`
Commit *CommitInfo `json:"commit"`
// Forced bool `json:"forced"` TODO: data has to be calculated explicitly // Forced bool `json:"forced"` TODO: data has to be calculated explicitly
} }
@ -30,17 +34,22 @@ type BranchBody struct {
// and triggers branch created webhooks for the source repo. // and triggers branch created webhooks for the source repo.
func (s *Server) handleEventBranchCreated(ctx context.Context, func (s *Server) handleEventBranchCreated(ctx context.Context,
event *events.Event[*gitevents.BranchCreatedPayload]) error { event *events.Event[*gitevents.BranchCreatedPayload]) error {
return s.triggerWebhooksForEventWithRepoAndPrincipal(ctx, enum.WebhookTriggerBranchCreated, return s.triggerForEventWithRepoAndPrincipal(ctx, enum.WebhookTriggerBranchCreated,
event.ID, event.Payload.RepoID, event.Payload.PrincipalID, event.ID, event.Payload.RepoID, event.Payload.PrincipalID,
func(repo *types.Repository, principal *types.Principal) interface{} { func(repo *types.Repository, principal *types.Principal) (any, error) {
commitInfo, err := s.fetchCommitInfoForEvent(ctx, repo.GitUID, event.Payload.SHA)
if err != nil {
return nil, err
}
return &BranchBody{ return &BranchBody{
Trigger: enum.WebhookTriggerBranchCreated, Trigger: enum.WebhookTriggerBranchCreated,
Repo: repositoryInfoFrom(repo, s.urlProvider), Repo: repositoryInfoFrom(*repo, s.urlProvider),
Principal: principalInfoFrom(principal), Principal: principalInfoFrom(*principal),
Ref: event.Payload.Ref, Ref: event.Payload.Ref,
Before: types.NilSHA, Before: types.NilSHA,
After: event.Payload.SHA, After: event.Payload.SHA,
} Commit: &commitInfo,
}, nil
}) })
} }
@ -48,18 +57,24 @@ func (s *Server) handleEventBranchCreated(ctx context.Context,
// and triggers branch updated webhooks for the source repo. // and triggers branch updated webhooks for the source repo.
func (s *Server) handleEventBranchUpdated(ctx context.Context, func (s *Server) handleEventBranchUpdated(ctx context.Context,
event *events.Event[*gitevents.BranchUpdatedPayload]) error { event *events.Event[*gitevents.BranchUpdatedPayload]) error {
return s.triggerWebhooksForEventWithRepoAndPrincipal(ctx, enum.WebhookTriggerBranchUpdated, return s.triggerForEventWithRepoAndPrincipal(ctx, enum.WebhookTriggerBranchUpdated,
event.ID, event.Payload.RepoID, event.Payload.PrincipalID, event.ID, event.Payload.RepoID, event.Payload.PrincipalID,
func(repo *types.Repository, principal *types.Principal) interface{} { func(repo *types.Repository, principal *types.Principal) (any, error) {
commitInfo, err := s.fetchCommitInfoForEvent(ctx, repo.GitUID, event.Payload.NewSHA)
if err != nil {
return nil, err
}
return &BranchBody{ return &BranchBody{
Trigger: enum.WebhookTriggerBranchUpdated, Trigger: enum.WebhookTriggerBranchUpdated,
Repo: repositoryInfoFrom(repo, s.urlProvider), Repo: repositoryInfoFrom(*repo, s.urlProvider),
Principal: principalInfoFrom(principal), Principal: principalInfoFrom(*principal),
Ref: event.Payload.Ref, Ref: event.Payload.Ref,
Before: event.Payload.OldSHA, Before: event.Payload.OldSHA,
After: event.Payload.NewSHA, After: event.Payload.NewSHA,
Commit: &commitInfo,
// Forced: true/false, // TODO: data not available yet // Forced: true/false, // TODO: data not available yet
} }, nil
}) })
} }
@ -67,16 +82,36 @@ func (s *Server) handleEventBranchUpdated(ctx context.Context,
// and triggers branch deleted webhooks for the source repo. // and triggers branch deleted webhooks for the source repo.
func (s *Server) handleEventBranchDeleted(ctx context.Context, func (s *Server) handleEventBranchDeleted(ctx context.Context,
event *events.Event[*gitevents.BranchDeletedPayload]) error { event *events.Event[*gitevents.BranchDeletedPayload]) error {
return s.triggerWebhooksForEventWithRepoAndPrincipal(ctx, enum.WebhookTriggerBranchDeleted, return s.triggerForEventWithRepoAndPrincipal(ctx, enum.WebhookTriggerBranchDeleted,
event.ID, event.Payload.RepoID, event.Payload.PrincipalID, event.ID, event.Payload.RepoID, event.Payload.PrincipalID,
func(repo *types.Repository, principal *types.Principal) interface{} { func(repo *types.Repository, principal *types.Principal) (any, error) {
return &BranchBody{ return &BranchBody{
Trigger: enum.WebhookTriggerBranchDeleted, Trigger: enum.WebhookTriggerBranchDeleted,
Repo: repositoryInfoFrom(repo, s.urlProvider), Repo: repositoryInfoFrom(*repo, s.urlProvider),
Principal: principalInfoFrom(principal), Principal: principalInfoFrom(*principal),
Ref: event.Payload.Ref, Ref: event.Payload.Ref,
Before: event.Payload.SHA, Before: event.Payload.SHA,
After: types.NilSHA, After: types.NilSHA,
} }, nil
}) })
} }
func (s *Server) fetchCommitInfoForEvent(ctx context.Context, repoUID string, sha string) (CommitInfo, error) {
out, err := s.gitRPCClient.GetCommit(ctx, &gitrpc.GetCommitParams{
ReadParams: gitrpc.ReadParams{
RepoUID: repoUID,
},
SHA: sha,
})
if errors.Is(err, gitrpc.ErrNotFound) {
// this could happen if the commit has been deleted and garbage collected by now - discard event
return CommitInfo{}, events.NewDiscardEventErrorf("commit with sha '%s' doesn't exist anymore", sha)
}
if err != nil {
return CommitInfo{}, fmt.Errorf("failed to get commit with sha '%s': %w", sha, err)
}
return commitInfoFrom(out.Commit), nil
}

View File

@ -5,6 +5,9 @@
package webhook package webhook
import ( import (
"time"
"github.com/harness/gitness/gitrpc"
"github.com/harness/gitness/internal/url" "github.com/harness/gitness/internal/url"
"github.com/harness/gitness/types" "github.com/harness/gitness/types"
) )
@ -20,7 +23,7 @@ type RepositoryInfo struct {
} }
// repositoryInfoFrom gets the RespositoryInfo from a types.Repository. // repositoryInfoFrom gets the RespositoryInfo from a types.Repository.
func repositoryInfoFrom(repo *types.Repository, urlProvider *url.Provider) RepositoryInfo { func repositoryInfoFrom(repo types.Repository, urlProvider *url.Provider) RepositoryInfo {
return RepositoryInfo{ return RepositoryInfo{
ID: repo.ID, ID: repo.ID,
Path: repo.Path, Path: repo.Path,
@ -40,7 +43,7 @@ type PrincipalInfo struct {
} }
// principalInfoFrom gets the PrincipalInfo from a types.Principal. // principalInfoFrom gets the PrincipalInfo from a types.Principal.
func principalInfoFrom(principal *types.Principal) PrincipalInfo { func principalInfoFrom(principal types.Principal) PrincipalInfo {
return PrincipalInfo{ return PrincipalInfo{
ID: principal.ID, ID: principal.ID,
UID: principal.UID, UID: principal.UID,
@ -48,3 +51,52 @@ func principalInfoFrom(principal *types.Principal) PrincipalInfo {
Email: principal.Email, Email: principal.Email,
} }
} }
// CommitInfo describes the commit related info for a webhook payload.
// NOTE: don't use types package as we want webhook payload to be independent from API calls.
type CommitInfo struct {
SHA string `json:"sha"`
Message string `json:"message"`
Author SignatureInfo `json:"author"`
Committer SignatureInfo `json:"committer"`
}
// commitInfoFrom gets the CommitInfo from a gitrpc.Commit.
func commitInfoFrom(commit gitrpc.Commit) CommitInfo {
return CommitInfo{
SHA: commit.SHA,
Message: commit.Message,
Author: signatureInfoFrom(commit.Author),
Committer: signatureInfoFrom(commit.Committer),
}
}
// SignatureInfo describes the commit signature related info for a webhook payload.
// NOTE: don't use types package as we want webhook payload to be independent from API calls.
type SignatureInfo struct {
Identity IdentityInfo `json:"identity"`
When time.Time `json:"when"`
}
// signatureInfoFrom gets the SignatureInfo from a gitrpc.Signature.
func signatureInfoFrom(signature gitrpc.Signature) SignatureInfo {
return SignatureInfo{
Identity: identityInfoFrom(signature.Identity),
When: signature.When,
}
}
// IdentityInfo describes the signature identity related info for a webhook payload.
// NOTE: don't use types package as we want webhook payload to be independent from API calls.
type IdentityInfo struct {
Name string `json:"name"`
Email string `json:"email"`
}
// identityInfoFrom gets the IdentityInfo from a gitrpc.Identity.
func identityInfoFrom(identity gitrpc.Identity) IdentityInfo {
return IdentityInfo{
Name: identity.Name,
Email: identity.Email,
}
}

View File

@ -22,12 +22,12 @@ func generateTriggerIDFromEventID(eventID string) string {
return fmt.Sprintf("event-%s", eventID) return fmt.Sprintf("event-%s", eventID)
} }
// triggerWebhooksForEventWithRepoAndPrincipal triggers all webhooks for the given repo and triggerType // triggerForEventWithRepoAndPrincipal triggers all webhooks for the given repo and triggerType
// using the eventID to generate a deterministic triggerID and using the output of bodyFn as payload. // using the eventID to generate a deterministic triggerID and using the output of bodyFn as payload.
// The method tries to find the repository and principal and provides both to the bodyFn to generate the body. // The method tries to find the repository and principal and provides both to the bodyFn to generate the body.
func (s *Server) triggerWebhooksForEventWithRepoAndPrincipal(ctx context.Context, func (s *Server) triggerForEventWithRepoAndPrincipal(ctx context.Context,
triggerType enum.WebhookTrigger, eventID string, repoID int64, principalID int64, triggerType enum.WebhookTrigger, eventID string, repoID int64, principalID int64,
createBodyFn func(*types.Repository, *types.Principal) interface{}) error { createBodyFn func(*types.Repository, *types.Principal) (any, error)) error {
// NOTE: technically we could avoid this call if we send the data via the event (though then events will get big) // NOTE: technically we could avoid this call if we send the data via the event (though then events will get big)
repo, err := s.findRepositoryForEvent(ctx, repoID) repo, err := s.findRepositoryForEvent(ctx, repoID)
if err != nil { if err != nil {
@ -41,9 +41,12 @@ func (s *Server) triggerWebhooksForEventWithRepoAndPrincipal(ctx context.Context
} }
// create body // create body
body := createBodyFn(repo, principal) body, err := createBodyFn(repo, principal)
if err != nil {
return fmt.Errorf("body creation function failed: %w", err)
}
return s.triggerWebhooksForEvent(ctx, eventID, enum.WebhookParentRepo, repo.ID, triggerType, body) return s.triggerForEvent(ctx, eventID, enum.WebhookParentRepo, repo.ID, triggerType, body)
} }
// findRepositoryForEvent finds the repository for the provided repoID. // findRepositoryForEvent finds the repository for the provided repoID.
@ -78,10 +81,10 @@ func (s *Server) findPrincipalForEvent(ctx context.Context, principalID int64) (
return principal, nil return principal, nil
} }
// triggerWebhooksForEvent triggers all webhooks for the given parentType/ID and triggerType // triggerForEvent triggers all webhooks for the given parentType/ID and triggerType
// using the eventID to generate a deterministic triggerID and sending the provided body as payload. // using the eventID to generate a deterministic triggerID and sending the provided body as payload.
func (s *Server) triggerWebhooksForEvent(ctx context.Context, eventID string, func (s *Server) triggerForEvent(ctx context.Context, eventID string,
parentType enum.WebhookParent, parentID int64, triggerType enum.WebhookTrigger, body interface{}) error { parentType enum.WebhookParent, parentID int64, triggerType enum.WebhookTrigger, body any) error {
triggerID := generateTriggerIDFromEventID(eventID) triggerID := generateTriggerIDFromEventID(eventID)
results, err := s.triggerWebhooksFor(ctx, parentType, parentID, triggerID, triggerType, body) results, err := s.triggerWebhooksFor(ctx, parentType, parentID, triggerID, triggerType, body)

View File

@ -11,6 +11,7 @@ import (
"time" "time"
"github.com/harness/gitness/events" "github.com/harness/gitness/events"
"github.com/harness/gitness/gitrpc"
gitevents "github.com/harness/gitness/internal/events/git" gitevents "github.com/harness/gitness/internal/events/git"
"github.com/harness/gitness/internal/store" "github.com/harness/gitness/internal/store"
"github.com/harness/gitness/internal/url" "github.com/harness/gitness/internal/url"
@ -36,6 +37,7 @@ type Server struct {
urlProvider *url.Provider urlProvider *url.Provider
repoStore store.RepoStore repoStore store.RepoStore
principalStore store.PrincipalStore principalStore store.PrincipalStore
gitRPCClient gitrpc.Interface
readerCanceler *events.ReaderCanceler readerCanceler *events.ReaderCanceler
secureHTTPClient *http.Client secureHTTPClient *http.Client
@ -46,13 +48,14 @@ func NewServer(ctx context.Context, config Config,
gitReaderFactory *events.ReaderFactory[*gitevents.Reader], gitReaderFactory *events.ReaderFactory[*gitevents.Reader],
webhookStore store.WebhookStore, webhookExecutionStore store.WebhookExecutionStore, webhookStore store.WebhookStore, webhookExecutionStore store.WebhookExecutionStore,
repoStore store.RepoStore, urlProvider *url.Provider, repoStore store.RepoStore, urlProvider *url.Provider,
principalStore store.PrincipalStore) (*Server, error) { principalStore store.PrincipalStore, gitRPCClient gitrpc.Interface) (*Server, error) {
server := &Server{ server := &Server{
webhookStore: webhookStore, webhookStore: webhookStore,
webhookExecutionStore: webhookExecutionStore, webhookExecutionStore: webhookExecutionStore,
repoStore: repoStore, repoStore: repoStore,
urlProvider: urlProvider, urlProvider: urlProvider,
principalStore: principalStore, principalStore: principalStore,
gitRPCClient: gitRPCClient,
// set after launching factory // set after launching factory
readerCanceler: nil, readerCanceler: nil,

View File

@ -57,7 +57,7 @@ func (r *TriggerResult) Skipped() bool {
} }
func (s *Server) triggerWebhooksFor(ctx context.Context, parentType enum.WebhookParent, parentID int64, func (s *Server) triggerWebhooksFor(ctx context.Context, parentType enum.WebhookParent, parentID int64,
triggerID string, triggerType enum.WebhookTrigger, body interface{}) ([]TriggerResult, error) { triggerID string, triggerType enum.WebhookTrigger, body any) ([]TriggerResult, error) {
// get all webhooks for the given parent // get all webhooks for the given parent
// NOTE: there never should be even close to 1000 webhooks for a repo (that should be blocked in the future). // NOTE: there never should be even close to 1000 webhooks for a repo (that should be blocked in the future).
// We just use 1000 as a safe number to get all hooks // We just use 1000 as a safe number to get all hooks
@ -71,7 +71,7 @@ func (s *Server) triggerWebhooksFor(ctx context.Context, parentType enum.Webhook
//nolint:gocognit // refactor if needed //nolint:gocognit // refactor if needed
func (s *Server) triggerWebhooks(ctx context.Context, webhooks []*types.Webhook, func (s *Server) triggerWebhooks(ctx context.Context, webhooks []*types.Webhook,
triggerID string, triggerType enum.WebhookTrigger, body interface{}) ([]TriggerResult, error) { triggerID string, triggerType enum.WebhookTrigger, body any) ([]TriggerResult, error) {
// return immediately if webhooks are empty // return immediately if webhooks are empty
if len(webhooks) == 0 { if len(webhooks) == 0 {
return []TriggerResult{}, nil return []TriggerResult{}, nil
@ -168,7 +168,7 @@ func (s *Server) RetriggerWebhookExecution(ctx context.Context, webhookExecution
} }
func (s *Server) executeWebhook(ctx context.Context, webhook *types.Webhook, triggerID string, func (s *Server) executeWebhook(ctx context.Context, webhook *types.Webhook, triggerID string,
triggerType enum.WebhookTrigger, body interface{}, rerunOfID *int64) (*types.WebhookExecution, error) { triggerType enum.WebhookTrigger, body any, rerunOfID *int64) (*types.WebhookExecution, error) {
// build execution entry on the fly (save no matter what) // build execution entry on the fly (save no matter what)
execution := types.WebhookExecution{ execution := types.WebhookExecution{
RetriggerOf: rerunOfID, RetriggerOf: rerunOfID,
@ -255,7 +255,7 @@ func (s *Server) executeWebhook(ctx context.Context, webhook *types.Webhook, tri
// All execution.Request.XXX values are set accordingly // All execution.Request.XXX values are set accordingly
// NOTE: if the body is an io.Reader, the value is used as response body as is, otherwise it'll be JSON serialized. // NOTE: if the body is an io.Reader, the value is used as response body as is, otherwise it'll be JSON serialized.
func prepareHTTPRequest(ctx context.Context, execution *types.WebhookExecution, func prepareHTTPRequest(ctx context.Context, execution *types.WebhookExecution,
webhook *types.Webhook, body interface{}) (*http.Request, error) { webhook *types.Webhook, body any) (*http.Request, error) {
// set URL as is (already has been validated, any other error will be caught in request creation) // set URL as is (already has been validated, any other error will be caught in request creation)
execution.Request.URL = webhook.URL execution.Request.URL = webhook.URL

View File

@ -8,6 +8,7 @@ import (
"context" "context"
"github.com/harness/gitness/events" "github.com/harness/gitness/events"
"github.com/harness/gitness/gitrpc"
gitevents "github.com/harness/gitness/internal/events/git" gitevents "github.com/harness/gitness/internal/events/git"
"github.com/harness/gitness/internal/store" "github.com/harness/gitness/internal/store"
"github.com/harness/gitness/internal/url" "github.com/harness/gitness/internal/url"
@ -24,7 +25,7 @@ func ProvideServer(ctx context.Context, config Config,
gitReaderFactory *events.ReaderFactory[*gitevents.Reader], gitReaderFactory *events.ReaderFactory[*gitevents.Reader],
webhookStore store.WebhookStore, webhookExecutionStore store.WebhookExecutionStore, webhookStore store.WebhookStore, webhookExecutionStore store.WebhookExecutionStore,
repoStore store.RepoStore, urlProvider *url.Provider, repoStore store.RepoStore, urlProvider *url.Provider,
principalStore store.PrincipalStore) (*Server, error) { principalStore store.PrincipalStore, gitRPCClient gitrpc.Interface) (*Server, error) {
return NewServer(ctx, config, gitReaderFactory, webhookStore, webhookExecutionStore, return NewServer(ctx, config, gitReaderFactory, webhookStore, webhookExecutionStore,
repoStore, urlProvider, principalStore) repoStore, urlProvider, principalStore, gitRPCClient)
} }