BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
737f0ae8
Commit
737f0ae8
authored
Jan 05, 2018
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ban-disk-import' into 'master'
Don't use Gitlab::Shell#import_repository on local paths See merge request gitlab-org/gitlab-ce!16228
parents
0f33ac64
dcebe149
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletion
+10
-1
command_line_util.rb
lib/gitlab/import_export/command_line_util.rb
+5
-0
repo_restorer.rb
lib/gitlab/import_export/repo_restorer.rb
+1
-1
shell.rb
lib/gitlab/shell.rb
+4
-0
No files found.
lib/gitlab/import_export/command_line_util.rb
View file @
737f0ae8
...
...
@@ -15,6 +15,11 @@ module Gitlab
execute
(
%W(
#{
git_bin_path
}
--git-dir=
#{
repo_path
}
bundle create
#{
bundle_path
}
--all)
)
end
def
git_clone_bundle
(
repo_path
:,
bundle_path
:)
execute
(
%W(
#{
git_bin_path
}
clone --bare --
#{
bundle_path
}
#{
repo_path
}
)
)
Gitlab
::
Git
::
Repository
.
create_hooks
(
repo_path
,
File
.
expand_path
(
Gitlab
.
config
.
gitlab_shell
.
hooks_path
))
end
def
mkdir_p
(
path
)
FileUtils
.
mkdir_p
(
path
,
mode:
DEFAULT_MODE
)
FileUtils
.
chmod
(
DEFAULT_MODE
,
path
)
...
...
lib/gitlab/import_export/repo_restorer.rb
View file @
737f0ae8
...
...
@@ -13,7 +13,7 @@ module Gitlab
def
restore
return
true
unless
File
.
exist?
(
@path_to_bundle
)
git
lab_shell
.
import_repository
(
@project
.
repository_storage_path
,
@project
.
disk_path
,
@path_to_bundle
)
git
_clone_bundle
(
repo_path:
@project
.
repository
.
path_to_repo
,
bundle_path:
@path_to_bundle
)
rescue
=>
e
@shared
.
error
(
e
)
false
...
...
lib/gitlab/shell.rb
View file @
737f0ae8
...
...
@@ -101,6 +101,10 @@ module Gitlab
#
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/874
def
import_repository
(
storage
,
name
,
url
)
if
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
cmd
=
gitlab_projects
(
storage
,
"
#{
name
}
.git"
)
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