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/models/project_ci_cd_setting.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/models/project_ci_cd_setting.rb')
-rw-r--r-- | app/models/project_ci_cd_setting.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/project_ci_cd_setting.rb b/app/models/project_ci_cd_setting.rb index cf1f80fd1ef..9e7d921c229 100644 --- a/app/models/project_ci_cd_setting.rb +++ b/app/models/project_ci_cd_setting.rb @@ -8,7 +8,7 @@ class ProjectCiCdSetting < ApplicationRecord DEFAULT_GIT_DEPTH = 50 - before_create :set_default_git_depth, unless: :default_git_depth? + before_create :set_default_git_depth validates :default_git_depth, numericality: { @@ -31,6 +31,8 @@ class ProjectCiCdSetting < ApplicationRecord private def set_default_git_depth + return if default_git_depth + self.default_git_depth = DEFAULT_GIT_DEPTH end end |