gitlab_git 9.0.3 → 10.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/gitlab_git/diff.rb +17 -1
- data/lib/gitlab_git/diff_collection.rb +11 -0
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31c6a37123aa6b3d2a4e5a51508fd0bb46f3fa65
|
4
|
+
data.tar.gz: 1f9dd6e2548aca96d1b367435e131c78b1c12679
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1852e5944d7ec3a02a0c745aa09d381f72cd9233b7bbb92d1ab38582e346ba900b75faea720aa0cdf51c3b8c86e7b1b94c5a8d69e52f105cd1e2ec35de51d7c4
|
7
|
+
data.tar.gz: 9ea1b801930d276a3de2cbf0ff3ad7e425a333d744c6d18ff34f769d00ff8c4d63a7916feef21632f45a87f2678e3c59c2d1539de79afc7edd64a1c7ccb35441
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
10.0.0
|
data/lib/gitlab_git/diff.rb
CHANGED
@@ -11,6 +11,8 @@ module Gitlab
|
|
11
11
|
# Stats properties
|
12
12
|
attr_accessor :new_file, :renamed_file, :deleted_file
|
13
13
|
|
14
|
+
attr_accessor :too_large
|
15
|
+
|
14
16
|
class << self
|
15
17
|
def between(repo, head, base, options = {}, *paths)
|
16
18
|
# Only show what is new in the source branch compared to the target branch, not the other way around.
|
@@ -169,7 +171,7 @@ module Gitlab
|
|
169
171
|
end
|
170
172
|
|
171
173
|
def serialize_keys
|
172
|
-
@serialize_keys ||= %i(diff new_path old_path a_mode b_mode new_file renamed_file deleted_file)
|
174
|
+
@serialize_keys ||= %i(diff new_path old_path a_mode b_mode new_file renamed_file deleted_file too_large)
|
173
175
|
end
|
174
176
|
|
175
177
|
def to_hash
|
@@ -192,6 +194,20 @@ module Gitlab
|
|
192
194
|
@line_count ||= Util.count_lines(@diff)
|
193
195
|
end
|
194
196
|
|
197
|
+
def too_large?
|
198
|
+
if @too_large.nil?
|
199
|
+
@too_large = @diff.bytesize >= 102400 # 100 KB
|
200
|
+
else
|
201
|
+
@too_large
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
def prune_large_diff!
|
206
|
+
@diff = ''
|
207
|
+
@line_count = 0
|
208
|
+
@too_large = true
|
209
|
+
end
|
210
|
+
|
195
211
|
private
|
196
212
|
|
197
213
|
def init_from_rugged(rugged)
|
@@ -35,7 +35,18 @@ module Gitlab
|
|
35
35
|
# Going by the number of files alone it is OK to create a new Diff instance.
|
36
36
|
diff = Gitlab::Git::Diff.new(raw)
|
37
37
|
|
38
|
+
# If a diff is too large we still want to display some information
|
39
|
+
# about it (e.g. the file path) without keeping the raw data around
|
40
|
+
# (as this would be a waste of memory usage).
|
41
|
+
#
|
42
|
+
# This also removes the line count (from the diff itself) so it
|
43
|
+
# doesn't add up to the total amount of lines.
|
44
|
+
if diff.too_large?
|
45
|
+
diff.prune_large_diff!
|
46
|
+
end
|
47
|
+
|
38
48
|
@line_count += diff.line_count
|
49
|
+
|
39
50
|
if !@all_diffs && @line_count >= @max_lines
|
40
51
|
# This last Diff instance pushes us over the lines limit. We stop and
|
41
52
|
# discard it.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab_git
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 10.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitriy Zaporozhets
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: github-linguist
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.24.
|
47
|
+
version: 0.24.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.24.
|
54
|
+
version: 0.24.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: charlock_holmes
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -111,8 +111,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
111
|
version: '0'
|
112
112
|
requirements: []
|
113
113
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.
|
114
|
+
rubygems_version: 2.5.1
|
115
115
|
signing_key:
|
116
116
|
specification_version: 4
|
117
117
|
summary: Gitlab::Git library
|
118
118
|
test_files: []
|
119
|
+
has_rdoc:
|