gitlab_git 7.2.23 → 7.2.24
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/repository.rb +33 -13
- 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: 320a203e93a3ce0ad48aa4edec7afa9b72da8b99
|
4
|
+
data.tar.gz: cc651b333e40c5152e3e732bcb3bccbe267b012b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3ee43227084d36f9cf9544ccbab03787e3f453341ee4af66bd71bce154fd238804501324ded8ea331a778a511ea8598ad6b047a9f8a270a130a739438fd8336
|
7
|
+
data.tar.gz: 67d85099411399ddad30d001d12704def155f08d716de240b3675e7aff08c5b59ace76bbe28100413a3b2c456c534c24a93ed285ed659bcf606a995bf0148663
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.2.
|
1
|
+
7.2.24
|
@@ -15,9 +15,6 @@ module Gitlab
|
|
15
15
|
class InvalidBlobName < StandardError; end
|
16
16
|
class InvalidRef < StandardError; end
|
17
17
|
|
18
|
-
# Default branch in the repository
|
19
|
-
attr_accessor :root_ref
|
20
|
-
|
21
18
|
# Full path to repo
|
22
19
|
attr_reader :path
|
23
20
|
|
@@ -32,7 +29,11 @@ module Gitlab
|
|
32
29
|
def initialize(path)
|
33
30
|
@path = path
|
34
31
|
@name = path.split("/").last
|
35
|
-
|
32
|
+
end
|
33
|
+
|
34
|
+
# Default branch in the repository
|
35
|
+
def root_ref
|
36
|
+
@root_ref ||= discover_default_branch
|
36
37
|
end
|
37
38
|
|
38
39
|
# Alias to old method for compatibility
|
@@ -63,6 +64,19 @@ module Gitlab
|
|
63
64
|
end.compact.sort_by(&:name)
|
64
65
|
end
|
65
66
|
|
67
|
+
# Returns the number of valid branches
|
68
|
+
def branch_count
|
69
|
+
rugged.branches.count do |ref|
|
70
|
+
begin
|
71
|
+
ref.name && ref.target # ensures the branch is valid
|
72
|
+
|
73
|
+
true
|
74
|
+
rescue Rugged::ReferenceError
|
75
|
+
false
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
66
80
|
# Returns an Array of tag names
|
67
81
|
def tag_names
|
68
82
|
rugged.tags.map { |t| t.name }
|
@@ -119,16 +133,22 @@ module Gitlab
|
|
119
133
|
# - If one branch is present, returns its name
|
120
134
|
# - If two or more branches are present, returns current HEAD or master or first branch
|
121
135
|
def discover_default_branch
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
136
|
+
names = branch_names
|
137
|
+
|
138
|
+
return if names.empty?
|
139
|
+
|
140
|
+
return names[0] if names.length == 1
|
141
|
+
|
142
|
+
if rugged_head
|
143
|
+
extracted_name = Ref.extract_branch_name(rugged_head.name)
|
144
|
+
|
145
|
+
return extracted_name if names.include?(extracted_name)
|
146
|
+
end
|
147
|
+
|
148
|
+
if names.include?('master')
|
149
|
+
'master'
|
130
150
|
else
|
131
|
-
|
151
|
+
names[0]
|
132
152
|
end
|
133
153
|
end
|
134
154
|
|
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: 7.2.
|
4
|
+
version: 7.2.24
|
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-01-
|
11
|
+
date: 2016-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: github-linguist
|