From 0225a747caf1d06b532871750f54c048c70e5c55 Mon Sep 17 00:00:00 2001 From: Ahmad Sherif Date: Mon, 10 Jul 2017 22:16:03 +0200 Subject: [PATCH] Add limit fields to CommitDiffRequest --- diff.proto | 12 +++ go/diff.pb.go | 155 +++++++++++++++++++++++++++++-------- ruby/lib/gitaly/diff_pb.rb | 10 +++ 3 files changed, 145 insertions(+), 32 deletions(-) diff --git a/diff.proto b/diff.proto index 41b21ec2..7b4a6797 100644 --- a/diff.proto +++ b/diff.proto @@ -17,6 +17,14 @@ message CommitDiffRequest { string right_commit_id = 3; bool ignore_whitespace_change = 4; repeated bytes paths = 5; + bool collapse_diffs = 6; + bool enforce_limits = 7; + int32 max_files = 8; + int32 max_lines = 9; + int32 max_bytes = 10; + int32 safe_max_files = 11; + int32 safe_max_lines = 12; + int32 safe_max_bytes = 13; } // A CommitDiffResponse corresponds to a single changed file in a commit. @@ -33,6 +41,10 @@ message CommitDiffResponse { bool binary = 7; bytes raw_patch_data = 9; bool end_of_patch = 10; + // Indicates the diff file at which we overflow according to the limitations sent, + // in which case only this attribute will be set. + bool overflow_marker = 11; + bool collapsed = 12; } message CommitDeltaRequest { diff --git a/go/diff.pb.go b/go/diff.pb.go index aa5f4288..08f933cb 100644 --- a/go/diff.pb.go +++ b/go/diff.pb.go @@ -23,6 +23,14 @@ type CommitDiffRequest struct { RightCommitId string `protobuf:"bytes,3,opt,name=right_commit_id,json=rightCommitId" json:"right_commit_id,omitempty"` IgnoreWhitespaceChange bool `protobuf:"varint,4,opt,name=ignore_whitespace_change,json=ignoreWhitespaceChange" json:"ignore_whitespace_change,omitempty"` Paths [][]byte `protobuf:"bytes,5,rep,name=paths,proto3" json:"paths,omitempty"` + CollapseDiffs bool `protobuf:"varint,6,opt,name=collapse_diffs,json=collapseDiffs" json:"collapse_diffs,omitempty"` + EnforceLimits bool `protobuf:"varint,7,opt,name=enforce_limits,json=enforceLimits" json:"enforce_limits,omitempty"` + MaxFiles int32 `protobuf:"varint,8,opt,name=max_files,json=maxFiles" json:"max_files,omitempty"` + MaxLines int32 `protobuf:"varint,9,opt,name=max_lines,json=maxLines" json:"max_lines,omitempty"` + MaxBytes int32 `protobuf:"varint,10,opt,name=max_bytes,json=maxBytes" json:"max_bytes,omitempty"` + SafeMaxFiles int32 `protobuf:"varint,11,opt,name=safe_max_files,json=safeMaxFiles" json:"safe_max_files,omitempty"` + SafeMaxLines int32 `protobuf:"varint,12,opt,name=safe_max_lines,json=safeMaxLines" json:"safe_max_lines,omitempty"` + SafeMaxBytes int32 `protobuf:"varint,13,opt,name=safe_max_bytes,json=safeMaxBytes" json:"safe_max_bytes,omitempty"` } func (m *CommitDiffRequest) Reset() { *m = CommitDiffRequest{} } @@ -65,6 +73,62 @@ func (m *CommitDiffRequest) GetPaths() [][]byte { return nil } +func (m *CommitDiffRequest) GetCollapseDiffs() bool { + if m != nil { + return m.CollapseDiffs + } + return false +} + +func (m *CommitDiffRequest) GetEnforceLimits() bool { + if m != nil { + return m.EnforceLimits + } + return false +} + +func (m *CommitDiffRequest) GetMaxFiles() int32 { + if m != nil { + return m.MaxFiles + } + return 0 +} + +func (m *CommitDiffRequest) GetMaxLines() int32 { + if m != nil { + return m.MaxLines + } + return 0 +} + +func (m *CommitDiffRequest) GetMaxBytes() int32 { + if m != nil { + return m.MaxBytes + } + return 0 +} + +func (m *CommitDiffRequest) GetSafeMaxFiles() int32 { + if m != nil { + return m.SafeMaxFiles + } + return 0 +} + +func (m *CommitDiffRequest) GetSafeMaxLines() int32 { + if m != nil { + return m.SafeMaxLines + } + return 0 +} + +func (m *CommitDiffRequest) GetSafeMaxBytes() int32 { + if m != nil { + return m.SafeMaxBytes + } + return 0 +} + // A CommitDiffResponse corresponds to a single changed file in a commit. type CommitDiffResponse struct { FromPath []byte `protobuf:"bytes,1,opt,name=from_path,json=fromPath,proto3" json:"from_path,omitempty"` @@ -77,6 +141,10 @@ type CommitDiffResponse struct { Binary bool `protobuf:"varint,7,opt,name=binary" json:"binary,omitempty"` RawPatchData []byte `protobuf:"bytes,9,opt,name=raw_patch_data,json=rawPatchData,proto3" json:"raw_patch_data,omitempty"` EndOfPatch bool `protobuf:"varint,10,opt,name=end_of_patch,json=endOfPatch" json:"end_of_patch,omitempty"` + // Indicates the diff file at which we overflow according to the limitations sent, + // in which case only this attribute will be set. + OverflowMarker bool `protobuf:"varint,11,opt,name=overflow_marker,json=overflowMarker" json:"overflow_marker,omitempty"` + Collapsed bool `protobuf:"varint,12,opt,name=collapsed" json:"collapsed,omitempty"` } func (m *CommitDiffResponse) Reset() { *m = CommitDiffResponse{} } @@ -147,6 +215,20 @@ func (m *CommitDiffResponse) GetEndOfPatch() bool { return false } +func (m *CommitDiffResponse) GetOverflowMarker() bool { + if m != nil { + return m.OverflowMarker + } + return false +} + +func (m *CommitDiffResponse) GetCollapsed() bool { + if m != nil { + return m.Collapsed + } + return false +} + type CommitDeltaRequest struct { Repository *Repository `protobuf:"bytes,1,opt,name=repository" json:"repository,omitempty"` LeftCommitId string `protobuf:"bytes,2,opt,name=left_commit_id,json=leftCommitId" json:"left_commit_id,omitempty"` @@ -434,36 +516,45 @@ var _DiffService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("diff.proto", fileDescriptor3) } var fileDescriptor3 = []byte{ - // 481 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0x4f, 0x8e, 0xd3, 0x30, - 0x14, 0xc6, 0x71, 0xdb, 0xa4, 0xe9, 0x6b, 0xf8, 0xe7, 0xa2, 0xc1, 0xd3, 0xd9, 0x44, 0x11, 0x42, - 0x91, 0x90, 0x2a, 0x54, 0x36, 0xac, 0x99, 0x91, 0x50, 0x47, 0x42, 0x8c, 0xc2, 0x82, 0x65, 0xe4, - 0x89, 0x9d, 0xc6, 0x52, 0x1a, 0x07, 0xc7, 0x10, 0xf5, 0x1e, 0x9c, 0x80, 0x0d, 0x1b, 0xae,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 0xc8, 0x39, 0xfe, 0x08, 0x70, 0x5c, 0x61, - 0x7c, 0xfe, 0xdf, 0xd5, 0xe3, 0xdf, 0x77, 0xb9, 0x3c, 0x85, 0x5c, 0x82, 0xf8, 0xd1, 0x5b, 0x84, - 0xaf, 0xef, 0x77, 0x71, 0x79, 0x2a, 0xc4, 0xa1, 0xd4, 0xc5, 0x49, 0x76, 0xac, 0x75, 0xeb, 0xdb, - 0xef, 0xc8, 0xbb, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x4b, 0xf5, 0xb7, 0x6e, 0x6b, 0x04, 0x00, - 0x00, + // 629 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0xcf, 0x6e, 0xdb, 0x38, + 0x10, 0xc6, 0x57, 0xb1, 0xad, 0xc8, 0x63, 0x25, 0xd9, 0x65, 0x16, 0x59, 0xc5, 0xd9, 0x83, 0x60, + 0xf4, 0x8f, 0x81, 0x02, 0x41, 0xe1, 0x5e, 0x7a, 0x4e, 0x82, 0x16, 0x09, 0x12, 0x34, 0x50, 0x0f, + 0x3d, 0x0a, 0x8c, 0x38, 0xb2, 0x88, 0x4a, 0xa2, 0x4b, 0xb2, 0x71, 0xfc, 0x3a, 0xbd, 0xf4, 0xd2, + 0x37, 0xea, 0xab, 0xf4, 0x50, 0x90, 0xb4, 0x64, 0xb9, 0xc8, 0x03, 0xe4, 0x38, 0xdf, 0xef, 0xd3, + 0xcc, 0x68, 0x86, 0x24, 0x00, 0xe3, 0x79, 0x7e, 0xba, 0x90, 0x42, 0x0b, 0xe2, 0xcf, 0xb9, 0xa6, + 0xe5, 0x6a, 0x1c, 0xaa, 0x82, 0x4a, 0x64, 0x4e, 0x9d, 0xfc, 0xea, 0xc1, 0x3f, 0xe7, 0xa2, 0xaa, + 0xb8, 0xbe, 0xe0, 0x79, 0x9e, 0xe0, 0x97, 0xaf, 0xa8, 0x34, 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x10, 0x24, 0xfb, 0x8d, 0x7c, 0x63, 0x55, 0xf2, 0x3f, + 0x0c, 0x9b, 0xa3, 0xc3, 0xec, 0x02, 0x82, 0x64, 0x23, 0x5c, 0xf5, 0x83, 0xe0, 0xef, 0xe1, 0xe4, + 0x87, 0xd7, 0x4e, 0x17, 0x4b, 0x4d, 0x9f, 0xce, 0xed, 0x6a, 0xef, 0x48, 0xbf, 0x73, 0x47, 0x26, + 0xdf, 0x3d, 0x18, 0x75, 0xda, 0x7d, 0xba, 0xa7, 0x60, 0x72, 0x06, 0x87, 0x5b, 0x73, 0x5d, 0x1f, + 0xdb, 0x57, 0xe0, 0x33, 0x23, 0xa8, 0xc8, 0x8b, 0x7b, 0xd3, 0xd1, 0xec, 0xb0, 0x19, 0x6a, 0xd7, + 0xbc, 0xb6, 0xcc, 0xbe, 0x79, 0x30, 0x32, 0x87, 0xfe, 0x23, 0xca, 0x7b, 0x9e, 0x21, 0x79, 0x0f, + 0xb0, 0xb9, 0x09, 0xe4, 0xf8, 0x8f, 0x4f, 0x37, 0x8f, 0xe3, 0x78, 0xfc, 0x18, 0x72, 0x1d, 0x4c, + 0xfe, 0x7a, 0xed, 0x91, 0xab, 0xed, 0x29, 0x8e, 0x1f, 0x6b, 0x62, 0x9d, 0xea, 0xe4, 0x51, 0xb6, + 0xc9, 0x75, 0xe7, 0xdb, 0x57, 0xfa, 0xcd, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2a, 0x75, 0x5b, + 0xf9, 0xc9, 0x05, 0x00, 0x00, } diff --git a/ruby/lib/gitaly/diff_pb.rb b/ruby/lib/gitaly/diff_pb.rb index 47f8a534..5ad3e27b 100644 --- a/ruby/lib/gitaly/diff_pb.rb +++ b/ruby/lib/gitaly/diff_pb.rb @@ -11,6 +11,14 @@ Google::Protobuf::DescriptorPool.generated_pool.build do optional :right_commit_id, :string, 3 optional :ignore_whitespace_change, :bool, 4 repeated :paths, :bytes, 5 + optional :collapse_diffs, :bool, 6 + optional :enforce_limits, :bool, 7 + optional :max_files, :int32, 8 + optional :max_lines, :int32, 9 + optional :max_bytes, :int32, 10 + optional :safe_max_files, :int32, 11 + optional :safe_max_lines, :int32, 12 + optional :safe_max_bytes, :int32, 13 end add_message "gitaly.CommitDiffResponse" do optional :from_path, :bytes, 1 @@ -22,6 +30,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do optional :binary, :bool, 7 optional :raw_patch_data, :bytes, 9 optional :end_of_patch, :bool, 10 + optional :overflow_marker, :bool, 11 + optional :collapsed, :bool, 12 end add_message "gitaly.CommitDeltaRequest" do optional :repository, :message, 1, "gitaly.Repository" -- GitLab