gitlab_git 10.6.8 → 10.7.0

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: c0988bb5a3617f4bac08f53781bea813be09c7a9
4
- data.tar.gz: 0ce71e0cf618cf267c0b2ef057cb6153026b6274
3
+ metadata.gz: 170a3ddbc4b9f64384951aa39f1ff0587aa966b8
4
+ data.tar.gz: fd220061aea1df75b942f4f798c3e8122bce3143
5
5
  SHA512:
6
- metadata.gz: 241ab6732a48d690d39a71d57d8bc311fa7ea7dc5b6fe992fb71ea1e31b407166203c16ebb48762a688933c0a014d92c4138ac1d3abbdaab46e2ecda80f20be6
7
- data.tar.gz: 904a3b9e9f1c2ded3568c3fbd697bbda11f3c2b20c0fe903bdfeb9cdcd1a89cf386f96c0c6a20dcf4080638798961b6a7b36235e70d5ae94bd00b3c6521d75c5
6
+ metadata.gz: 06df3838918c6c9f544e768a403716600b7907d77a3b47c7b79e3da7f93ce18569ab39cbe27b3f3052d27dfcfd49a8df48feafe80aeb51d911060f4cfc285290
7
+ data.tar.gz: 1989d5dde3ac74aca89cfcfe3107f77176e7e6027a5009dba85166dc08ee2ed3ca3283e17f02e0cdb96f1a3d4bfa7dc924b80f1af3fce3f9e009cf431e2f609a
data/VERSION CHANGED
@@ -1 +1 @@
1
- 10.6.8
1
+ 10.7.0
@@ -99,6 +99,8 @@ module Gitlab
99
99
 
100
100
  File.open(full_path, 'r') do |handle|
101
101
  handle.each_line do |line|
102
+ break unless line.valid_encoding?
103
+
102
104
  yield line.strip
103
105
  end
104
106
  end
@@ -261,17 +261,7 @@ module Gitlab
261
261
  def init_from_rugged_patch(patch, collapse: false)
262
262
  # Don't bother initializing diffs that are too large. If a diff is
263
263
  # binary we're not going to display anything so we skip the size check.
264
- unless patch.delta.binary?
265
- diff_size = patch_size(patch)
266
-
267
- if diff_size >= DIFF_SIZE_LIMIT
268
- prune_large_diff!
269
- return
270
- elsif collapse && diff_size >= DIFF_COLLAPSE_LIMIT
271
- prune_collapsed_diff!
272
- return
273
- end
274
- end
264
+ return if !patch.delta.binary? && prune_large_patch(patch, collapse)
275
265
 
276
266
  @diff = encode!(strip_diff_headers(patch.to_s))
277
267
  end
@@ -287,17 +277,28 @@ module Gitlab
287
277
  prune_collapsed_diff! if collapse && collapsible?
288
278
  end
289
279
 
290
- # Returns the size of a diff without taking any diff markers into account.
291
- def patch_size(patch)
280
+ # If the patch surpasses any of the diff limits it calls the appropiate
281
+ # prune method and returns true. Otherwise returns false.
282
+ def prune_large_patch(patch, collapse)
292
283
  size = 0
293
284
 
294
285
  patch.each_hunk do |hunk|
295
286
  hunk.each_line do |line|
296
287
  size += line.content.bytesize
288
+
289
+ if size >= DIFF_SIZE_LIMIT
290
+ prune_large_diff!
291
+ return true
292
+ end
297
293
  end
298
294
  end
299
295
 
300
- size
296
+ if collapse && size >= DIFF_COLLAPSE_LIMIT
297
+ prune_collapsed_diff!
298
+ return true
299
+ end
300
+
301
+ false
301
302
  end
302
303
 
303
304
  # Strip out the information at the beginning of the patch's text to match
@@ -12,6 +12,10 @@ module Gitlab
12
12
  # when tag reference on other tag it can be tag sha
13
13
  attr_reader :target
14
14
 
15
+ # Dereferenced target
16
+ # Commit object to which the Ref points to
17
+ attr_reader :dereferenced_target
18
+
15
19
  # Extract branch name from full ref path
16
20
  #
17
21
  # Ex.
@@ -29,8 +33,16 @@ module Gitlab
29
33
  def initialize(repository, name, target)
30
34
  encode! name
31
35
  @name = name.gsub(/\Arefs\/(tags|heads)\//, '')
32
-
33
- @target = Commit.find(repository, target)
36
+ @dereferenced_target = Commit.find(repository, target)
37
+ @target = if target.respond_to?(:oid)
38
+ target.oid
39
+ elsif target.respond_to?(:name)
40
+ target.name
41
+ elsif target.is_a? String
42
+ target
43
+ else
44
+ nil
45
+ end
34
46
  end
35
47
  end
36
48
  end
@@ -116,17 +116,14 @@ module Gitlab
116
116
  message = nil
117
117
 
118
118
  if ref.target.is_a?(Rugged::Tag::Annotation)
119
- object = ref.target
120
119
  tag_message = ref.target.message
121
120
 
122
121
  if tag_message.respond_to?(:chomp)
123
122
  message = tag_message.chomp
124
123
  end
125
- else
126
- object = nil # Lightweight tags aren't git objects
127
124
  end
128
125
 
129
- Tag.new(self, object, ref.name, ref.target, message)
126
+ Tag.new(self, ref.name, ref.target, message)
130
127
  end.sort_by(&:name)
131
128
  end
132
129
 
@@ -3,23 +3,17 @@ module Gitlab
3
3
  class Tag < Ref
4
4
  attr_reader :object_sha
5
5
 
6
- def initialize(repository, object, name, target, message = nil)
6
+ def initialize(repository, name, target, message = nil)
7
7
  super(repository, name, target)
8
- @object_sha = if object.respond_to?(:oid)
9
- object.oid
10
- elsif object.respond_to?(:name)
11
- object.name
12
- elsif object.is_a? String
13
- object
14
- else
15
- nil
16
- end
8
+
17
9
  @message = message
18
10
  end
19
11
 
20
12
  def message
21
13
  encode! @message
22
14
  end
15
+
16
+ private
23
17
  end
24
18
  end
25
19
  end
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_git
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.6.8
4
+ version: 10.7.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-09-29 00:00:00.000000000 Z
11
+ date: 2016-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: github-linguist
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: 4.7.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: 4.7.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '4.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '4.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rugged
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
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
54
  version: 0.24.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: charlock_holmes
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.7.3
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.7.3
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: listen
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
75
  version: 3.0.6
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: 3.0.6
83
83
  description: GitLab wrapper around git objects
@@ -116,12 +116,12 @@ require_paths:
116
116
  - lib
117
117
  required_ruby_version: !ruby/object:Gem::Requirement
118
118
  requirements:
119
- - - ">="
119
+ - - '>='
120
120
  - !ruby/object:Gem::Version
121
121
  version: '0'
122
122
  required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  requirements:
124
- - - ">="
124
+ - - '>='
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
127
  requirements: []