summaryrefslogtreecommitdiff
path: root/app/models/ci/pipeline.rb
diff options
context:
space:
mode:
authorRegis <boudinot.regis@yahoo.com>2016-12-24 14:12:06 -0700
committerRegis <boudinot.regis@yahoo.com>2016-12-24 14:12:06 -0700
commitd57faaa040bf885481f5a27e12cabc62eeda7ee0 (patch)
tree0ecc5dcd92ea8cce4e295c40c6c0424d6c8f86d7 /app/models/ci/pipeline.rb
parente56254d38ab4a3c3deeacadbc2388b76d932805d (diff)
parent645412b57f558d58418aad278c9a3bf421439e1c (diff)
downloadgitlab-ce-d57faaa040bf885481f5a27e12cabc62eeda7ee0.tar.gz
Merge branch 'master' into auto-pipelines-vue
Diffstat (limited to 'app/models/ci/pipeline.rb')
-rw-r--r--app/models/ci/pipeline.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 4f50587a067..1814469f6ce 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -93,8 +93,11 @@ module Ci
.select("max(#{quoted_table_name}.id)")
.group(:ref, :sha)
- relation = ref ? where(ref: ref) : self
- relation.where(id: max_id).order(id: :desc)
+ if ref
+ where(id: max_id, ref: ref)
+ else
+ where(id: max_id)
+ end
end
def self.latest_status(ref = nil)