Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-04-03 13:49:54 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-04-03 14:03:16 +0300
commitfd30b3d4972180b6e91d0180b140f32622c48b1d (patch)
tree9ff40552f415568869ee3ec86c2f5a276c3ab4b9 /app/models/container_repository.rb
parent6fefa794304a6233368b592422ea0fb71a2700f0 (diff)
Ensure root container repository when visiting registry
Root container repository is a images repository that had been created before 9.1, before we introduced multi-level images support.
Diffstat (limited to 'app/models/container_repository.rb')
-rw-r--r--app/models/container_repository.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/models/container_repository.rb b/app/models/container_repository.rb
index 0cf781799e9..36158d75ae8 100644
--- a/app/models/container_repository.rb
+++ b/app/models/container_repository.rb
@@ -48,6 +48,10 @@ class ContainerRepository < ActiveRecord::Base
tags.to_a.any?
end
+ def root_repository?
+ name.empty?
+ end
+
def delete_tags!
return unless has_tags?
@@ -58,8 +62,12 @@ class ContainerRepository < ActiveRecord::Base
end
end
+ def self.build_from_path(path)
+ self.new(project: path.repository_project,
+ name: path.repository_name)
+ end
+
def self.create_from_path!(path)
- self.create(project: path.repository_project,
- name: path.repository_name)
+ build_from_path(path).tap(&:save!)
end
end