Skip to content
Snippets Groups Projects
Commit c94cff3e authored by Lin Jen-Shin's avatar Lin Jen-Shin
Browse files

Prefer if over return

parent 6597c213
Branches
Tags
1 merge request!5142Add a download buttons for Build Artifacts
Pipeline #
Loading
Loading
@@ -431,14 +431,18 @@ class Project < ActiveRecord::Base
 
def builds_for(build_name, ref = 'HEAD')
ct = commit(ref)
return builds.none unless ct
 
sha = commit(ref).sha
if ct.nil?
builds.none
else
sha = ct.sha
 
builds.joins(:pipeline).
merge(Ci::Pipeline.where(sha: sha)).
where(name: build_name)
end
end
 
def merge_base_commit(first_commit_id, second_commit_id)
sha = repository.merge_base(first_commit_id, second_commit_id)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment