summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 6893f76dda9..e1acfbe7770 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -36,7 +36,6 @@ class Project < ActiveRecord::Base
extend Gitlab::ConfigHelper
BoardLimitExceeded = Class.new(StandardError)
- AmbiguousRef = Class.new(StandardError)
STATISTICS_ATTRIBUTE = 'repositories_count'.freeze
NUMBER_OF_PERMITTED_BOARDS = 1
@@ -1166,7 +1165,7 @@ class Project < ActiveRecord::Base
branch_exists = repository.branch_exists?(ref)
if tag_exists && branch_exists
- raise AmbiguousRef
+ nil
elsif tag_exists
repository.find_tag(ref)
elsif branch_exists
@@ -1754,6 +1753,8 @@ class Project < ActiveRecord::Base
def protected_for?(ref)
resolved_ref = resolve_ref(ref)
+ return false unless resolved_ref
+
full_ref = resolved_ref.full_ref
ref_name = resolved_ref.name