blob: 42126cabd9780d51e277c36b0d41899d3aef2931 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
module Gitlab
module ImportExport
class RepoRestorer
include Gitlab::ImportExport::CommandLineUtil
def initialize(project: , path: )
@project = project
@path = path
end
def restore
return false unless File.exists?(@path)
# Move repos dir to 'repositories.old' dir
FileUtils.mkdir_p(repos_path)
FileUtils.mkdir_p(path_to_repo)
untar_cf(archive: @path, dir: path_to_repo)
end
private
def repos_path
Gitlab.config.gitlab_shell.repos_path
end
def path_to_repo
@project.repository.path_to_repo
end
end
end
end
|