gitlab_git 10.3.2 → 10.4.0

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: 51076bd426c1093deb3ac7921090402ff3217397
4
- data.tar.gz: 0bcd48cc52ef0ec8ecd4bcc7d45c892ec31b21d0
3
+ metadata.gz: 1115974e3de5f5c12b50a8ba8d4551cfd8d98f0d
4
+ data.tar.gz: 1e35d62d7867e80a75ec7a7b157dcddb283c8835
5
5
  SHA512:
6
- metadata.gz: f84755a8d8474f773236438cb92d5264ce75ee935609faf2b6d9efe0210285c632bf157d4b599f46893075c6fe68ebe52c93ccc3b9053e3904a5f774057d8051
7
- data.tar.gz: 6470f132620cff756f6c6810b4ef042ea2cab28eec465806fc38d5ab6f8199c6a8ac0832753fa652c1fb9e302eb02cca7c004a40b48729e10ea13325bcc3f7f6
6
+ metadata.gz: 636e47d38d0f91058c3f985c60dffbeaa28cf95733dfa63cd7c7de67495a808b4bb3b23554e9a8331988786aa954b63e4a59c3365075080b4a26c1a579b2c1cc
7
+ data.tar.gz: 0b97a98a7e2d981fa9833f204b97174f1173bb7e4eff932546d700c0cc9a8dbde17a6c466c338e2c8c79d34b9cfa532eaf764164ac684c5175df587fbf8a3d25
data/VERSION CHANGED
@@ -1 +1 @@
1
- 10.3.2
1
+ 10.4.0
@@ -55,7 +55,12 @@ module Gitlab
55
55
  def find(repo, commit_id = "HEAD")
56
56
  return decorate(commit_id) if commit_id.is_a?(Rugged::Commit)
57
57
 
58
- obj = repo.rev_parse_target(commit_id)
58
+ obj = if commit_id.is_a?(String)
59
+ repo.rev_parse_target(commit_id)
60
+ else
61
+ Ref.dereference_object(commit_id)
62
+ end
63
+
59
64
  return nil unless obj.is_a?(Rugged::Commit)
60
65
 
61
66
  decorate(obj)
@@ -2,7 +2,7 @@ module Gitlab
2
2
  module Git
3
3
  class Ref
4
4
  include EncodingHelper
5
-
5
+
6
6
  # Branch or tag name
7
7
  # without "refs/tags|heads" prefix
8
8
  attr_reader :name
@@ -20,18 +20,17 @@ module Gitlab
20
20
  str.gsub(/\Arefs\/heads\//, '')
21
21
  end
22
22
 
23
- def initialize(name, target)
23
+ def self.dereference_object(object)
24
+ object = object.target while object.is_a?(Rugged::Tag::Annotation)
25
+
26
+ object
27
+ end
28
+
29
+ def initialize(repository, name, target)
24
30
  encode! name
25
31
  @name = name.gsub(/\Arefs\/(tags|heads)\//, '')
26
- @target = if target.respond_to?(:oid)
27
- target.oid
28
- elsif target.respond_to?(:name)
29
- target.name
30
- elsif target.is_a? String
31
- target
32
- else
33
- nil
34
- end
32
+
33
+ @target = Commit.find(repository, target)
35
34
  end
36
35
  end
37
36
  end
@@ -61,13 +61,19 @@ module Gitlab
61
61
  def branches
62
62
  rugged.branches.map do |rugged_ref|
63
63
  begin
64
- Branch.new(rugged_ref.name, rugged_ref.target)
64
+ Branch.new(self, rugged_ref.name, rugged_ref.target)
65
65
  rescue Rugged::ReferenceError
66
66
  # Omit invalid branch
67
67
  end
68
68
  end.compact.sort_by(&:name)
69
69
  end
70
70
 
71
+ def local_branches
72
+ rugged.branches.each(:local).map do |branch|
73
+ Branch.new(self, branch.name, branch.target)
74
+ end
75
+ end
76
+
71
77
  # Returns the number of valid branches
72
78
  def branch_count
73
79
  rugged.branches.count do |ref|
@@ -99,7 +105,7 @@ module Gitlab
99
105
  end
100
106
  end
101
107
 
102
- Tag.new(ref.name, ref.target, message)
108
+ Tag.new(self, ref.name, ref.target, message)
103
109
  end.sort_by(&:name)
104
110
  end
105
111
 
@@ -132,7 +138,7 @@ module Gitlab
132
138
  # Deprecated. Will be removed in 5.2
133
139
  def heads
134
140
  rugged.references.each("refs/heads/*").map do |head|
135
- Gitlab::Git::Ref.new(head.name, head.target)
141
+ Gitlab::Git::Ref.new(self, head.name, head.target)
136
142
  end.sort_by(&:name)
137
143
  end
138
144
 
@@ -337,8 +343,7 @@ module Gitlab
337
343
  # annotated tag, then return the tag's target instead.
338
344
  def rev_parse_target(revspec)
339
345
  obj = rugged.rev_parse(revspec)
340
- obj = obj.target while obj.is_a?(Rugged::Tag::Annotation)
341
- obj
346
+ Ref.dereference_object(obj)
342
347
  end
343
348
 
344
349
  # Return a collection of Rugged::Commits between the two revspec arguments.
@@ -745,7 +750,7 @@ module Gitlab
745
750
  # create_branch("other-feature", "master")
746
751
  def create_branch(ref, start_point = "HEAD")
747
752
  rugged_ref = rugged.branches.create(ref, start_point)
748
- Branch.new(rugged_ref.name, rugged_ref.target)
753
+ Branch.new(self, rugged_ref.name, rugged_ref.target)
749
754
  rescue Rugged::ReferenceError => e
750
755
  raise InvalidRef.new("Branch #{ref} already exists") if e.to_s =~ /'refs\/heads\/#{ref}'/
751
756
  raise InvalidRef.new("Invalid reference #{start_point}")
@@ -1,8 +1,8 @@
1
1
  module Gitlab
2
2
  module Git
3
3
  class Tag < Ref
4
- def initialize(name, target, message = nil)
5
- super(name, target)
4
+ def initialize(repository, name, target, message = nil)
5
+ super(repository, name, target)
6
6
  @message = message
7
7
  end
8
8
 
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.3.2
4
+ version: 10.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: 2016-07-18 00:00:00.000000000 Z
11
+ date: 2016-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: github-linguist