Commit b8704dce authored by Krasimir Angelov's avatar Krasimir Angelov

Comment why forks get default_git_depth of 0 instead nil

and simplify ProjectCiCdSetting#set_default_git_depth
parent c0a812ec
......@@ -31,8 +31,6 @@ class ProjectCiCdSetting < ApplicationRecord
private
def set_default_git_depth
return if default_git_depth
self.default_git_depth = DEFAULT_GIT_DEPTH
self.default_git_depth ||= DEFAULT_GIT_DEPTH
end
end
......@@ -43,6 +43,9 @@ module Projects
shared_runners_enabled: @project.shared_runners_enabled,
namespace_id: target_namespace.id,
fork_network: fork_network,
# We need to set default_git_depth to 0 for the forked project when
# @project.default_git_depth is nil in order to keep the same behaviour
# and not get ProjectCiCdSetting::DEFAULT_GIT_DEPTH set on create
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
......
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