gitlab_git 10.3.2 → 10.4.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 +4 -4
- data/VERSION +1 -1
- data/lib/gitlab_git/commit.rb +6 -1
- data/lib/gitlab_git/ref.rb +10 -11
- data/lib/gitlab_git/repository.rb +11 -6
- data/lib/gitlab_git/tag.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: 1115974e3de5f5c12b50a8ba8d4551cfd8d98f0d
|
4
|
+
data.tar.gz: 1e35d62d7867e80a75ec7a7b157dcddb283c8835
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 636e47d38d0f91058c3f985c60dffbeaa28cf95733dfa63cd7c7de67495a808b4bb3b23554e9a8331988786aa954b63e4a59c3365075080b4a26c1a579b2c1cc
|
7
|
+
data.tar.gz: 0b97a98a7e2d981fa9833f204b97174f1173bb7e4eff932546d700c0cc9a8dbde17a6c466c338e2c8c79d34b9cfa532eaf764164ac684c5175df587fbf8a3d25
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
10.
|
1
|
+
10.4.0
|
data/lib/gitlab_git/commit.rb
CHANGED
@@ -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 =
|
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)
|
data/lib/gitlab_git/ref.rb
CHANGED
@@ -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
|
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
|
-
|
27
|
-
|
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
|
-
|
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}")
|
data/lib/gitlab_git/tag.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2016-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: github-linguist
|