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
Boxiang Sun
gitlab-ce
Commits
081a584a
Commit
081a584a
authored
Jan 10, 2018
by
Alejandro Rodríguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure hooks are deleted regardless of the project forking method
parent
fbcd5197
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
spec/lib/gitlab/git/gitlab_projects_spec.rb
spec/lib/gitlab/git/gitlab_projects_spec.rb
+3
-0
spec/spec_helper.rb
spec/spec_helper.rb
+10
-0
spec/support/project_forks_helper.rb
spec/support/project_forks_helper.rb
+0
-4
No files found.
spec/lib/gitlab/git/gitlab_projects_spec.rb
View file @
081a584a
...
@@ -219,6 +219,9 @@ describe Gitlab::Git::GitlabProjects do
...
@@ -219,6 +219,9 @@ describe Gitlab::Git::GitlabProjects do
before
do
before
do
FileUtils
.
mkdir_p
(
dest_repos_path
)
FileUtils
.
mkdir_p
(
dest_repos_path
)
# Undo spec_helper stub that deletes hooks
allow_any_instance_of
(
described_class
).
to
receive
(
:fork_repository
).
and_call_original
end
end
after
do
after
do
...
...
spec/spec_helper.rb
View file @
081a584a
...
@@ -100,6 +100,16 @@ RSpec.configure do |config|
...
@@ -100,6 +100,16 @@ RSpec.configure do |config|
config
.
before
(
:example
)
do
config
.
before
(
:example
)
do
# Skip pre-receive hook check so we can use the web editor and merge.
# Skip pre-receive hook check so we can use the web editor and merge.
allow_any_instance_of
(
Gitlab
::
Git
::
Hook
).
to
receive
(
:trigger
).
and_return
([
true
,
nil
])
allow_any_instance_of
(
Gitlab
::
Git
::
Hook
).
to
receive
(
:trigger
).
and_return
([
true
,
nil
])
allow_any_instance_of
(
Gitlab
::
Git
::
GitlabProjects
).
to
receive
(
:fork_repository
).
and_wrap_original
do
|
m
,
*
args
|
m
.
call
(
*
args
)
shard_path
,
repository_relative_path
=
args
# We can't leave the hooks in place after a fork, as those would fail in tests
# The "internal" API is not available
FileUtils
.
rm_rf
(
File
.
join
(
shard_path
,
repository_relative_path
,
'hooks'
))
end
# Enable all features by default for testing
# Enable all features by default for testing
allow
(
Feature
).
to
receive
(
:enabled?
)
{
true
}
allow
(
Feature
).
to
receive
(
:enabled?
)
{
true
}
end
end
...
...
spec/support/project_forks_helper.rb
View file @
081a584a
...
@@ -38,10 +38,6 @@ module ProjectForksHelper
...
@@ -38,10 +38,6 @@ module ProjectForksHelper
# so we have to explicitely call this method to clear the @exists variable.
# so we have to explicitely call this method to clear the @exists variable.
# of the instance we're returning here.
# of the instance we're returning here.
forked_project
.
repository
.
after_import
forked_project
.
repository
.
after_import
# We can't leave the hooks in place after a fork, as those would fail in tests
# The "internal" API is not available
FileUtils
.
rm_rf
(
"
#{
forked_project
.
repository
.
path
}
/hooks"
)
end
end
forked_project
forked_project
...
...
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