gitlab_git 10.3.1 → 10.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/gitlab_git/diff.rb +16 -1
- data/lib/gitlab_git/diff_collection.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51076bd426c1093deb3ac7921090402ff3217397
|
4
|
+
data.tar.gz: 0bcd48cc52ef0ec8ecd4bcc7d45c892ec31b21d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f84755a8d8474f773236438cb92d5264ce75ee935609faf2b6d9efe0210285c632bf157d4b599f46893075c6fe68ebe52c93ccc3b9053e3904a5f774057d8051
|
7
|
+
data.tar.gz: 6470f132620cff756f6c6810b4ef042ea2cab28eec465806fc38d5ab6f8199c6a8ac0832753fa652c1fb9e302eb02cca7c004a40b48729e10ea13325bcc3f7f6
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
10.3.
|
1
|
+
10.3.2
|
data/lib/gitlab_git/diff.rb
CHANGED
@@ -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
|