Commit f8184cec authored by Rémy Coutable's avatar Rémy Coutable

Don't check for commit existence in Github::Representation::Branch#exists?

We don't need to check if the existing branch contains a specific SHA
since we only use the branch's name, the SHA is taken from the pull
request raw `sha` data.
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 324f672e
......@@ -26,7 +26,9 @@ module Github
end
def exists?
@exists ||= branch_exists? && commit_exists?
return @exists if defined?(@exists)
@exists = repository.branch_exists?(ref)
end
def valid?
......@@ -47,14 +49,6 @@ module Github
private
def branch_exists?
repository.branch_exists?(ref)
end
def commit_exists?
repository.branch_names_contains(sha).include?(ref)
end
def repository
@repository ||= options.fetch(:repository)
end
......
......@@ -27,6 +27,8 @@ module Github
end
def target_branch_exists?
return @target_branch_exists if defined?(@target_branch_exists)
@target_branch_exists ||= target_branch.exists?
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment