diff options
author | Krasimir Angelov <kangelov@gitlab.com> | 2019-06-06 14:08:01 +0300 |
---|---|---|
committer | Krasimir Angelov <kangelov@gitlab.com> | 2019-06-06 14:22:50 +0300 |
commit | 52673a916df0f759262afa1aaa230f7d62efd554 (patch) | |
tree | 0635538d8bf562e914c0bb44f1580cf9d56aa5f3 /app/services/projects/fork_service.rb | |
parent | ad9ae16d8a44dd2523bd6e6109db9fe2da45d3a5 (diff) |
Forks get default_git_depth 0 if the origin is nil
If the origin project has no default_git_depth set (i.e. nil) set the
fork's default_git_depth to 0
Diffstat (limited to 'app/services/projects/fork_service.rb')
-rw-r--r-- | app/services/projects/fork_service.rb | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/app/services/projects/fork_service.rb b/app/services/projects/fork_service.rb index 14c1c98ea73..f1bad2d9b15 100644 --- a/app/services/projects/fork_service.rb +++ b/app/services/projects/fork_service.rb @@ -43,7 +43,7 @@ module Projects shared_runners_enabled: @project.shared_runners_enabled, namespace_id: target_namespace.id, fork_network: fork_network, - ci_cd_settings_attributes: { default_git_depth: @project.default_git_depth }, + ci_cd_settings_attributes: { default_git_depth: @project.default_git_depth || 0 }, # We need to assign the fork network membership after the project has # been instantiated to avoid ActiveRecord trying to create it when # initializing the project, as that would cause a foreign key constraint @@ -57,10 +57,7 @@ module Projects new_params.merge!(@project.object_pool_params) - new_project = CreateService.new(current_user, new_params).execute do |p| - p.build_ci_cd_settings(default_git_depth: @project.default_git_depth) - end - + new_project = CreateService.new(current_user, new_params).execute return new_project unless new_project.persisted? # Set the forked_from_project relation after saving to avoid having to |