gitlab_git 4.0.0.pre → 4.0.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: 85ee25655aa5e5c0556526ba33753035e8b66561
4
- data.tar.gz: ff006c9d9b8fa2c07d055249c7f1b032642c91e9
3
+ metadata.gz: b2108e7b969cd3dac473e6eb14311a72bf84972d
4
+ data.tar.gz: cafd1804445e5ee667fc98e9c6d9aa4d2c6d346b
5
5
  SHA512:
6
- metadata.gz: 93ffa1a169b4287b39eff9fa65a5af78e366e15fd6aaf0382d79449457644b1ab3e48c1552f21418e504171ed384ccf472ed860a6866a029365591fa1a8026ee
7
- data.tar.gz: 3e81684ee96eadfbed96841d4eb1eeb4fce353b1352a73888286bc5bac05ac993eda04af28bd508d37e24dde2490bbf5b63ebb1b9b2d8846a6857016641d4c3e
6
+ metadata.gz: d7005c9028474ca9bfc742980c1e66010add94963d1959bc37cedea82718ca448a7091d23155f69625199d0492ae630d006b7fc35a706448183081e0b34bc6ff
7
+ data.tar.gz: a6f8bdfe302fa68d094dc1bd3ed19aa217a028efb24cc0166e97bcf26c50cf8a0ca644c3c5a8bd84de9512c3154970f38b21293715a9dd7ae0d1f5d9b4d791c9
@@ -22,6 +22,15 @@ module Gitlab
22
22
  )
23
23
  end
24
24
  end
25
+
26
+ def raw(repository, sha)
27
+ grit_blob = repository.grit.blob(sha)
28
+ Blob.new(
29
+ id: grit_blob.id,
30
+ size: grit_blob.size,
31
+ data: grit_blob.data,
32
+ )
33
+ end
25
34
  end
26
35
 
27
36
  def initialize(options)
@@ -99,13 +99,35 @@ module Gitlab
99
99
  # Already packed repo archives stored at
100
100
  # app_root/tmp/repositories/project_name/project_name-commit-id.tag.gz
101
101
  #
102
- def archive_repo(ref, storage_path)
102
+ def archive_repo(ref, storage_path, format = "tar.gz")
103
103
  ref = ref || self.root_ref
104
104
  commit = Gitlab::Git::Commit.find(self, ref)
105
105
  return nil unless commit
106
+
107
+ extension = nil
108
+ git_archive_format = nil
109
+ pipe_cmd = nil
110
+
111
+ case format
112
+ when "tar.bz2", "tbz", "tbz2", "tb2", "bz2"
113
+ extension = ".tar.bz2"
114
+ pipe_cmd = "bzip"
115
+ when "tar"
116
+ extension = ".tar"
117
+ pipe_cmd = "cat"
118
+ when "zip"
119
+ extension = ".zip"
120
+ git_archive_format = "zip"
121
+ pipe_cmd = "cat"
122
+ else
123
+ # everything else should fall back to tar.gz
124
+ extension = ".tar.gz"
125
+ git_archive_format = nil
126
+ pipe_cmd = "gzip"
127
+ end
106
128
 
107
129
  # Build file path
108
- file_name = self.name.gsub("\.git", "") + "-" + commit.id.to_s + ".tar.gz"
130
+ file_name = self.name.gsub("\.git", "") + "-" + commit.id.to_s + extension
109
131
  file_path = File.join(storage_path, self.name, file_name)
110
132
 
111
133
  # Put files into a directory before archiving
@@ -114,7 +136,7 @@ module Gitlab
114
136
  # Create file if not exists
115
137
  unless File.exists?(file_path)
116
138
  FileUtils.mkdir_p File.dirname(file_path)
117
- file = self.grit.archive_to_file(ref, prefix, file_path)
139
+ file = self.grit.archive_to_file(ref, prefix, file_path, git_archive_format, pipe_cmd)
118
140
  end
119
141
 
120
142
  file_path
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: 4.0.0.pre
4
+ version: 4.0.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-12-06 00:00:00.000000000 Z
11
+ date: 2013-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab-linguist
@@ -100,9 +100,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - '>'
103
+ - - '>='
104
104
  - !ruby/object:Gem::Version
105
- version: 1.3.1
105
+ version: '0'
106
106
  requirements: []
107
107
  rubyforge_project:
108
108
  rubygems_version: 2.1.11