Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2015-09-29 11:44:53 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2015-09-29 11:47:04 +0300
commit0d877d91e7556edfcdc29ad77491740da3cc7661 (patch)
tree72b1e8b4358b3fcd53875436e4c76f82e750f188 /app/models
parent9498a40052603a0687a0fa6370e50e97bc078301 (diff)
Make ensure_gitlab_ci_project return ci_project or create a new one
Diffstat (limited to 'app/models')
-rw-r--r--app/models/ci/commit.rb6
-rw-r--r--app/models/project.rb6
2 files changed, 3 insertions, 9 deletions
diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb
index a6556690b9a..6d048779cde 100644
--- a/app/models/ci/commit.rb
+++ b/app/models/ci/commit.rb
@@ -37,11 +37,7 @@ module Ci
end
def project
- unless @project
- gl_project.ensure_ci_project
- @project = gl_project.gitlab_ci_project
- end
- @project
+ @project ||= gl_project.ensure_gitlab_ci_project
end
def project_id
diff --git a/app/models/project.rb b/app/models/project.rb
index d9334adef78..953b37e3f7a 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -747,10 +747,8 @@ class Project < ActiveRecord::Base
gitlab_ci_project.commits.find_by(sha: sha) if gitlab_ci?
end
- def ensure_ci_project
- unless gitlab_ci_project
- create_gitlab_ci_project
- end
+ def ensure_gitlab_ci_project
+ gitlab_ci_project || create_gitlab_ci_project
end
def enable_ci(user)