gitlab_git 7.0.0.rc3 → 7.0.0.rc4

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/gitlab_git/repository.rb +37 -58
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff461d9ee572c8e82ed303b222d4719bce93dcc5
4
- data.tar.gz: 16c2b9ada62bb3452b237ef921bfc004ac2aaaa6
3
+ metadata.gz: ac5cbe56279c663c2bbff8af444c61da6f004056
4
+ data.tar.gz: ab6cb0ba7984203a57ca8112e3538a2525237fc8
5
5
  SHA512:
6
- metadata.gz: a2cf2dceb0d689ee5489724ffb920cc61605de1728ba00fb9168e136a9f262c8d75cdcedc19a4605e420b3b2ba0cce8bd643d46424a05ad77926fcd3e63bdcdd
7
- data.tar.gz: c55192100961a6311fc981b240fec387bc87faeefb1ec637f608c0e9008e67bbe32055f694b2fe325a23f2e361637e1fe3d7d8482008738b9c17c2c94cb69ed1
6
+ metadata.gz: 9595dccf43da4638106dd90aead029a5d33b1a51684ae83cab7591a4b9a0943d4f6ab4412e613c1c06e7d959dfefad323414ea48a66ded7c84d83ffe75b02450
7
+ data.tar.gz: 17a0b75f441a6c10a26a3ce05049613b250ef0adf7d1682f84dfd4845fa43808a979360047e863edd759cb8d0abd99a57a0d01a83e5e01596d446154de5a71f3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 7.0.0.rc3
1
+ 7.0.0.rc4
@@ -326,7 +326,7 @@ module Gitlab
326
326
  # repo.branch_names_contains('master')
327
327
  #
328
328
  def branch_names_contains(commit)
329
- branches_contains(commit).map { |c| c.target_id }
329
+ branches_contains(commit).map { |c| c.name }
330
330
  end
331
331
 
332
332
  # Returns branch collection that contains the special commit(SHA1 or name)
@@ -813,33 +813,33 @@ module Gitlab
813
813
  prefix = File.basename(name)
814
814
  extension = Pathname.new(file_path).extname
815
815
 
816
- if extension == ".zip"
816
+ if extension == '.zip'
817
817
  create_zip_archive(ref_name, file_path, prefix)
818
818
  else
819
- # Create a tarfile in memory
820
- tarfile = tar_string_io(ref_name, prefix)
821
-
822
- if extension == ".tar"
823
- File.new(file_path, "wb").write(tarfile.read)
824
- else
825
- compress_tar(tarfile, file_path, pipe_cmd)
819
+ rd_pipe, rw_pipe = IO.pipe
820
+ tar_pid = fork do
821
+ # Send the tar file to the write pipe
822
+ rd_pipe.close
823
+ Gem::Package::TarWriter.new(rw_pipe) do |tar|
824
+ tar.mkdir(prefix, 33261)
825
+
826
+ populated_index(ref_name).each do |entry|
827
+ add_archive_entry(tar, prefix, entry)
828
+ end
829
+ end
830
+ rw_pipe.close
826
831
  end
827
- end
828
- end
829
832
 
830
- # Return a StringIO with the contents of the repo's tar file
831
- def tar_string_io(ref_name, prefix)
832
- tarfile = StringIO.new
833
- Gem::Package::TarWriter.new(tarfile) do |tar|
834
- tar.mkdir(prefix, 33261)
833
+ # Use the other end of the pipe to compress with bzip2 or gzip
834
+ FileUtils.mkdir_p(Pathname.new(file_path).dirname)
835
+ archive_file = File.new(file_path, 'wb')
836
+ rw_pipe.close
837
+ system(*pipe_cmd, in: rd_pipe, out: archive_file)
835
838
 
836
- populated_index(ref_name).each do |entry|
837
- add_archive_entry(tar, prefix, entry)
838
- end
839
+ Process.waitpid(tar_pid)
840
+ rd_pipe.close
841
+ archive_file.close
839
842
  end
840
-
841
- tarfile.rewind
842
- tarfile
843
843
  end
844
844
 
845
845
  # Create a zip file with the contents of the repo
@@ -854,22 +854,26 @@ module Gitlab
854
854
  # Add a file or directory from the index to the given tar or zip file
855
855
  def add_archive_entry(archive, prefix, entry)
856
856
  prefixed_path = File.join(prefix, entry[:path])
857
- content = rugged.lookup(entry[:oid]).content unless submodule?(entry)
858
857
 
859
- # Create a file in the archive for each index entry
860
- if archive.is_a?(Zip::File)
861
- unless submodule?(entry)
858
+ if submodule?(entry)
859
+ # Create an empty directory for submodules
860
+ mask = case archive
861
+ when Zip::File then 0755
862
+ else '100755'.to_i(8)
863
+ end
864
+ archive.mkdir(prefixed_path, mask)
865
+ else
866
+ blob = rugged.lookup(entry[:oid])
867
+ content = blob.content
868
+
869
+ # Write the blob contents to the archive
870
+ if archive.is_a?(Zip::File)
862
871
  archive.get_output_stream(prefixed_path) do |os|
863
872
  os.write(content)
864
873
  end
865
- end
866
- else
867
- if submodule?(entry)
868
- # Create directories for submodules
869
- archive.mkdir(prefixed_path, 33261)
870
874
  else
871
- # Write the blob contents to the file
872
- archive.add_file(prefixed_path, entry[:mode]) do |tf|
875
+ archive.add_file_simple(prefixed_path,
876
+ entry[:mode], blob.size) do |tf|
873
877
  tf.write(content)
874
878
  end
875
879
  end
@@ -882,31 +886,6 @@ module Gitlab
882
886
  index_entry[:mode] == 57344
883
887
  end
884
888
 
885
- # Send the +tar_string+ StringIO to +pipe_cmd+ for bzip2 or gzip
886
- # compression.
887
- def compress_tar(tar_string, file_path, pipe_cmd)
888
- # Write the in-memory tarfile to a pipe
889
- rd_pipe, rw_pipe = IO.pipe
890
- tar_pid = fork do
891
- rd_pipe.close
892
- rw_pipe.write(tar_string.read)
893
- rw_pipe.close
894
- end
895
-
896
- # Use the other end of the pipe to compress with bzip2 or gzip
897
- FileUtils.mkdir_p(Pathname.new(file_path).dirname)
898
- archive_file = File.new(file_path, "wb")
899
- rw_pipe.close
900
- compress_pid = spawn(*pipe_cmd, in: rd_pipe, out: archive_file)
901
- rd_pipe.close
902
-
903
- Process.waitpid(tar_pid)
904
- Process.waitpid(compress_pid)
905
-
906
- archive_file.close
907
- tar_string.close
908
- end
909
-
910
889
  # Return a Rugged::Index that has read from the tree at +ref_name+
911
890
  def populated_index(ref_name)
912
891
  tree = rugged.lookup(rugged.rev_parse_oid(ref_name)).tree
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.0.0.rc3
4
+ version: 7.0.0.rc4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitriy Zaporozhets
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-26 00:00:00.000000000 Z
11
+ date: 2014-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab-linguist