gitlab_git 5.3.0 → 5.4.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.rb +1 -0
- data/lib/gitlab_git/compare.rb +28 -4
- data/lib/gitlab_git/diff.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a55120d34d9e9b2087ebb986213e27d01d1fe76b
|
4
|
+
data.tar.gz: fa165fd88b30db8cdfe33b0d9525088b0f505993
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a271874e14e54fca6437a92709b0249383983f80f2d49439f11ff12b4e195ca347f8c3de8b46523b01f3225241859eae00b8695d85d4fefb7fe839814eda9aed
|
7
|
+
data.tar.gz: e5445e97d57aaf696886791a17aba0e1e1e1dd177d8e68cc9b7aa68d4915b50f9697c7d5d9d4e504778665f1eb7111895b721a306e1739b05d06f06d2b9d250d
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.
|
1
|
+
5.4.0
|
data/lib/gitlab_git.rb
CHANGED
data/lib/gitlab_git/compare.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Gitlab
|
2
2
|
module Git
|
3
3
|
class Compare
|
4
|
-
attr_accessor :commits, :commit, :diffs, :same
|
4
|
+
attr_accessor :commits, :commit, :diffs, :same, :limit, :timeout
|
5
5
|
|
6
6
|
def initialize(repository, from, to, limit = 100)
|
7
7
|
@commits, @diffs = [], []
|
@@ -9,6 +9,7 @@ module Gitlab
|
|
9
9
|
@same = false
|
10
10
|
@limit = limit
|
11
11
|
@repository = repository
|
12
|
+
@timeout = false
|
12
13
|
|
13
14
|
return unless from && to
|
14
15
|
|
@@ -27,10 +28,33 @@ module Gitlab
|
|
27
28
|
end
|
28
29
|
|
29
30
|
def diffs(paths = nil)
|
30
|
-
|
31
|
-
|
31
|
+
# Return empty array if amount of commits
|
32
|
+
# more than specified limit
|
33
|
+
return [] if commits_over_limit?
|
34
|
+
|
35
|
+
# Try to collect diff only if diffs is empty
|
36
|
+
# Otherwise return cached version
|
37
|
+
if @diffs.empty? && @timeout == false
|
38
|
+
begin
|
39
|
+
@diffs = Gitlab::Git::Diff.between(@repository, @head.id, @base.id, *paths)
|
40
|
+
rescue Gitlab::Git::Diff::TimeoutError => ex
|
41
|
+
@diffs = []
|
42
|
+
@timeout = true
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
@diffs
|
47
|
+
end
|
48
|
+
|
49
|
+
# Check if diff is empty because it is actually empty
|
50
|
+
# and not because its impossible to get it
|
51
|
+
def empty_diff?
|
52
|
+
diffs.empty? && timeout == false && commits.size < limit
|
53
|
+
end
|
54
|
+
|
55
|
+
def commits_over_limit?
|
56
|
+
commits.size > limit
|
32
57
|
end
|
33
58
|
end
|
34
59
|
end
|
35
60
|
end
|
36
|
-
|
data/lib/gitlab_git/diff.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
module Gitlab
|
5
5
|
module Git
|
6
6
|
class Diff
|
7
|
-
|
7
|
+
class TimeoutError < StandardError; end
|
8
8
|
|
9
9
|
attr_accessor :raw_diff
|
10
10
|
|
@@ -25,7 +25,7 @@ module Gitlab
|
|
25
25
|
Gitlab::Git::Diff.new(diff)
|
26
26
|
end
|
27
27
|
rescue Grit::Git::GitTimeout
|
28
|
-
|
28
|
+
raise TimeoutError.new("Diff.between exited with timeout")
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
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: 5.
|
4
|
+
version: 5.4.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: 2014-02-
|
11
|
+
date: 2014-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gitlab-linguist
|