gitlab_git 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gitlab_git/compare.rb +13 -11
- data/lib/gitlab_git/diff.rb +2 -2
- data/lib/gitlab_git/repository.rb +2 -2
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdfbfd59004423e86997c1ea7c70bfbcf685eb4b
|
4
|
+
data.tar.gz: 02e1b56a8f1dd1c3ea1af62cb6758df1e8584f2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b4d1899314ac9914ab7f7fa25cfdb2f90b464f27b6fb389ae1789e1e99b80e45125a74bb9acce4cea256af5771f400fc3666d01f6e571289a502551a47c9bbd
|
7
|
+
data.tar.gz: d00e12fd0cb1f3cfe2437ebc16b3b0714bc04e098e19679f4e637b89e5574c4ee59a0bc8bc475ad3557b26851b26cd27981cbe00921ae4e1af091da9a913a032
|
data/lib/gitlab_git/compare.rb
CHANGED
@@ -7,26 +7,28 @@ module Gitlab
|
|
7
7
|
@commits, @diffs = [], []
|
8
8
|
@commit = nil
|
9
9
|
@same = false
|
10
|
+
@limit = limit
|
11
|
+
@repository = repository
|
10
12
|
|
11
13
|
return unless from && to
|
12
14
|
|
13
|
-
base = Gitlab::Git::Commit.find(repository, from.try(:strip))
|
14
|
-
head = Gitlab::Git::Commit.find(repository, to.try(:strip))
|
15
|
+
@base = Gitlab::Git::Commit.find(repository, from.try(:strip))
|
16
|
+
@head = Gitlab::Git::Commit.find(repository, to.try(:strip))
|
15
17
|
|
16
|
-
return unless base && head
|
18
|
+
return unless @base && @head
|
17
19
|
|
18
|
-
if base.id == head.id
|
20
|
+
if @base.id == @head.id
|
19
21
|
@same = true
|
20
22
|
return
|
21
23
|
end
|
22
24
|
|
23
|
-
@commit = head
|
24
|
-
@commits = Gitlab::Git::Commit.between(repository, base.id, head.id)
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
@commit = @head
|
26
|
+
@commits = Gitlab::Git::Commit.between(repository, @base.id, @head.id)
|
27
|
+
end
|
28
|
+
|
29
|
+
def diffs(paths = nil)
|
30
|
+
return [] if @commits.size > @limit
|
31
|
+
Gitlab::Git::Diff.between(@repository, @head.id, @base.id, *paths) rescue []
|
30
32
|
end
|
31
33
|
end
|
32
34
|
end
|
data/lib/gitlab_git/diff.rb
CHANGED
@@ -15,13 +15,13 @@ module Gitlab
|
|
15
15
|
attr_accessor :new_file, :renamed_file, :deleted_file
|
16
16
|
|
17
17
|
class << self
|
18
|
-
def between(repo, head, base)
|
18
|
+
def between(repo, head, base, *paths)
|
19
19
|
# Only show what is new in the source branch compared to the target branch, not the other way around.
|
20
20
|
# The linex below with merge_base is equivalent to diff with three dots (git diff branch1...branch2)
|
21
21
|
# From the git documentation: "git diff A...B" is equivalent to "git diff $(git-merge-base A B) B"
|
22
22
|
common_commit = repo.merge_base_commit(head, base)
|
23
23
|
|
24
|
-
repo.diff(common_commit, head).map do |diff|
|
24
|
+
repo.diff(common_commit, head, *paths).map do |diff|
|
25
25
|
Gitlab::Git::Diff.new(diff)
|
26
26
|
end
|
27
27
|
rescue Grit::Git::GitTimeout
|
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.
|
4
|
+
version: 4.1.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:
|
11
|
+
date: 2014-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gitlab-linguist
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 2.6.1
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: gitlab-pygments.rb
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ~>
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 0.5.4
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ~>
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 0.5.4
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: activesupport
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|