diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-04-03 12:49:54 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-04-03 13:03:16 +0200 |
commit | fd30b3d4972180b6e91d0180b140f32622c48b1d (patch) | |
tree | 9ff40552f415568869ee3ec86c2f5a276c3ab4b9 /app/models/container_repository.rb | |
parent | 6fefa794304a6233368b592422ea0fb71a2700f0 (diff) | |
download | gitlab-ce-fd30b3d4972180b6e91d0180b140f32622c48b1d.tar.gz |
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.rb | 12 |
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 |