gitlab_git 4.0.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2108e7b969cd3dac473e6eb14311a72bf84972d
4
- data.tar.gz: cafd1804445e5ee667fc98e9c6d9aa4d2c6d346b
3
+ metadata.gz: bdfbfd59004423e86997c1ea7c70bfbcf685eb4b
4
+ data.tar.gz: 02e1b56a8f1dd1c3ea1af62cb6758df1e8584f2e
5
5
  SHA512:
6
- metadata.gz: d7005c9028474ca9bfc742980c1e66010add94963d1959bc37cedea82718ca448a7091d23155f69625199d0492ae630d006b7fc35a706448183081e0b34bc6ff
7
- data.tar.gz: a6f8bdfe302fa68d094dc1bd3ed19aa217a028efb24cc0166e97bcf26c50cf8a0ca644c3c5a8bd84de9512c3154970f38b21293715a9dd7ae0d1f5d9b4d791c9
6
+ metadata.gz: 2b4d1899314ac9914ab7f7fa25cfdb2f90b464f27b6fb389ae1789e1e99b80e45125a74bb9acce4cea256af5771f400fc3666d01f6e571289a502551a47c9bbd
7
+ data.tar.gz: d00e12fd0cb1f3cfe2437ebc16b3b0714bc04e098e19679f4e637b89e5574c4ee59a0bc8bc475ad3557b26851b26cd27981cbe00921ae4e1af091da9a913a032
@@ -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
- @diffs = if @commits.size > limit
26
- []
27
- else
28
- Gitlab::Git::Diff.between(repository, head.id, base.id) rescue []
29
- end
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
@@ -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
@@ -200,8 +200,8 @@ module Gitlab
200
200
  grit.git.native(:merge_base, {}, [to, from]).strip
201
201
  end
202
202
 
203
- def diff(from, to)
204
- grit.diff(from, to)
203
+ def diff(from, to, *paths)
204
+ grit.diff(from, to, *paths)
205
205
  end
206
206
 
207
207
  # Returns commits collection
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.0.0
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: 2013-12-26 00:00:00.000000000 Z
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