gitlab_git 7.2.6 → 7.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/gitlab_git/repository.rb +35 -19
- 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: 0fb286d72a72f537e6256122e9017c6901e7534f
|
4
|
+
data.tar.gz: a65bf64b798e5bdc6ed45f8a9837b8bd9e5437bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd4a03b4bc7fbeef4436f919855ad0f9f424387f22ab8e09a78d12fa60925017f4e59e2157bba93c39dd2e833b83fd5fddde92248fb70134a37452d91cb8a948
|
7
|
+
data.tar.gz: 0002e83c7288132e5cd7a8ba70696bbc3dd8d04748b988abbf64777612c65be5cfbe81991c5cedc5474096f8bac03ab781fb32b832eecf16e1438a9fe931bbad
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.2.
|
1
|
+
7.2.8
|
@@ -53,8 +53,12 @@ module Gitlab
|
|
53
53
|
# Returns an Array of Branches
|
54
54
|
def branches
|
55
55
|
rugged.branches.map do |rugged_ref|
|
56
|
-
|
57
|
-
|
56
|
+
begin
|
57
|
+
Branch.new(rugged_ref.name, rugged_ref.target)
|
58
|
+
rescue Rugged::ReferenceError
|
59
|
+
# Omit invalid branch
|
60
|
+
end
|
61
|
+
end.compact.sort_by(&:name)
|
58
62
|
end
|
59
63
|
|
60
64
|
# Returns an Array of tag names
|
@@ -135,7 +139,7 @@ module Gitlab
|
|
135
139
|
# Archive Project to .tar.gz
|
136
140
|
#
|
137
141
|
# Already packed repo archives stored at
|
138
|
-
# app_root/tmp/repositories
|
142
|
+
# app_root/tmp/repositories/<project_name>.git/<project_name>-<ref>-<commit id>.tar.gz
|
139
143
|
#
|
140
144
|
def archive_repo(ref, storage_path, format = "tar.gz")
|
141
145
|
ref ||= root_ref
|
@@ -147,16 +151,15 @@ module Gitlab
|
|
147
151
|
|
148
152
|
case format
|
149
153
|
when "tar.bz2", "tbz", "tbz2", "tb2", "bz2"
|
150
|
-
|
154
|
+
compress_cmd = %W(bzip2)
|
151
155
|
when "tar"
|
152
|
-
|
156
|
+
compress_cmd = %W(cat)
|
153
157
|
when "zip"
|
154
158
|
git_archive_format = "zip"
|
155
|
-
|
159
|
+
compress_cmd = %W(cat)
|
156
160
|
else
|
157
161
|
# everything else should fall back to tar.gz
|
158
|
-
|
159
|
-
pipe_cmd = %W(gzip -n)
|
162
|
+
compress_cmd = %W(gzip -n)
|
160
163
|
end
|
161
164
|
|
162
165
|
FileUtils.mkdir_p File.dirname(file_path)
|
@@ -174,7 +177,7 @@ module Gitlab
|
|
174
177
|
temp_file_path = "#{file_path}.#{Process.pid}-#{Time.now.to_i}"
|
175
178
|
|
176
179
|
begin
|
177
|
-
archive_to_file(ref, temp_file_path, git_archive_format,
|
180
|
+
archive_to_file(ref, temp_file_path, git_archive_format, compress_cmd)
|
178
181
|
rescue
|
179
182
|
FileUtils.rm(temp_file_path)
|
180
183
|
raise
|
@@ -188,26 +191,34 @@ module Gitlab
|
|
188
191
|
file_path
|
189
192
|
end
|
190
193
|
|
191
|
-
def
|
194
|
+
def archive_name(ref)
|
192
195
|
ref ||= root_ref
|
193
196
|
commit = Gitlab::Git::Commit.find(self, ref)
|
194
197
|
return nil unless commit
|
195
198
|
|
199
|
+
project_name = self.name.sub(/\.git\z/, "")
|
200
|
+
file_name = "#{project_name}-#{ref}-#{commit.id}"
|
201
|
+
end
|
202
|
+
|
203
|
+
def archive_file_path(ref, storage_path, format = "tar.gz")
|
204
|
+
# Build file path
|
205
|
+
name = archive_name(ref)
|
206
|
+
return nil unless name
|
207
|
+
|
196
208
|
extension =
|
197
209
|
case format
|
198
210
|
when "tar.bz2", "tbz", "tbz2", "tb2", "bz2"
|
199
|
-
"
|
211
|
+
"tar.bz2"
|
200
212
|
when "tar"
|
201
|
-
"
|
213
|
+
"tar"
|
202
214
|
when "zip"
|
203
|
-
"
|
215
|
+
"zip"
|
204
216
|
else
|
205
217
|
# everything else should fall back to tar.gz
|
206
|
-
"
|
218
|
+
"tar.gz"
|
207
219
|
end
|
208
220
|
|
209
|
-
|
210
|
-
file_name = self.name.gsub("\.git", "") + "-" + commit.id.to_s + extension
|
221
|
+
file_name = "#{name}.#{extension}"
|
211
222
|
File.join(storage_path, self.name, file_name)
|
212
223
|
end
|
213
224
|
|
@@ -289,12 +300,15 @@ module Gitlab
|
|
289
300
|
#
|
290
301
|
def commits_between(from, to)
|
291
302
|
walker = Rugged::Walker.new(rugged)
|
303
|
+
walker.sorting(Rugged::SORT_DATE | Rugged::SORT_REVERSE)
|
304
|
+
|
292
305
|
walker.push(to)
|
293
306
|
walker.hide(from)
|
307
|
+
|
294
308
|
commits = walker.to_a
|
295
309
|
walker.reset
|
296
310
|
|
297
|
-
commits
|
311
|
+
commits
|
298
312
|
end
|
299
313
|
|
300
314
|
# Returns the SHA of the most recent common ancestor of +from+ and +to+
|
@@ -944,14 +958,16 @@ module Gitlab
|
|
944
958
|
end
|
945
959
|
end
|
946
960
|
|
947
|
-
def archive_to_file(treeish = 'master', filename = 'archive.tar.gz', format = nil, compress_cmd = %W(gzip))
|
961
|
+
def archive_to_file(treeish = 'master', filename = 'archive.tar.gz', format = nil, compress_cmd = %W(gzip -n))
|
948
962
|
git_archive_cmd = %W(git --git-dir=#{path} archive)
|
949
963
|
|
950
964
|
# Put files into a directory before archiving
|
951
|
-
prefix =
|
965
|
+
prefix = "#{archive_name(treeish)}/"
|
952
966
|
git_archive_cmd << "--prefix=#{prefix}"
|
953
967
|
|
968
|
+
# Format defaults to tar
|
954
969
|
git_archive_cmd << "--format=#{format}" if format
|
970
|
+
|
955
971
|
git_archive_cmd += %W(-- #{treeish})
|
956
972
|
|
957
973
|
open(filename, 'w') do |file|
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitriy Zaporozhets
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gitlab-linguist
|