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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
44d15e41
Commit
44d15e41
authored
Jan 04, 2018
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get it working
parent
1e950e31
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
lib/gitlab/import_export/command_line_util.rb
lib/gitlab/import_export/command_line_util.rb
+4
-0
lib/gitlab/import_export/repo_restorer.rb
lib/gitlab/import_export/repo_restorer.rb
+3
-1
lib/gitlab/shell.rb
lib/gitlab/shell.rb
+4
-0
No files found.
lib/gitlab/import_export/command_line_util.rb
View file @
44d15e41
...
@@ -15,6 +15,10 @@ module Gitlab
...
@@ -15,6 +15,10 @@ module Gitlab
execute
(
%W(
#{
git_bin_path
}
--git-dir=
#{
repo_path
}
bundle create
#{
bundle_path
}
--all)
)
execute
(
%W(
#{
git_bin_path
}
--git-dir=
#{
repo_path
}
bundle create
#{
bundle_path
}
--all)
)
end
end
def
git_clone_bundle
(
repo_path
:,
bundle_path
:)
execute
(
%W(
#{
git_bin_path
}
clone --bare --
#{
bundle_path
}
#{
repo_path
}
)
)
end
def
mkdir_p
(
path
)
def
mkdir_p
(
path
)
FileUtils
.
mkdir_p
(
path
,
mode:
DEFAULT_MODE
)
FileUtils
.
mkdir_p
(
path
,
mode:
DEFAULT_MODE
)
FileUtils
.
chmod
(
DEFAULT_MODE
,
path
)
FileUtils
.
chmod
(
DEFAULT_MODE
,
path
)
...
...
lib/gitlab/import_export/repo_restorer.rb
View file @
44d15e41
...
@@ -13,7 +13,9 @@ module Gitlab
...
@@ -13,7 +13,9 @@ module Gitlab
def
restore
def
restore
return
true
unless
File
.
exist?
(
@path_to_bundle
)
return
true
unless
File
.
exist?
(
@path_to_bundle
)
gitlab_shell
.
import_repository
(
@project
.
repository_storage_path
,
@project
.
disk_path
,
@path_to_bundle
)
repo_path
=
@project
.
repository
.
path_to_repo
git_clone_bundle
(
repo_path:
repo_path
,
bundle_path:
@path_to_bundle
)
Gitlab
::
Git
::
Repository
.
create_hooks
(
repo_path
,
File
.
expand_path
(
Gitlab
.
config
.
gitlab_shell
.
hooks_path
))
rescue
=>
e
rescue
=>
e
@shared
.
error
(
e
)
@shared
.
error
(
e
)
false
false
...
...
lib/gitlab/shell.rb
View file @
44d15e41
...
@@ -102,6 +102,10 @@ module Gitlab
...
@@ -102,6 +102,10 @@ module Gitlab
#
#
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/387
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/387
def
import_repository
(
storage
,
name
,
url
)
def
import_repository
(
storage
,
name
,
url
)
if
url
.
start_with?
(
'.'
)
||
url
.
start_with?
(
'/'
)
raise
Error
.
new
(
"don't use disk paths with import_repository:
#{
url
.
inspect
}
"
)
end
# The timeout ensures the subprocess won't hang forever
# The timeout ensures the subprocess won't hang forever
cmd
=
gitlab_projects
(
storage
,
"
#{
name
}
.git"
)
cmd
=
gitlab_projects
(
storage
,
"
#{
name
}
.git"
)
success
=
cmd
.
import_project
(
url
,
git_timeout
)
success
=
cmd
.
import_project
(
url
,
git_timeout
)
...
...
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