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.rb31
1 files changed, 16 insertions, 15 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 228f66b95cd..241e7e60dd2 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -727,8 +727,8 @@ class Project < ActiveRecord::Base
end
end
- def issue_reference_pattern
- issues_tracker.reference_pattern
+ def external_issue_reference_pattern
+ external_issue_tracker.class.reference_pattern
end
def default_issues_tracker?
@@ -815,7 +815,7 @@ class Project < ActiveRecord::Base
end
def ci_service
- @ci_service ||= ci_services.find_by(active: true)
+ @ci_service ||= ci_services.reorder(nil).find_by(active: true)
end
def deployment_services
@@ -823,7 +823,7 @@ class Project < ActiveRecord::Base
end
def deployment_service
- @deployment_service ||= deployment_services.find_by(active: true)
+ @deployment_service ||= deployment_services.reorder(nil).find_by(active: true)
end
def monitoring_services
@@ -831,7 +831,7 @@ class Project < ActiveRecord::Base
end
def monitoring_service
- @monitoring_service ||= monitoring_services.find_by(active: true)
+ @monitoring_service ||= monitoring_services.reorder(nil).find_by(active: true)
end
def jira_tracker?
@@ -963,6 +963,7 @@ class Project < ActiveRecord::Base
begin
gitlab_shell.mv_repository(repository_storage_path, "#{old_path_with_namespace}.wiki", "#{new_path_with_namespace}.wiki")
send_move_instructions(old_path_with_namespace)
+ expires_full_path_cache
@old_path_with_namespace = old_path_with_namespace
@@ -1073,21 +1074,21 @@ class Project < ActiveRecord::Base
merge_requests.where(source_project_id: self.id)
end
- def create_repository
+ def create_repository(force: false)
# Forked import is handled asynchronously
- unless forked?
- if gitlab_shell.add_repository(repository_storage_path, path_with_namespace)
- repository.after_create
- true
- else
- errors.add(:base, 'Failed to create repository via gitlab-shell')
- false
- end
+ return if forked? && !force
+
+ if gitlab_shell.add_repository(repository_storage_path, path_with_namespace)
+ repository.after_create
+ true
+ else
+ errors.add(:base, 'Failed to create repository via gitlab-shell')
+ false
end
end
def ensure_repository
- create_repository unless repository_exists?
+ create_repository(force: true) unless repository_exists?
end
def repository_exists?