Commit 4b99bee0 authored by Douwe Maan's avatar Douwe Maan

Merge branch '19493-fork-does-not-protect-default-branch' into 'master'

Make forking protect default branch on completion

Closes #19493

See merge request gitlab-org/gitlab-ce!16449
parents 15ef5d66 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
......
---
title: Makes forking protect default branch on completion
merge_request:
author:
type: fixed
...@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment