gitlab_git 10.3.1 → 10.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55854e0a55dc3bbcfb18be3835834cf99c3f2c26
4
- data.tar.gz: 4d174b9be6315b47a1b45ed61e893863c7b3a68e
3
+ metadata.gz: 51076bd426c1093deb3ac7921090402ff3217397
4
+ data.tar.gz: 0bcd48cc52ef0ec8ecd4bcc7d45c892ec31b21d0
5
5
  SHA512:
6
- metadata.gz: 560d061fe203d069ee5cff609aa9645ff89bf760e25fe3d3740a6aa8d7bd3e9258bf78382b360cdaa9012cd8e08b0be18874f07c57d86c2a4984441dd52b0d59
7
- data.tar.gz: 9a1231145e9cccf76b992a11cdf961e5c161783cb8a6038be15c43dd3a00d562783f7d452c95b74caa01c8ff7de9120e08ad36ffcc5d4aafc97ef3e7f885d95d
6
+ metadata.gz: f84755a8d8474f773236438cb92d5264ce75ee935609faf2b6d9efe0210285c632bf157d4b599f46893075c6fe68ebe52c93ccc3b9053e3904a5f774057d8051
7
+ data.tar.gz: 6470f132620cff756f6c6810b4ef042ea2cab28eec465806fc38d5ab6f8199c6a8ac0832753fa652c1fb9e302eb02cca7c004a40b48729e10ea13325bcc3f7f6
data/VERSION CHANGED
@@ -1 +1 @@
1
- 10.3.1
1
+ 10.3.2
@@ -133,7 +133,7 @@ module Gitlab
133
133
  :include_untracked_content, :skip_binary_check,
134
134
  :include_typechange, :include_typechange_trees,
135
135
  :ignore_filemode, :recurse_ignored_dirs, :paths,
136
- :max_files, :max_lines, :all_diffs]
136
+ :max_files, :max_lines, :all_diffs, :no_collapse]
137
137
 
138
138
  if default_options
139
139
  actual_defaults = default_options.dup
@@ -208,6 +208,21 @@ module Gitlab
208
208
  @too_large = true
209
209
  end
210
210
 
211
+ def collapsed?
212
+ return @collapsed if defined?(@collapsed)
213
+ false
214
+ end
215
+
216
+ def collapsible?
217
+ @diff.bytesize >= 10240 # 10 KB
218
+ end
219
+
220
+ def prune_collapsed_diff!
221
+ @diff = ''
222
+ @line_count = 0
223
+ @collapsed = true
224
+ end
225
+
211
226
  private
212
227
 
213
228
  def init_from_rugged(rugged)
@@ -10,7 +10,11 @@ module Gitlab
10
10
  @max_files = options.fetch(:max_files, DEFAULT_LIMITS[:max_files])
11
11
  @max_lines = options.fetch(:max_lines, DEFAULT_LIMITS[:max_lines])
12
12
  @max_bytes = @max_files * 5120 # Average 5 KB per file
13
+ @safe_max_files = [@max_files, DEFAULT_LIMITS[:max_files]].min
14
+ @safe_max_lines = [@max_lines, DEFAULT_LIMITS[:max_lines]].min
15
+ @safe_max_bytes = @safe_max_files * 5120 # Average 5 KB per file
13
16
  @all_diffs = !!options.fetch(:all_diffs, false)
17
+ @no_collapse = !!options.fetch(:no_collapse, true)
14
18
 
15
19
  @line_count = 0
16
20
  @byte_count = 0
@@ -47,6 +51,12 @@ module Gitlab
47
51
  diff.prune_large_diff!
48
52
  end
49
53
 
54
+ if !@all_diffs && !@no_collapse
55
+ if diff.collapsible? || over_safe_limits?(i)
56
+ diff.prune_collapsed_diff!
57
+ end
58
+ end
59
+
50
60
  @line_count += diff.line_count
51
61
  @byte_count += diff.diff.bytesize
52
62
 
@@ -99,6 +109,10 @@ module Gitlab
99
109
  @populated = true
100
110
  nil
101
111
  end
112
+
113
+ def over_safe_limits?(files)
114
+ files >= @safe_max_files || @line_count > @safe_max_lines || @byte_count >= @safe_max_bytes
115
+ end
102
116
  end
103
117
  end
104
118
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_git
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.3.1
4
+ version: 10.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitriy Zaporozhets