diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-12-06 09:39:13 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-12-06 09:39:13 +0000 |
commit | 3b9102b200d25bf1164b15675db65db567d26b7b (patch) | |
tree | 445aaef220b399a3d88204fec130cbd270334990 /app/models/commit.rb | |
parent | cc0c61155561e5baa1b28319ceb6633858a7d9f8 (diff) | |
parent | 1bc1c2d0b2cc5c4c1de5ebdf4229edf6d13d6636 (diff) | |
download | gitlab-ce-list-multiple-clusters.tar.gz |
Merge branch 'multiple-clusters-single-list' into 'list-multiple-clusters'list-multiple-clusters
Use single list for multiple clusters
See merge request gitlab-org/gitlab-ce!15669
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r-- | app/models/commit.rb | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index 6dba154a6ea..6b28d290f99 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -80,10 +80,11 @@ class Commit @raw = raw_commit @project = project + @statuses = {} end def id - @raw.id + raw.id end def ==(other) @@ -108,12 +109,12 @@ class Commit @link_reference_pattern ||= super("commit", /(?<commit>#{COMMIT_SHA_PATTERN})/) end - def to_reference(from_project = nil, full: false) - commit_reference(from_project, id, full: full) + def to_reference(from = nil, full: false) + commit_reference(from, id, full: full) end - def reference_link_text(from_project = nil, full: false) - commit_reference(from_project, short_id, full: full) + def reference_link_text(from = nil, full: false) + commit_reference(from, short_id, full: full) end def diff_line_count @@ -236,11 +237,13 @@ class Commit end def status(ref = nil) - @statuses ||= {} - return @statuses[ref] if @statuses.key?(ref) - @statuses[ref] = pipelines.latest_status(ref) + @statuses[ref] = project.pipelines.latest_status_per_commit(id, ref)[id] + end + + def set_status_for_ref(ref, status) + @statuses[ref] = status end def signature @@ -358,7 +361,7 @@ class Commit @deltas ||= raw.deltas end - def diffs(diff_options = nil) + def diffs(diff_options = {}) Gitlab::Diff::FileCollection::Commit.new(self, diff_options: diff_options) end @@ -378,8 +381,8 @@ class Commit private - def commit_reference(from_project, referable_commit_id, full: false) - reference = project.to_reference(from_project, full: full) + def commit_reference(from, referable_commit_id, full: false) + reference = project.to_reference(from, full: full) if reference.present? "#{reference}#{self.class.reference_prefix}#{referable_commit_id}" |