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
f17735fa
Commit
f17735fa
authored
Jan 14, 2018
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fork now protects default branch on completion
parent
74f2f9b3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
4 deletions
+14
-4
app/workers/repository_fork_worker.rb
app/workers/repository_fork_worker.rb
+1
-4
changelogs/unreleased/19493-fork-does-not-protect-default-branch.yml
...unreleased/19493-fork-does-not-protect-default-branch.yml
+5
-0
spec/workers/repository_fork_worker_spec.rb
spec/workers/repository_fork_worker_spec.rb
+8
-0
No files found.
app/workers/repository_fork_worker.rb
View file @
f17735fa
...
@@ -17,10 +17,7 @@ class RepositoryForkWorker
...
@@ -17,10 +17,7 @@ class RepositoryForkWorker
project
.
repository_storage_path
,
project
.
disk_path
)
project
.
repository_storage_path
,
project
.
disk_path
)
raise
"Unable to fork project
#{
project_id
}
for repository
#{
source_disk_path
}
->
#{
project
.
disk_path
}
"
unless
result
raise
"Unable to fork project
#{
project_id
}
for repository
#{
source_disk_path
}
->
#{
project
.
disk_path
}
"
unless
result
project
.
repository
.
after_import
project
.
after_import
raise
"Project
#{
project_id
}
had an invalid repository after fork"
unless
project
.
valid_repo?
project
.
import_finish
end
end
private
private
...
...
changelogs/unreleased/19493-fork-does-not-protect-default-branch.yml
0 → 100644
View file @
f17735fa
---
title
:
Makes forking protect default branch on completion
merge_request
:
author
:
type
:
fixed
spec/workers/repository_fork_worker_spec.rb
View file @
f17735fa
...
@@ -47,6 +47,14 @@ describe RepositoryForkWorker do
...
@@ -47,6 +47,14 @@ describe RepositoryForkWorker do
perform!
perform!
end
end
it
'protects the default branch'
do
expect_fork_repository
.
and_return
(
true
)
perform!
expect
(
fork_project
.
protected_branches
.
first
.
name
).
to
eq
(
fork_project
.
default_branch
)
end
it
'flushes various caches'
do
it
'flushes various caches'
do
expect_fork_repository
.
and_return
(
true
)
expect_fork_repository
.
and_return
(
true
)
...
...
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