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:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-30 18:08:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-30 18:08:09 +0300
commit538fff823de57d1ba5317961aa43091de9dc007f (patch)
treec741665b338cc0d51ce5f73f5671e5eee8e69349 /app/models/commit.rb
parent3692e9f8a23386c627942ca2a9edd8c00af7e904 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r--app/models/commit.rb38
1 files changed, 13 insertions, 25 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index a442f607fbf..60a60f191d6 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -119,10 +119,22 @@ class Commit
@raw = raw_commit
@project = project
- @statuses = {}
@gpg_commit = Gitlab::Gpg::Commit.new(self) if project
end
+ delegate \
+ :pipelines,
+ :last_pipeline,
+ :latest_pipeline,
+ :latest_pipeline_for_project,
+ :set_latest_pipeline_for_ref,
+ :status,
+ to: :with_pipeline
+
+ def with_pipeline
+ @with_pipeline ||= CommitWithPipeline.new(self)
+ end
+
def id
raw.id
end
@@ -301,30 +313,6 @@ class Commit
)
end
- def pipelines
- project.ci_pipelines.where(sha: sha)
- end
-
- def last_pipeline
- strong_memoize(:last_pipeline) do
- pipelines.last
- end
- end
-
- def status(ref = nil)
- return @statuses[ref] if @statuses.key?(ref)
-
- @statuses[ref] = status_for_project(ref, project)
- end
-
- def status_for_project(ref, pipeline_project)
- pipeline_project.ci_pipelines.latest_status_per_commit(id, ref)[id]
- end
-
- def set_status_for_ref(ref, status)
- @statuses[ref] = status
- end
-
def signature
return @signature if defined?(@signature)