Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
54d60ae0
Commit
54d60ae0
authored
May 09, 2017
by
Robert Speicher
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'remove-archive-to-file' into 'master'
Remove Gitlab::Git#archive_to_file See merge request !11205
parents
dccf5f19
fc0e00bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
50 deletions
+0
-50
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+0
-50
No files found.
lib/gitlab/git/repository.rb
View file @
54d60ae0
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment