gitlab_git 10.4.1 → 10.4.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: 7c6105a4756fd689a3d5c54d7335c9873364c473
4
- data.tar.gz: 3f7005c2ae1c7f1ba84984559547040f851215ff
3
+ metadata.gz: e30dbf365616d1882c82f8b7dab9df82a263fbbd
4
+ data.tar.gz: 2fa32f9affdc6f0b431b598b463c7c0a8584aa4f
5
5
  SHA512:
6
- metadata.gz: 55d94d228cb06b35c0aa375833387170f503ba2e05e2c89b5775f91de9f40e534472e4100777ac3c568c64d8c0347969ecf599103cacb5b28766e0fc120c79c4
7
- data.tar.gz: 903ef839de16ca0ce55b063cb5626f67863e59461ad14f818ca19d30faacc8b7d62cca303f611a72beda7892b5a6fe9216e3cfbf2bc13981a1851e380f34ebe4
6
+ metadata.gz: b39cbb770c89b34fc94a9e9758ddc7ef8be5ceb89c6f403c85ba3b883ef9f1ee0ca4ba86b806ffb1b04363716e5941f5ba52cd90428f47ace13de9c043480fe0
7
+ data.tar.gz: 987439cb257e6b0dbcfb794f522888ed47ca63a1d7c04c8c5fdff607fd27cad6569e01ecdfef2cabb6de6122861caf8be38a9970bfb4622c74fe646d6a20fdf0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 10.4.1
1
+ 10.4.2
@@ -23,51 +23,58 @@ module Gitlab
23
23
  end
24
24
 
25
25
  def each
26
- @iterator.each_with_index do |raw, i|
27
- # First yield cached Diff instances from @array
28
- if @array[i]
29
- yield @array[i]
30
- next
26
+ if @populated
27
+ # @iterator.each is slower than just iterating the array in place
28
+ @array.each do |item|
29
+ yield item
31
30
  end
31
+ else
32
+ @iterator.each_with_index do |raw, i|
33
+ # First yield cached Diff instances from @array
34
+ if @array[i]
35
+ yield @array[i]
36
+ next
37
+ end
32
38
 
33
- # We have exhausted @array, time to create new Diff instances or stop.
34
- break if @overflow
39
+ # We have exhausted @array, time to create new Diff instances or stop.
40
+ break if @overflow
35
41
 
36
- if !@all_diffs && i >= @max_files
37
- @overflow = true
38
- break
39
- end
42
+ if !@all_diffs && i >= @max_files
43
+ @overflow = true
44
+ break
45
+ end
40
46
 
41
- # Going by the number of files alone it is OK to create a new Diff instance.
42
- diff = Gitlab::Git::Diff.new(raw)
43
-
44
- # If a diff is too large we still want to display some information
45
- # about it (e.g. the file path) without keeping the raw data around
46
- # (as this would be a waste of memory usage).
47
- #
48
- # This also removes the line count (from the diff itself) so it
49
- # doesn't add up to the total amount of lines.
50
- if diff.too_large?
51
- diff.prune_large_diff!
52
- end
47
+ # Going by the number of files alone it is OK to create a new Diff instance.
48
+ diff = Gitlab::Git::Diff.new(raw)
49
+
50
+ # If a diff is too large we still want to display some information
51
+ # about it (e.g. the file path) without keeping the raw data around
52
+ # (as this would be a waste of memory usage).
53
+ #
54
+ # This also removes the line count (from the diff itself) so it
55
+ # doesn't add up to the total amount of lines.
56
+ if diff.too_large?
57
+ diff.prune_large_diff!
58
+ end
53
59
 
54
- if !@all_diffs && !@no_collapse
55
- if diff.collapsible? || over_safe_limits?(i)
56
- diff.prune_collapsed_diff!
60
+ if !@all_diffs && !@no_collapse
61
+ if diff.collapsible? || over_safe_limits?(i)
62
+ diff.prune_collapsed_diff!
63
+ end
57
64
  end
58
- end
59
65
 
60
- @line_count += diff.line_count
61
- @byte_count += diff.diff.bytesize
66
+ @line_count += diff.line_count
67
+ @byte_count += diff.diff.bytesize
62
68
 
63
- if !@all_diffs && (@line_count >= @max_lines || @byte_count >= @max_bytes)
64
- # This last Diff instance pushes us over the lines limit. We stop and
65
- # discard it.
66
- @overflow = true
67
- break
68
- end
69
+ if !@all_diffs && (@line_count >= @max_lines || @byte_count >= @max_bytes)
70
+ # This last Diff instance pushes us over the lines limit. We stop and
71
+ # discard it.
72
+ @overflow = true
73
+ break
74
+ end
69
75
 
70
- yield @array[i] = diff
76
+ yield @array[i] = diff
77
+ end
71
78
  end
72
79
  end
73
80
 
@@ -81,7 +88,7 @@ module Gitlab
81
88
  end
82
89
 
83
90
  def size
84
- @size ||= count # forces a loop through @iterator
91
+ @size ||= count # forces a loop using each method
85
92
  end
86
93
 
87
94
  def real_size
@@ -95,9 +102,11 @@ module Gitlab
95
102
  end
96
103
 
97
104
  def decorate!
98
- each_with_index do |element, i|
105
+ collection = each_with_index do |element, i|
99
106
  @array[i] = yield(element)
100
107
  end
108
+ @populated = true
109
+ collection
101
110
  end
102
111
 
103
112
  private
@@ -1,6 +1,7 @@
1
1
  # Gitlab::Git::Repository is a wrapper around native Rugged::Repository object
2
2
  require_relative 'encoding_helper'
3
3
  require_relative 'path_helper'
4
+ require 'forwardable'
4
5
  require 'tempfile'
5
6
  require "rubygems/package"
6
7
 
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: 10.4.1
4
+ version: 10.4.2
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-07-21 00:00:00.000000000 Z
11
+ date: 2016-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: github-linguist
@@ -125,8 +125,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  version: '0'
126
126
  requirements: []
127
127
  rubyforge_project:
128
- rubygems_version: 2.4.8
128
+ rubygems_version: 2.5.1
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: Gitlab::Git library
132
132
  test_files: []
133
+ has_rdoc: