mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-11 21:56:19 +10:00
Add more debug info to import/export and memory killer
This should help debug https://gitlab.com/gitlab-org/gitlab-ce/issues/19124 further
See merge request !5108
(cherry picked from commit b73da89591)
42 lines
1.1 KiB
Ruby
42 lines
1.1 KiB
Ruby
module Gitlab
|
|
module ImportExport
|
|
module CommandLineUtil
|
|
def tar_czf(archive:, dir:)
|
|
tar_with_options(archive: archive, dir: dir, options: 'czf')
|
|
end
|
|
|
|
def untar_zxf(archive:, dir:)
|
|
untar_with_options(archive: archive, dir: dir, options: 'zxf')
|
|
end
|
|
|
|
def git_bundle(repo_path:, bundle_path:)
|
|
execute(%W(#{git_bin_path} --git-dir=#{repo_path} bundle create #{bundle_path} --all))
|
|
end
|
|
|
|
def git_unbundle(repo_path:, bundle_path:)
|
|
execute(%W(#{git_bin_path} clone --bare #{bundle_path} #{repo_path}))
|
|
end
|
|
|
|
private
|
|
|
|
def tar_with_options(archive:, dir:, options:)
|
|
execute(%W(tar -#{options} #{archive} -C #{dir} .))
|
|
end
|
|
|
|
def untar_with_options(archive:, dir:, options:)
|
|
execute(%W(tar -#{options} #{archive} -C #{dir}))
|
|
end
|
|
|
|
def execute(cmd)
|
|
output, status = Gitlab::Popen.popen(cmd)
|
|
@shared.error(output.to_s) unless status.zero?
|
|
status.zero?
|
|
end
|
|
|
|
def git_bin_path
|
|
Gitlab.config.git.bin_path
|
|
end
|
|
end
|
|
end
|
|
end
|