diff options
author | Robert Speicher <robert@gitlab.com> | 2017-05-09 14:50:11 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-05-09 14:50:11 +0000 |
commit | 54d60ae0e79f94dab44a8bc06bdff2bad17e9fd7 (patch) | |
tree | 259ec3b590c6af5059ad1d97edd5838a878026cc | |
parent | dccf5f19f911eaf8d32e37e9f369a46d9e7ec9bd (diff) | |
parent | fc0e00bd3c7c99072675bf625b3832eb29464649 (diff) | |
download | gitlab-ce-54d60ae0e79f94dab44a8bc06bdff2bad17e9fd7.tar.gz |
Merge branch 'remove-archive-to-file' into 'master'
Remove Gitlab::Git#archive_to_file
See merge request !11205
-rw-r--r-- | lib/gitlab/git/repository.rb | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 6a0f12b7e50..9ed12ead023 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -1112,56 +1112,6 @@ module Gitlab end end - def archive_to_file(treeish = 'master', filename = 'archive.tar.gz', format = nil, compress_cmd = %w(gzip -n)) - git_archive_cmd = %W(#{Gitlab.config.git.bin_path} --git-dir=#{path} archive) - - # Put files into a directory before archiving - prefix = "#{archive_name(treeish)}/" - git_archive_cmd << "--prefix=#{prefix}" - - # Format defaults to tar - git_archive_cmd << "--format=#{format}" if format - - git_archive_cmd += %W(-- #{treeish}) - - open(filename, 'w') do |file| - # Create a pipe to act as the '|' in 'git archive ... | gzip' - pipe_rd, pipe_wr = IO.pipe - - # Get the compression process ready to accept data from the read end - # of the pipe - compress_pid = spawn(*nice(compress_cmd), in: pipe_rd, out: file) - # The read end belongs to the compression process now; we should - # close our file descriptor for it. - pipe_rd.close - - # Start 'git archive' and tell it to write into the write end of the - # pipe. - git_archive_pid = spawn(*nice(git_archive_cmd), out: pipe_wr) - # The write end belongs to 'git archive' now; close it. - pipe_wr.close - - # When 'git archive' and the compression process are finished, we are - # done. - Process.waitpid(git_archive_pid) - raise "#{git_archive_cmd.join(' ')} failed" unless $?.success? - Process.waitpid(compress_pid) - raise "#{compress_cmd.join(' ')} failed" unless $?.success? - end - end - - def nice(cmd) - nice_cmd = %w(nice -n 20) - unless unsupported_platform? - nice_cmd += %w(ionice -c 2 -n 7) - end - nice_cmd + cmd - end - - def unsupported_platform? - %w[darwin freebsd solaris].map { |platform| RUBY_PLATFORM.include?(platform) }.any? - end - # Returns true if the index entry has the special file mode that denotes # a submodule. def submodule?(index_entry) |