diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-01-15 20:16:39 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-01-15 20:16:39 +0300 |
commit | 4b99bee09602ea0cb950347187b5fdf6d39603b8 (patch) | |
tree | 5978610e2110656fe3e70213a52f3a7a713326e4 | |
parent | 15ef5d66945dfb975ff56fce2c7f0067675f42be (diff) | |
parent | f17735faa5d42fae2ad4b913711c58223c3eb33f (diff) |
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
-rw-r--r-- | app/workers/repository_fork_worker.rb | 5 | ||||
-rw-r--r-- | changelogs/unreleased/19493-fork-does-not-protect-default-branch.yml | 5 | ||||
-rw-r--r-- | spec/workers/repository_fork_worker_spec.rb | 8 |
3 files changed, 14 insertions, 4 deletions
diff --git a/app/workers/repository_fork_worker.rb b/app/workers/repository_fork_worker.rb index d1c57b82681..07584fab7c8 100644 --- a/app/workers/repository_fork_worker.rb +++ b/app/workers/repository_fork_worker.rb @@ -17,10 +17,7 @@ class RepositoryForkWorker project.repository_storage_path, project.disk_path) raise "Unable to fork project #{project_id} for repository #{source_disk_path} -> #{project.disk_path}" unless result - project.repository.after_import - raise "Project #{project_id} had an invalid repository after fork" unless project.valid_repo? - - project.import_finish + project.after_import end private diff --git a/changelogs/unreleased/19493-fork-does-not-protect-default-branch.yml b/changelogs/unreleased/19493-fork-does-not-protect-default-branch.yml new file mode 100644 index 00000000000..962f918e9db --- /dev/null +++ b/changelogs/unreleased/19493-fork-does-not-protect-default-branch.yml @@ -0,0 +1,5 @@ +--- +title: Makes forking protect default branch on completion +merge_request: +author: +type: fixed diff --git a/spec/workers/repository_fork_worker_spec.rb b/spec/workers/repository_fork_worker_spec.rb index 31598586f59..4912baa348c 100644 --- a/spec/workers/repository_fork_worker_spec.rb +++ b/spec/workers/repository_fork_worker_spec.rb @@ -47,6 +47,14 @@ describe RepositoryForkWorker do perform! 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 expect_fork_repository.and_return(true) |