gitlab_git 2.1.1 → 2.2.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: 5ebbcb7c820cc43073ff11a89608553f4bb7abac
4
- data.tar.gz: f060d02e573af1d86065507f29a0dc04bcc0f641
3
+ metadata.gz: eb3b53c4340fbb2ef002661f2da3ca9473ab4cc5
4
+ data.tar.gz: 57c1e77f61485b399d854d30465a74ffb3d88078
5
5
  SHA512:
6
- metadata.gz: 928b0db6c557babb1a447e1a8ac551751b33ac02effa3b220b4ee37572019194fb6624ade26b0aba4e6a77c982a4653b91cfa466fe63aaf193d45f7cfeba5ded
7
- data.tar.gz: 9e133707553e092b676af9f46b276a78b818750bdd0086482d1e7682128aeb9c8f6ff127ec24cc8f9f8de6de7804610906db70c33e036c219319cdc65d2d51bd
6
+ metadata.gz: 30d11e36f05677cbcecd13f022b1f29dcd6ed8a6f879d4446be1128872caaca0ebf47b601d629cbbf7b89d161ae6be98ef54a492e7215842ddb34cd7ec8c2537
7
+ data.tar.gz: c6aeb4b21858ed9d599a585911c45f36a452fa2f2f63ca9ba012055bccb99f4fce576d6a9e8b71ed72f5fc301bbcfcbed30ae7ae02e4daac0b97701d64026326
@@ -85,8 +85,8 @@ module Gitlab
85
85
  # Ex.
86
86
  # Commit.between('29eda46b', 'master')
87
87
  #
88
- def between(repo, from, to)
89
- repo.commits_between(from, to).map do |commit|
88
+ def between(repo, base, head)
89
+ repo.commits_between(base, head).map do |commit|
90
90
  decorate(commit)
91
91
  end
92
92
  end
@@ -3,30 +3,29 @@ module Gitlab
3
3
  class Compare
4
4
  attr_accessor :commits, :commit, :diffs, :same
5
5
 
6
- def initialize(repository, from, to)
6
+ def initialize(repository, from, to, limit = 100)
7
7
  @commits, @diffs = [], []
8
8
  @commit = nil
9
9
  @same = false
10
10
 
11
11
  return unless from && to
12
12
 
13
- first = repository.commit(to.try(:strip))
14
- last = repository.commit(from.try(:strip))
13
+ base = Gitlab::Git::Commit.find(repository, from.try(:strip))
14
+ head = Gitlab::Git::Commit.find(repository, to.try(:strip))
15
15
 
16
- return unless first && last
16
+ return unless base && head
17
17
 
18
- if first.id == last.id
18
+ if base.id == head.id
19
19
  @same = true
20
20
  return
21
21
  end
22
22
 
23
- @commit = first
24
- @commits = repository.commits_between(last.id, first.id)
25
-
26
- @diffs = if @commits.size > 100
23
+ @commit = head
24
+ @commits = Gitlab::Git::Commit.between(repository, base.id, head.id)
25
+ @diffs = if @commits.size > limit
27
26
  []
28
27
  else
29
- repository.repo.diff(last.id, first.id) rescue []
28
+ Gitlab::Git::Diff.between(repository, head.id, base.id) rescue []
30
29
  end
31
30
  end
32
31
  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, from, to)
18
+ def between(repo, head, base)
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
- common_commit = repo.merge_base_commit(from, to)
22
+ common_commit = repo.merge_base_commit(head, base)
23
23
 
24
- repo.diff(common_commit, from).map do |diff|
24
+ repo.diff(common_commit, head).map do |diff|
25
25
  Gitlab::Git::Diff.new(diff)
26
26
  end
27
27
  rescue Grit::Git::GitTimeout
@@ -10,8 +10,8 @@ module Gitlab
10
10
 
11
11
  log.each_slice(5) do |slice|
12
12
  entry = {}
13
- entry[:author_name] = slice[0]
14
- entry[:author_email] = slice[1]
13
+ entry[:author_name] = slice[0].force_encoding('UTF-8')
14
+ entry[:author_email] = slice[1].force_encoding('UTF-8')
15
15
  entry[:date] = slice[2]
16
16
 
17
17
  if slice[4]
@@ -28,8 +28,8 @@ module Gitlab
28
28
  # compatibility
29
29
  alias_method :repo, :raw
30
30
 
31
- def initialize(path_with_namespace, root_ref = 'master')
32
- @root_ref = root_ref || "master"
31
+ def initialize(path_with_namespace, root_ref)
32
+ @root_ref = root_ref || raw.head.name
33
33
  @path_with_namespace = path_with_namespace
34
34
 
35
35
  # Init grit repo object
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: 2.1.1
4
+ version: 2.2.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-04-29 00:00:00.000000000 Z
11
+ date: 2013-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: github-linguist