summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-07-06 02:52:59 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-07-06 13:08:12 -0300
commit5f86a084f254859e551955e91803ce8faa30bda5 (patch)
treeca6d6cb1cf19bdca0d0134862091316e84bd6773 /lib
parent4e5de3e6ee822c63e7d2278ef8449275ca1fc9f1 (diff)
downloadgitlab-ce-5f86a084f254859e551955e91803ce8faa30bda5.tar.gz
Consider that a GH exists only if both `ref`, and `sha` exist
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/github_import/branch_formatter.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/gitlab/github_import/branch_formatter.rb b/lib/gitlab/github_import/branch_formatter.rb
index a15fc84b418..7d2d545b84e 100644
--- a/lib/gitlab/github_import/branch_formatter.rb
+++ b/lib/gitlab/github_import/branch_formatter.rb
@@ -4,7 +4,7 @@ module Gitlab
delegate :repo, :sha, :ref, to: :raw_data
def exists?
- project.repository.branch_exists?(ref)
+ branch_exists? && commit_exists?
end
def name
@@ -15,11 +15,15 @@ module Gitlab
repo.present?
end
- def valid?
- repo.present?
+ private
+
+ def branch_exists?
+ project.repository.branch_exists?(ref)
end
- private
+ def commit_exists?
+ project.repository.commit(sha).present?
+ end
def short_id
sha.to_s[0..7]