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
Jérome Perrin
gitlab-ce
Commits
32d8aa6d
Commit
32d8aa6d
authored
Jul 28, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix repo hooks missing on import
fix spec and added changelog
parent
273bea97
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
2 deletions
+22
-2
CHANGELOG
CHANGELOG
+1
-0
lib/gitlab/import_export/command_line_util.rb
lib/gitlab/import_export/command_line_util.rb
+8
-0
lib/gitlab/import_export/repo_restorer.rb
lib/gitlab/import_export/repo_restorer.rb
+11
-1
spec/features/projects/import_export/import_file_spec.rb
spec/features/projects/import_export/import_file_spec.rb
+2
-1
No files found.
CHANGELOG
View file @
32d8aa6d
...
@@ -28,6 +28,7 @@ v 8.11.0 (unreleased)
...
@@ -28,6 +28,7 @@ v 8.11.0 (unreleased)
- Change requests_profiles resource constraint to catch virtually any file
- Change requests_profiles resource constraint to catch virtually any file
v 8.10.3 (unreleased)
v 8.10.3 (unreleased)
- Fix hooks missing on imported GitLab projects
v 8.10.2
v 8.10.2
- User can now search branches by name. !5144
- User can now search branches by name. !5144
...
...
lib/gitlab/import_export/command_line_util.rb
View file @
32d8aa6d
...
@@ -17,6 +17,10 @@ module Gitlab
...
@@ -17,6 +17,10 @@ module Gitlab
execute
(
%W(
#{
git_bin_path
}
clone --bare
#{
bundle_path
}
#{
repo_path
}
)
)
execute
(
%W(
#{
git_bin_path
}
clone --bare
#{
bundle_path
}
#{
repo_path
}
)
)
end
end
def
git_restore_hooks
execute
(
%W(
#{
Gitlab
.
config
.
gitlab_shell
.
path
}
/bin/create-hooks)
+
repository_storage_paths_args
)
end
private
private
def
tar_with_options
(
archive
:,
dir
:,
options
:)
def
tar_with_options
(
archive
:,
dir
:,
options
:)
...
@@ -45,6 +49,10 @@ module Gitlab
...
@@ -45,6 +49,10 @@ module Gitlab
FileUtils
.
copy_entry
(
source
,
destination
)
FileUtils
.
copy_entry
(
source
,
destination
)
true
true
end
end
def
repository_storage_paths_args
Gitlab
.
config
.
repositories
.
storages
.
values
end
end
end
end
end
end
end
lib/gitlab/import_export/repo_restorer.rb
View file @
32d8aa6d
...
@@ -14,7 +14,7 @@ module Gitlab
...
@@ -14,7 +14,7 @@ module Gitlab
FileUtils
.
mkdir_p
(
path_to_repo
)
FileUtils
.
mkdir_p
(
path_to_repo
)
git_unbundle
(
repo_path:
path_to_repo
,
bundle_path:
@path_to_bundle
)
git_unbundle
(
repo_path:
path_to_repo
,
bundle_path:
@path_to_bundle
)
&&
repo_restore_hooks
rescue
=>
e
rescue
=>
e
@shared
.
error
(
e
)
@shared
.
error
(
e
)
false
false
...
@@ -29,6 +29,16 @@ module Gitlab
...
@@ -29,6 +29,16 @@ module Gitlab
def
path_to_repo
def
path_to_repo
@project
.
repository
.
path_to_repo
@project
.
repository
.
path_to_repo
end
end
def
repo_restore_hooks
return
true
if
wiki?
git_restore_hooks
end
def
wiki?
@project
.
class
.
name
==
'ProjectWiki'
end
end
end
end
end
end
end
spec/features/projects/import_export/import_file_spec.rb
View file @
32d8aa6d
...
@@ -8,6 +8,7 @@ feature 'project import', feature: true, js: true do
...
@@ -8,6 +8,7 @@ feature 'project import', feature: true, js: true do
let
(
:file
)
{
File
.
join
(
Rails
.
root
,
'spec'
,
'features'
,
'projects'
,
'import_export'
,
'test_project_export.tar.gz'
)
}
let
(
:file
)
{
File
.
join
(
Rails
.
root
,
'spec'
,
'features'
,
'projects'
,
'import_export'
,
'test_project_export.tar.gz'
)
}
let
(
:export_path
)
{
"
#{
Dir
::
tmpdir
}
/import_file_spec"
}
let
(
:export_path
)
{
"
#{
Dir
::
tmpdir
}
/import_file_spec"
}
let
(
:project
)
{
Project
.
last
}
let
(
:project
)
{
Project
.
last
}
let
(
:project_hook
)
{
Gitlab
::
Git
::
Hook
.
new
(
'post-receive'
,
project
.
repository
.
path
)
}
background
do
background
do
allow_any_instance_of
(
Gitlab
::
ImportExport
).
to
receive
(
:storage_path
).
and_return
(
export_path
)
allow_any_instance_of
(
Gitlab
::
ImportExport
).
to
receive
(
:storage_path
).
and_return
(
export_path
)
...
@@ -37,7 +38,7 @@ feature 'project import', feature: true, js: true do
...
@@ -37,7 +38,7 @@ feature 'project import', feature: true, js: true do
expect
(
project
).
not_to
be_nil
expect
(
project
).
not_to
be_nil
expect
(
project
.
issues
).
not_to
be_empty
expect
(
project
.
issues
).
not_to
be_empty
expect
(
project
.
merge_requests
).
not_to
be_empty
expect
(
project
.
merge_requests
).
not_to
be_empty
expect
(
project
.
repo_exists?
).
to
be
true
expect
(
project
_hook
).
to
exist
expect
(
wiki_exists?
).
to
be
true
expect
(
wiki_exists?
).
to
be
true
expect
(
project
.
import_status
).
to
eq
(
'finished'
)
expect
(
project
.
import_status
).
to
eq
(
'finished'
)
end
end
...
...
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