Commit fb06a4d8 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Rename more path_with_namespace -> full_path or disk_path

parent c6dee998
module Storage
module LegacyProjectWiki
extend ActiveSupport::Concern
def disk_path
project.disk_path + '.wiki'
end
end
end
module Storage
module LegacyRepository
extend ActiveSupport::Concern
delegate :disk_path, to: :project
end
end
...@@ -480,7 +480,7 @@ class Project < ActiveRecord::Base ...@@ -480,7 +480,7 @@ class Project < ActiveRecord::Base
end end
def repository def repository
@repository ||= Repository.new(path_with_namespace, self) @repository ||= Repository.new(full_path, disk_path, self)
end end
def container_registry_url def container_registry_url
...@@ -945,7 +945,7 @@ class Project < ActiveRecord::Base ...@@ -945,7 +945,7 @@ class Project < ActiveRecord::Base
end end
def url_to_repo def url_to_repo
gitlab_shell.url_to_repo(path_with_namespace) gitlab_shell.url_to_repo(full_path)
end end
def repo_exists? def repo_exists?
...@@ -980,8 +980,9 @@ class Project < ActiveRecord::Base ...@@ -980,8 +980,9 @@ class Project < ActiveRecord::Base
# Expires various caches before a project is renamed. # Expires various caches before a project is renamed.
def expire_caches_before_rename(old_path) def expire_caches_before_rename(old_path)
repo = Repository.new(old_path, self) # TODO: if we start using UUIDs for cache, we don't need to do this HACK anymore
wiki = Repository.new("#{old_path}.wiki", self) repo = Repository.new(old_path, old_path, self)
wiki = Repository.new("#{old_path}.wiki", "#{old_path}.wiki", self)
if repo.exists? if repo.exists?
repo.before_delete repo.before_delete
...@@ -1209,6 +1210,7 @@ class Project < ActiveRecord::Base ...@@ -1209,6 +1210,7 @@ class Project < ActiveRecord::Base
deploy_keys.where(public: false).delete_all deploy_keys.where(public: false).delete_all
end end
# TODO: what to do here when not using Legacy Storage? Do we still need to rename and delay removal?
def remove_pages def remove_pages
::Projects::UpdatePagesConfigurationService.new(self).execute ::Projects::UpdatePagesConfigurationService.new(self).execute
......
class ProjectWiki class ProjectWiki
include Gitlab::ShellAdapter include Gitlab::ShellAdapter
include Storage::LegacyProjectWiki
MARKUPS = { MARKUPS = {
'Markdown' => :markdown, 'Markdown' => :markdown,
...@@ -26,16 +27,19 @@ class ProjectWiki ...@@ -26,16 +27,19 @@ class ProjectWiki
@project.path + '.wiki' @project.path + '.wiki'
end end
def path_with_namespace def full_path
@project.full_path + '.wiki' @project.full_path + '.wiki'
end end
# @deprecated use full_path when you need it for an URL route or disk_path when you want to point to the filesystem
alias_method :path_with_namespace, :full_path
def web_url def web_url
Gitlab::Routing.url_helpers.project_wiki_url(@project, :home) Gitlab::Routing.url_helpers.project_wiki_url(@project, :home)
end end
def url_to_repo def url_to_repo
gitlab_shell.url_to_repo(path_with_namespace) gitlab_shell.url_to_repo(full_path)
end end
def ssh_url_to_repo def ssh_url_to_repo
...@@ -43,11 +47,11 @@ class ProjectWiki ...@@ -43,11 +47,11 @@ class ProjectWiki
end end
def http_url_to_repo def http_url_to_repo
"#{Gitlab.config.gitlab.url}/#{path_with_namespace}.git" "#{Gitlab.config.gitlab.url}/#{full_path}.git"
end end
def wiki_base_path def wiki_base_path
[Gitlab.config.gitlab.relative_url_root, "/", @project.full_path, "/wikis"].join('') [Gitlab.config.gitlab.relative_url_root, '/', @project.full_path, '/wikis'].join('')
end end
# Returns the Gollum::Wiki object. # Returns the Gollum::Wiki object.
...@@ -134,7 +138,7 @@ class ProjectWiki ...@@ -134,7 +138,7 @@ class ProjectWiki
end end
def repository def repository
@repository ||= Repository.new(path_with_namespace, @project) @repository ||= Repository.new(full_path, disk_path, @project)
end end
def default_branch def default_branch
...@@ -142,7 +146,7 @@ class ProjectWiki ...@@ -142,7 +146,7 @@ class ProjectWiki
end end
def create_repo! def create_repo!
if init_repo(path_with_namespace) if init_repo(disk_path)
wiki = Gollum::Wiki.new(path_to_repo) wiki = Gollum::Wiki.new(path_to_repo)
else else
raise CouldNotCreateWikiError raise CouldNotCreateWikiError
...@@ -162,15 +166,15 @@ class ProjectWiki ...@@ -162,15 +166,15 @@ class ProjectWiki
web_url: web_url, web_url: web_url,
git_ssh_url: ssh_url_to_repo, git_ssh_url: ssh_url_to_repo,
git_http_url: http_url_to_repo, git_http_url: http_url_to_repo,
path_with_namespace: path_with_namespace, path_with_namespace: full_path,
default_branch: default_branch default_branch: default_branch
} }
end end
private private
def init_repo(path_with_namespace) def init_repo(disk_path)
gitlab_shell.add_repository(project.repository_storage_path, path_with_namespace) gitlab_shell.add_repository(project.repository_storage_path, disk_path)
end end
def commit_details(action, message = nil, title = nil) def commit_details(action, message = nil, title = nil)
...@@ -184,7 +188,7 @@ class ProjectWiki ...@@ -184,7 +188,7 @@ class ProjectWiki
end end
def path_to_repo def path_to_repo
@path_to_repo ||= File.join(project.repository_storage_path, "#{path_with_namespace}.git") @path_to_repo ||= File.join(project.repository_storage_path, "#{disk_path}.git")
end end
def update_project_activity def update_project_activity
......
...@@ -4,7 +4,7 @@ class Repository ...@@ -4,7 +4,7 @@ class Repository
include Gitlab::ShellAdapter include Gitlab::ShellAdapter
include RepositoryMirroring include RepositoryMirroring
attr_accessor :path_with_namespace, :project attr_accessor :full_path, :disk_path, :project
delegate :ref_name_for_sha, to: :raw_repository delegate :ref_name_for_sha, to: :raw_repository
...@@ -52,13 +52,14 @@ class Repository ...@@ -52,13 +52,14 @@ class Repository
end end
end end
def initialize(path_with_namespace, project) def initialize(full_path, disk_path, project)
@path_with_namespace = path_with_namespace @full_path = full_path
@disk_path = disk_path
@project = project @project = project
end end
def raw_repository def raw_repository
return nil unless path_with_namespace return nil unless full_path
@raw_repository ||= initialize_raw_repository @raw_repository ||= initialize_raw_repository
end end
...@@ -66,7 +67,7 @@ class Repository ...@@ -66,7 +67,7 @@ class Repository
# Return absolute path to repository # Return absolute path to repository
def path_to_repo def path_to_repo
@path_to_repo ||= File.expand_path( @path_to_repo ||= File.expand_path(
File.join(repository_storage_path, path_with_namespace + ".git") File.join(repository_storage_path, disk_path + '.git')
) )
end end
...@@ -469,7 +470,7 @@ class Repository ...@@ -469,7 +470,7 @@ class Repository
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/314 # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/314
def exists? def exists?
return false unless path_with_namespace return false unless full_path
Gitlab::GitalyClient.migrate(:repository_exists) do |enabled| Gitlab::GitalyClient.migrate(:repository_exists) do |enabled|
if enabled if enabled
...@@ -1005,7 +1006,7 @@ class Repository ...@@ -1005,7 +1006,7 @@ class Repository
end end
def fetch_remote(remote, forced: false, no_tags: false) def fetch_remote(remote, forced: false, no_tags: false)
gitlab_shell.fetch_remote(repository_storage_path, path_with_namespace, remote, forced: forced, no_tags: no_tags) gitlab_shell.fetch_remote(repository_storage_path, disk_path, remote, forced: forced, no_tags: no_tags)
end end
def fetch_ref(source_path, source_ref, target_ref) def fetch_ref(source_path, source_ref, target_ref)
...@@ -1104,7 +1105,8 @@ class Repository ...@@ -1104,7 +1105,8 @@ class Repository
end end
def cache def cache
@cache ||= RepositoryCache.new(path_with_namespace, @project.id) # TODO: should we use UUIDs here? We could move repositories without clearing this cache
@cache ||= RepositoryCache.new(full_path, @project.id)
end end
def tags_sorted_by_committed_date def tags_sorted_by_committed_date
...@@ -1127,7 +1129,7 @@ class Repository ...@@ -1127,7 +1129,7 @@ class Repository
end end
def repository_event(event, tags = {}) def repository_event(event, tags = {})
Gitlab::Metrics.add_event(event, { path: path_with_namespace }.merge(tags)) Gitlab::Metrics.add_event(event, { path: full_path }.merge(tags))
end end
def create_commit(params = {}) def create_commit(params = {})
...@@ -1141,6 +1143,6 @@ class Repository ...@@ -1141,6 +1143,6 @@ class Repository
end end
def initialize_raw_repository def initialize_raw_repository
Gitlab::Git::Repository.new(project.repository_storage, path_with_namespace + '.git') Gitlab::Git::Repository.new(project.repository_storage, disk_path + '.git')
end end
end end
...@@ -127,7 +127,7 @@ module Projects ...@@ -127,7 +127,7 @@ module Projects
def flush_caches(project) def flush_caches(project)
project.repository.before_delete project.repository.before_delete
Repository.new(wiki_path, project).before_delete Repository.new(wiki_path, repo_path, project).before_delete
end end
end end
end end
...@@ -30,7 +30,7 @@ class FileUploader < GitlabUploader ...@@ -30,7 +30,7 @@ class FileUploader < GitlabUploader
# #
# Returns a String without a trailing slash # Returns a String without a trailing slash
def self.dynamic_path_segment(model) def self.dynamic_path_segment(model)
File.join(CarrierWave.root, base_dir, model.path_with_namespace) File.join(CarrierWave.root, base_dir, model.full_path)
end end
attr_accessor :model attr_accessor :model
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
%span.badge %span.badge
= storage_counter(project.statistics.storage_size) = storage_counter(project.statistics.storage_size)
%span.pull-right.light %span.pull-right.light
%span.monospace= project.path_with_namespace + ".git" %span.monospace= project.full_path + '.git'
.panel-footer .panel-footer
= paginate @projects, param_name: 'projects_page', theme: 'gitlab' = paginate @projects, param_name: 'projects_page', theme: 'gitlab'
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
%span.badge %span.badge
= storage_counter(project.statistics.storage_size) = storage_counter(project.statistics.storage_size)
%span.pull-right.light %span.pull-right.light
%span.monospace= project.path_with_namespace + ".git" %span.monospace= project.full_path + '.git'
.col-md-6 .col-md-6
- if can?(current_user, :admin_group_member, @group) - if can?(current_user, :admin_group_member, @group)
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
%td %td
= provider_project_link(provider, project.import_source) = provider_project_link(provider, project.import_source)
%td %td
= link_to project.path_with_namespace, [project.namespace.becomes(Namespace), project] = link_to project.full_path, [project.namespace.becomes(Namespace), project]
%td.job-status %td.job-status
- if project.import_status == 'finished' - if project.import_status == 'finished'
%span %span
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
job.attr("id", "project_#{@project.id}") job.attr("id", "project_#{@project.id}")
target_field = job.find(".import-target") target_field = job.find(".import-target")
target_field.empty() target_field.empty()
target_field.append('#{link_to @project.path_with_namespace, project_path(@project)}') target_field.append('#{link_to @project.full_path, project_path(@project)}')
$("table.import-jobs tbody").prepend(job) $("table.import-jobs tbody").prepend(job)
job.addClass("active").find(".import-actions").html("<i class='fa fa-spinner fa-spin'></i> started") job.addClass("active").find(".import-actions").html("<i class='fa fa-spinner fa-spin'></i> started")
- else - else
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
%td %td
= link_to project.import_source, "https://bitbucket.org/#{project.import_source}", target: '_blank', rel: 'noopener noreferrer' = link_to project.import_source, "https://bitbucket.org/#{project.import_source}", target: '_blank', rel: 'noopener noreferrer'
%td %td
= link_to project.path_with_namespace, [project.namespace.becomes(Namespace), project] = link_to project.full_path, [project.namespace.becomes(Namespace), project]
%td.job-status %td.job-status
- if project.import_status == 'finished' - if project.import_status == 'finished'
%span %span
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
%td %td
= project.import_source = project.import_source
%td %td
= link_to project.path_with_namespace, [project.namespace.becomes(Namespace), project] = link_to project.full_path, [project.namespace.becomes(Namespace), project]
%td.job-status %td.job-status
- if project.import_status == 'finished' - if project.import_status == 'finished'
%span %span
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
%td %td
= link_to project.import_source, "https://gitlab.com/#{project.import_source}", target: "_blank" = link_to project.import_source, "https://gitlab.com/#{project.import_source}", target: "_blank"
%td %td
= link_to project.path_with_namespace, [project.namespace.becomes(Namespace), project] = link_to project.full_path, [project.namespace.becomes(Namespace), project]
%td.job-status %td.job-status
- if project.import_status == 'finished' - if project.import_status == 'finished'
%span %span
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
%td %td
= link_to project.import_source, "https://code.google.com/p/#{project.import_source}", target: "_blank", rel: 'noopener noreferrer' = link_to project.import_source, "https://code.google.com/p/#{project.import_source}", target: "_blank", rel: 'noopener noreferrer'
%td %td
= link_to project.path_with_namespace, [project.namespace.becomes(Namespace), project] = link_to project.full_path, [project.namespace.becomes(Namespace), project]
%td.job-status %td.job-status
- if project.import_status == 'finished' - if project.import_status == 'finished'
%span %span
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
- notes = commit.notes - notes = commit.notes
- note_count = notes.user.count - note_count = notes.user.count
- cache_key = [project.path_with_namespace, commit.id, current_application_settings, note_count, @path.presence, current_controller?(:commits)] - cache_key = [project.full_path, commit.id, current_application_settings, note_count, @path.presence, current_controller?(:commits)]
- cache_key.push(commit.status(ref)) if commit.status(ref) - cache_key.push(commit.status(ref)) if commit.status(ref)
= cache(cache_key, expires_in: 1.day) do = cache(cache_key, expires_in: 1.day) do
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
Suggestions: Suggestions:
%code= 'gitlab' %code= 'gitlab'
%code= @project.path # Path contains no spaces, but dashes %code= @project.path # Path contains no spaces, but dashes
%code= @project.path_with_namespace %code= @project.full_path
%p %p
Reserved: Reserved:
= link_to 'https://docs.mattermost.com/help/messaging/executing-commands.html#built-in-commands', target: '__blank' do = link_to 'https://docs.mattermost.com/help/messaging/executing-commands.html#built-in-commands', target: '__blank' do
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
- projects = target_projects(@project) - projects = target_projects(@project)
.merge-request-select.dropdown .merge-request-select.dropdown
= f.hidden_field :target_project_id = f.hidden_field :target_project_id
= dropdown_toggle f.object.target_project.path_with_namespace, { toggle: "dropdown", field_name: "#{f.object_name}[target_project_id]", disabled: @merge_request.persisted? }, { toggle_class: "js-compare-dropdown js-target-project" } = dropdown_toggle f.object.target_project.full_path, { toggle: "dropdown", field_name: "#{f.object_name}[target_project_id]", disabled: @merge_request.persisted? }, { toggle_class: "js-compare-dropdown js-target-project" }
.dropdown-menu.dropdown-menu-selectable.dropdown-target-project .dropdown-menu.dropdown-menu-selectable.dropdown-target-project
= dropdown_title("Select target project") = dropdown_title("Select target project")
= dropdown_filter("Search projects") = dropdown_filter("Search projects")
......
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
- projects.each do |project| - projects.each do |project|
%li %li
%a{ href: "#", class: "#{('is-active' if selected == project.id)}", data: { id: project.id } } %a{ href: "#", class: "#{('is-active' if selected == project.id)}", data: { id: project.id } }
= project.path_with_namespace = project.full_path
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
Suggestions: Suggestions:
%code= 'gitlab' %code= 'gitlab'
%code= @project.path # Path contains no spaces, but dashes %code= @project.path # Path contains no spaces, but dashes
%code= @project.path_with_namespace %code= @project.full_path
.form-group .form-group
= label_tag :request_url, 'Request URL', class: 'col-sm-2 col-xs-12 control-label' = label_tag :request_url, 'Request URL', class: 'col-sm-2 col-xs-12 control-label'
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
Suggestions: Suggestions:
%code= 'gitlab' %code= 'gitlab'
%code= @project.path # Path contains no spaces, but dashes %code= @project.path # Path contains no spaces, but dashes
%code= @project.path_with_namespace %code= @project.full_path
.form-group .form-group
= label_tag :url, 'URL', class: 'col-sm-2 col-xs-12 control-label' = label_tag :url, 'URL', class: 'col-sm-2 col-xs-12 control-label'
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
.git-access-header .git-access-header
Clone repository Clone repository
%strong= @project_wiki.path_with_namespace %strong= @project_wiki.full_path
= render "shared/clone_panel", project: @project_wiki = render "shared/clone_panel", project: @project_wiki
......
...@@ -42,7 +42,7 @@ module Backup ...@@ -42,7 +42,7 @@ module Backup
path_to_wiki_bundle = path_to_bundle(wiki) path_to_wiki_bundle = path_to_bundle(wiki)
if File.exist?(path_to_wiki_repo) if File.exist?(path_to_wiki_repo)
progress.print " * #{wiki.path_with_namespace} ... " progress.print " * #{wiki.full_path} ... "
if empty_repo?(wiki) if empty_repo?(wiki)
progress.puts " [SKIPPED]".color(:cyan) progress.puts " [SKIPPED]".color(:cyan)
else else
...@@ -104,7 +104,7 @@ module Backup ...@@ -104,7 +104,7 @@ module Backup
path_to_wiki_bundle = path_to_bundle(wiki) path_to_wiki_bundle = path_to_bundle(wiki)
if File.exist?(path_to_wiki_bundle) if File.exist?(path_to_wiki_bundle)
progress.print " * #{wiki.path_with_namespace} ... " progress.print " * #{wiki.full_path} ... "
# If a wiki bundle exists, first remove the empty repo # If a wiki bundle exists, first remove the empty repo
# that was initialized with ProjectWiki.new() and then # that was initialized with ProjectWiki.new() and then
...@@ -192,7 +192,7 @@ module Backup ...@@ -192,7 +192,7 @@ module Backup
project_or_wiki.repository.expire_exists_cache # protect backups from stale cache project_or_wiki.repository.expire_exists_cache # protect backups from stale cache
project_or_wiki.repository.empty_repo? project_or_wiki.repository.empty_repo?
rescue => e rescue => e
progress.puts "Ignoring repository error and continuing backing up project: #{project_or_wiki.path_with_namespace} - #{e.message}".color(:orange) progress.puts "Ignoring repository error and continuing backing up project: #{project_or_wiki.full_path} - #{e.message}".color(:orange)
false false
end end
......
...@@ -51,7 +51,7 @@ module Banzai ...@@ -51,7 +51,7 @@ module Banzai
uri.path = [ uri.path = [
relative_url_root, relative_url_root,
context[:project].path_with_namespace, context[:project].full_path,
uri_type(file_path), uri_type(file_path),
Addressable::URI.escape(ref), Addressable::URI.escape(ref),
Addressable::URI.escape(file_path) Addressable::URI.escape(file_path)
......
...@@ -254,7 +254,7 @@ module Gitlab ...@@ -254,7 +254,7 @@ module Gitlab
def import_wiki def import_wiki
unless project.wiki.repository_exists? unless project.wiki.repository_exists?
wiki = WikiFormatter.new(project) wiki = WikiFormatter.new(project)
gitlab_shell.import_repository(project.repository_storage_path, wiki.path_with_namespace, wiki.import_url) gitlab_shell.import_repository(project.repository_storage_path, wiki.disk_path, wiki.import_url)
end end
rescue Gitlab::Shell::Error => e rescue Gitlab::Shell::Error => e
# GitHub error message when the wiki repo has not been created, # GitHub error message when the wiki repo has not been created,
......
...@@ -7,8 +7,8 @@ module Gitlab ...@@ -7,8 +7,8 @@ module Gitlab
@project = project @project = project
end end
def path_with_namespace def disk_path
"#{project.full_path}.wiki" "#{project.disk_path}.wiki"
end end
def import_url def import_url
......
...@@ -527,7 +527,7 @@ namespace :gitlab do ...@@ -527,7 +527,7 @@ namespace :gitlab do
repo_dirs = user.authorized_projects.map do |p| repo_dirs = user.authorized_projects.map do |p|
File.join( File.join(
p.repository_storage_path, p.repository_storage_path,
"#{p.path_with_namespace}.git" "#{p.disk_path}.git"
) )
end end
......
...@@ -9,7 +9,7 @@ namespace :gitlab do ...@@ -9,7 +9,7 @@ namespace :gitlab do
scope = scope.where('id IN (?) OR namespace_id in (?)', project_ids, namespace_ids) scope = scope.where('id IN (?) OR namespace_id in (?)', project_ids, namespace_ids)
end end
scope.find_each do |project| scope.find_each do |project|
base = File.join(project.repository_storage_path, project.path_with_namespace) base = File.join(project.repository_storage_path, project.disk_path)
puts base + '.git' puts base + '.git'
puts base + '.wiki.git' puts base + '.wiki.git'
end end
......
...@@ -80,7 +80,7 @@ namespace :gitlab do ...@@ -80,7 +80,7 @@ namespace :gitlab do
print '-' print '-'
else else
if Gitlab::Shell.new.add_repository(project.repository_storage_path, if Gitlab::Shell.new.add_repository(project.repository_storage_path,
project.path_with_namespace) project.disk_path)
print '.' print '.'
else else
print 'F' print 'F'
......
...@@ -20,7 +20,7 @@ describe 'Projects > Wiki > User views Git access wiki page' do ...@@ -20,7 +20,7 @@ describe 'Projects > Wiki > User views Git access wiki page' do
visit project_wiki_path(project, wiki_page) visit project_wiki_path(project, wiki_page)
click_link 'Clone repository' click_link 'Clone repository'
expect(page).to have_text("Clone repository #{project.wiki.path_with_namespace}") expect(page).to have_text("Clone repository #{project.wiki.full_path}")
expect(page).to have_text(project.wiki.http_url_to_repo) expect(page).to have_text(project.wiki.http_url_to_repo)
end end
end end
...@@ -52,21 +52,21 @@ describe Banzai::Filter::UploadLinkFilter do ...@@ -52,21 +52,21 @@ describe Banzai::Filter::UploadLinkFilter do
it 'rebuilds relative URL for a link' do it 'rebuilds relative URL for a link' do
doc = filter(link('/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg')) doc = filter(link('/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg'))
expect(doc.at_css('a')['href']) expect(doc.at_css('a')['href'])
.to eq "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg" .to eq "#{Gitlab.config.gitlab.url}/#{project.full_path}/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg"
doc = filter(nested_link('/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg')) doc = filter(nested_link('/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg'))
expect(doc.at_css('a')['href']) expect(doc.at_css('a')['href'])
.to eq "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg" .to eq "#{Gitlab.config.gitlab.url}/#{project.full_path}/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg"
end end
it 'rebuilds relative URL for an image' do it 'rebuilds relative URL for an image' do
doc = filter(image('/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg')) doc = filter(image('/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg'))
expect(doc.at_css('img')['src']) expect(doc.at_css('img')['src'])
.to eq "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg" .to eq "#{Gitlab.config.gitlab.url}/#{project.full_path}/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg"
doc = filter(nested_image('/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg')) doc = filter(nested_image('/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg'))
expect(doc.at_css('img')['src']) expect(doc.at_css('img')['src'])
.to eq "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg" .to eq "#{Gitlab.config.gitlab.url}/#{project.full_path}/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg"
end end
it 'does not modify absolute URL' do it 'does not modify absolute URL' do
...@@ -85,7 +85,7 @@ describe Banzai::Filter::UploadLinkFilter do ...@@ -85,7 +85,7 @@ describe Banzai::Filter::UploadLinkFilter do
.to receive(:image?).with(path).and_return(true) .to receive(:image?).with(path).and_return(true)
doc = filter(image(escaped)) doc = filter(image(escaped))
expect(doc.at_css('img')['src']).to match "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/uploads/%ED%95%9C%EA%B8%80.png" expect(doc.at_css('img')['src']).to match "#{Gitlab.config.gitlab.url}/#{project.full_path}/uploads/%ED%95%9C%EA%B8%80.png"
end end
end end
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe Gitlab::GitalyClient::CommitService do describe Gitlab::GitalyClient::CommitService do
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:storage_name) { project.repository_storage } let(:storage_name) { project.repository_storage }
let(:relative_path) { project.path_with_namespace + '.git' } let(:relative_path) { project.disk_path + '.git' }
let(:repository) { project.repository } let(:repository) { project.repository }
let(:repository_message) { repository.gitaly_repository } let(:repository_message) { repository.gitaly_repository }
let(:revision) { '913c66a37b4a45b9769037c55c2d238bd0942d2e' } let(:revision) { '913c66a37b4a45b9769037c55c2d238bd0942d2e' }
......
...@@ -9,9 +9,9 @@ describe Gitlab::GithubImport::WikiFormatter do ...@@ -9,9 +9,9 @@ describe Gitlab::GithubImport::WikiFormatter do
subject(:wiki) { described_class.new(project) } subject(:wiki) { described_class.new(project) }
describe '#path_with_namespace' do describe '#disk_path' do
it 'appends .wiki to project path' do it 'appends .wiki to project path' do
expect(wiki.path_with_namespace).to eq 'gitlabhq/gitlabhq.wiki' expect(wiki.disk_path).to eq project.disk_path + '.wiki'
end end
end end
......
...@@ -15,19 +15,23 @@ describe ProjectWiki do ...@@ -15,19 +15,23 @@ describe ProjectWiki do
describe "#path_with_namespace" do describe "#path_with_namespace" do
it "returns the project path with namespace with the .wiki extension" do it "returns the project path with namespace with the .wiki extension" do
expect(subject.path_with_namespace).to eq(project.path_with_namespace + ".wiki") expect(subject.path_with_namespace).to eq(project.full_path + '.wiki')
end
it 'returns the same value as #full_path' do
expect(subject.path_with_namespace).to eq(subject.full_path)
end end
end end
describe '#web_url' do describe '#web_url' do
it 'returns the full web URL to the wiki' do it 'returns the full web URL to the wiki' do
expect(subject.web_url).to eq("#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/wikis/home") expect(subject.web_url).to eq("#{Gitlab.config.gitlab.url}/#{project.full_path}/wikis/home")
end end
end end
describe "#url_to_repo" do describe "#url_to_repo" do
it "returns the correct ssh url to the repo" do it "returns the correct ssh url to the repo" do
expect(subject.url_to_repo).to eq(gitlab_shell.url_to_repo(subject.path_with_namespace)) expect(subject.url_to_repo).to eq(gitlab_shell.url_to_repo(subject.full_path))
end end
end end
...@@ -41,7 +45,7 @@ describe ProjectWiki do ...@@ -41,7 +45,7 @@ describe ProjectWiki do
let(:project) { create :empty_project } let(:project) { create :empty_project }
it 'returns the full http url to the repo' do it 'returns the full http url to the repo' do
expected_url = "#{Gitlab.config.gitlab.url}/#{subject.path_with_namespace}.git" expected_url = "#{Gitlab.config.gitlab.url}/#{subject.full_path}.git"
expect(project_wiki.http_url_to_repo).to eq(expected_url) expect(project_wiki.http_url_to_repo).to eq(expected_url)
expect(project_wiki.http_url_to_repo).not_to include('@') expect(project_wiki.http_url_to_repo).not_to include('@')
...@@ -50,7 +54,7 @@ describe ProjectWiki do ...@@ -50,7 +54,7 @@ describe ProjectWiki do
describe "#wiki_base_path" do describe "#wiki_base_path" do
it "returns the wiki base path" do it "returns the wiki base path" do
wiki_base_path = "#{Gitlab.config.gitlab.relative_url_root}/#{project.path_with_namespace}/wikis" wiki_base_path = "#{Gitlab.config.gitlab.relative_url_root}/#{project.full_path}/wikis"
expect(subject.wiki_base_path).to eq(wiki_base_path) expect(subject.wiki_base_path).to eq(wiki_base_path)
end end
...@@ -77,7 +81,7 @@ describe ProjectWiki do ...@@ -77,7 +81,7 @@ describe ProjectWiki do
allow_any_instance_of(Gitlab::Shell).to receive(:add_repository) do allow_any_instance_of(Gitlab::Shell).to receive(:add_repository) do
create_temp_repo("#{Rails.root}/tmp/test-git-base-path/non-existant.wiki.git") create_temp_repo("#{Rails.root}/tmp/test-git-base-path/non-existant.wiki.git")
end end
allow(project).to receive(:path_with_namespace).and_return("non-existant") allow(project).to receive(:full_path).and_return("non-existant")
end end
describe '#empty?' do describe '#empty?' do
...@@ -269,7 +273,7 @@ describe ProjectWiki do ...@@ -269,7 +273,7 @@ describe ProjectWiki do
describe '#create_repo!' do describe '#create_repo!' do
it 'creates a repository' do it 'creates a repository' do
expect(subject).to receive(:init_repo) expect(subject).to receive(:init_repo)
.with(subject.path_with_namespace) .with(subject.full_path)
.and_return(true) .and_return(true)
expect(subject.repository).to receive(:after_create) expect(subject.repository).to receive(:after_create)
......
...@@ -123,7 +123,7 @@ describe 'Git HTTP requests' do ...@@ -123,7 +123,7 @@ describe 'Git HTTP requests' do
context "when requesting the Wiki" do context "when requesting the Wiki" do
let(:wiki) { ProjectWiki.new(project) } let(:wiki) { ProjectWiki.new(project) }
let(:path) { "/#{wiki.repository.path_with_namespace}.git" } let(:path) { "/#{wiki.repository.full_path}.git" }
context "when the project is public" do context "when the project is public" do
let(:project) { create(:project, :repository, :public, :wiki_enabled) } let(:project) { create(:project, :repository, :public, :wiki_enabled) }
...@@ -139,7 +139,7 @@ describe 'Git HTTP requests' do ...@@ -139,7 +139,7 @@ describe 'Git HTTP requests' do
download(path) do |response| download(path) do |response|
json_body = ActiveSupport::JSON.decode(response.body) json_body = ActiveSupport::JSON.decode(response.body)
expect(json_body['RepoPath']).to include(wiki.repository.path_with_namespace) expect(json_body['RepoPath']).to include(wiki.repository.full_path)
end end
end end
end end
...@@ -222,7 +222,7 @@ describe 'Git HTTP requests' do ...@@ -222,7 +222,7 @@ describe 'Git HTTP requests' do
end end
context "when the project exists" do context "when the project exists" do
let(:path) { "#{project.path_with_namespace}.git" } let(:path) { "#{project.full_path}.git" }
context "when the project is public" do context "when the project is public" do
let(:project) { create(:project, :repository, :public) } let(:project) { create(:project, :repository, :public) }
...@@ -286,7 +286,7 @@ describe 'Git HTTP requests' do ...@@ -286,7 +286,7 @@ describe 'Git HTTP requests' do
context 'when the request is not from gitlab-workhorse' do context 'when the request is not from gitlab-workhorse' do
it 'raises an exception' do it 'raises an exception' do
expect do expect do
get("/#{project.path_with_namespace}.git/info/refs?service=git-upload-pack") get("/#{project.full_path}.git/info/refs?service=git-upload-pack")
end.to raise_error(JWT::DecodeError) end.to raise_error(JWT::DecodeError)
end end
end end
...@@ -294,7 +294,7 @@ describe 'Git HTTP requests' do ...@@ -294,7 +294,7 @@ describe 'Git HTTP requests' do
context 'when the repo is public' do context 'when the repo is public' do
context 'but the repo is disabled' do context 'but the repo is disabled' do
let(:project) { create(:project, :public, :repository, :repository_disabled) } let(:project) { create(:project, :public, :repository, :repository_disabled) }
let(:path) { "#{project.path_with_namespace}.git" } let(:path) { "#{project.full_path}.git" }
let(:env) { {} } let(:env) { {} }
it_behaves_like 'pulls require Basic HTTP Authentication' it_behaves_like 'pulls require Basic HTTP Authentication'
...@@ -303,7 +303,7 @@ describe 'Git HTTP requests' do ...@@ -303,7 +303,7 @@ describe 'Git HTTP requests' do
context 'but the repo is enabled' do context 'but the repo is enabled' do
let(:project) { create(:project, :public, :repository, :repository_enabled) } let(:project) { create(:project, :public, :repository, :repository_enabled) }
let(:path) { "#{project.path_with_namespace}.git" } let(:path) { "#{project.full_path}.git" }
let(:env) { {} } let(:env) { {} }
it_behaves_like 'pulls are allowed' it_behaves_like 'pulls are allowed'
...@@ -421,7 +421,7 @@ describe 'Git HTTP requests' do ...@@ -421,7 +421,7 @@ describe 'Git HTTP requests' do
@token = Doorkeeper::AccessToken.create!(application_id: application.id, resource_owner_id: user.id, scopes: "api") @token = Doorkeeper::AccessToken.create!(application_id: application.id, resource_owner_id: user.id, scopes: "api")
end end
let(:path) { "#{project.path_with_namespace}.git" } let(:path) { "#{project.full_path}.git" }
let(:env) { { user: 'oauth2', password: @token.token } } let(:env) { { user: 'oauth2', password: @token.token } }
it_behaves_like 'pulls are allowed' it_behaves_like 'pulls are allowed'
...@@ -431,7 +431,7 @@ describe 'Git HTTP requests' do ...@@ -431,7 +431,7 @@ describe 'Git HTTP requests' do
context 'when user has 2FA enabled' do context 'when user has 2FA enabled' do
let(:user) { create(:user, :two_factor) } let(:user) { create(:user, :two_factor) }
let(:access_token) { create(:personal_access_token, user: user) } let(:access_token) { create(:personal_access_token, user: user) }
let(:path) { "#{project.path_with_namespace}.git" } let(:path) { "#{project.full_path}.git" }
before do before do
project.team << [user, :master] project.team << [user, :master]
...@@ -580,7 +580,7 @@ describe 'Git HTTP requests' do ...@@ -580,7 +580,7 @@ describe 'Git HTTP requests' do
end end
context 'when build created by system is authenticated' do context 'when build created by system is authenticated' do
let(:path) { "#{project.path_with_namespace}.git" } let(:path) { "#{project.full_path}.git" }
let(:env) { { user: 'gitlab-ci-token', password: build.token } } let(:env) { { user: 'gitlab-ci-token', password: build.token } }
it_behaves_like 'pulls are allowed' it_behaves_like 'pulls are allowed'
...@@ -602,7 +602,7 @@ describe 'Git HTTP requests' do ...@@ -602,7 +602,7 @@ describe 'Git HTTP requests' do
# We are "authenticated" as CI using a valid token here. But we are # We are "authenticated" as CI using a valid token here. But we are
# not authorized to see any other project, so return "not found". # not authorized to see any other project, so return "not found".
it "rejects pulls for other project with 404 Not Found" do it "rejects pulls for other project with 404 Not Found" do
clone_get("#{other_project.path_with_namespace}.git", env) clone_get("#{other_project.full_path}.git", env)
expect(response).to have_http_status(:not_found) expect(response).to have_http_status(:not_found)
expect(response.body).to eq(git_access_error(:project_not_found)) expect(response.body).to eq(git_access_error(:project_not_found))
...@@ -616,7 +616,7 @@ describe 'Git HTTP requests' do ...@@ -616,7 +616,7 @@ describe 'Git HTTP requests' do
end end
shared_examples 'can download code only' do shared_examples 'can download code only' do
let(:path) { "#{project.path_with_namespace}.git" } let(:path) { "#{project.full_path}.git" }
let(:env) { { user: 'gitlab-ci-token', password: build.token } } let(:env) { { user: 'gitlab-ci-token', password: build.token } }
it_behaves_like 'pulls are allowed' it_behaves_like 'pulls are allowed'
...@@ -646,7 +646,7 @@ describe 'Git HTTP requests' do ...@@ -646,7 +646,7 @@ describe 'Git HTTP requests' do
it_behaves_like 'can download code only' it_behaves_like 'can download code only'
it 'downloads from other project get status 403' do it 'downloads from other project get status 403' do
clone_get "#{other_project.path_with_namespace}.git", user: 'gitlab-ci-token', password: build.token clone_get "#{other_project.full_path}.git", user: 'gitlab-ci-token', password: build.token
expect(response).to have_http_status(:forbidden) expect(response).to have_http_status(:forbidden)
end end
...@@ -658,7 +658,7 @@ describe 'Git HTTP requests' do ...@@ -658,7 +658,7 @@ describe 'Git HTTP requests' do
it_behaves_like 'can download code only' it_behaves_like 'can download code only'
it 'downloads from other project get status 404' do it 'downloads from other project get status 404' do
clone_get "#{other_project.path_with_namespace}.git", user: 'gitlab-ci-token', password: build.token clone_get "#{other_project.full_path}.git", user: 'gitlab-ci-token', password: build.token
expect(response).to have_http_status(:not_found) expect(response).to have_http_status(:not_found)
end end
...@@ -671,7 +671,7 @@ describe 'Git HTTP requests' do ...@@ -671,7 +671,7 @@ describe 'Git HTTP requests' do
let(:project) { create(:project, :repository, :public, path: 'project.git-project') } let(:project) { create(:project, :repository, :public, path: 'project.git-project') }
context "GET info/refs" do context "GET info/refs" do
let(:path) { "/#{project.path_with_namespace}/info/refs" } let(:path) { "/#{project.full_path}/info/refs" }
context "when no params are added" do context "when no params are added" do
before do before do
...@@ -679,7 +679,7 @@ describe 'Git HTTP requests' do ...@@ -679,7 +679,7 @@ describe 'Git HTTP requests' do
end end
it "redirects to the .git suffix version" do it "redirects to the .git suffix version" do
expect(response).to redirect_to("/#{project.path_with_namespace}.git/info/refs") expect(response).to redirect_to("/#{project.full_path}.git/info/refs")
end end
end end
...@@ -691,7 +691,7 @@ describe 'Git HTTP requests' do ...@@ -691,7 +691,7 @@ describe 'Git HTTP requests' do
end end
it "redirects to the .git suffix version" do it "redirects to the .git suffix version" do
expect(response).to redirect_to("/#{project.path_with_namespace}.git/info/refs?service=#{params[:service]}") expect(response).to redirect_to("/#{project.full_path}.git/info/refs?service=#{params[:service]}")
end end
end end
...@@ -703,7 +703,7 @@ describe 'Git HTTP requests' do ...@@ -703,7 +703,7 @@ describe 'Git HTTP requests' do
end end
it "redirects to the .git suffix version" do it "redirects to the .git suffix version" do
expect(response).to redirect_to("/#{project.path_with_namespace}.git/info/refs?service=#{params[:service]}") expect(response).to redirect_to("/#{project.full_path}.git/info/refs?service=#{params[:service]}")
end end
end end
...@@ -722,13 +722,13 @@ describe 'Git HTTP requests' do ...@@ -722,13 +722,13 @@ describe 'Git HTTP requests' do
context "POST git-upload-pack" do context "POST git-upload-pack" do
it "fails to find a route" do it "fails to find a route" do
expect { clone_post(project.path_with_namespace) }.to raise_error(ActionController::RoutingError) expect { clone_post(project.full_path) }.to raise_error(ActionController::RoutingError)
end end
end end
context "POST git-receive-pack" do context "POST git-receive-pack" do
it "fails to find a route" do it "fails to find a route" do
expect { push_post(project.path_with_namespace) }.to raise_error(ActionController::RoutingError) expect { push_post(project.full_path) }.to raise_error(ActionController::RoutingError)
end end
end end
end end
...@@ -744,7 +744,7 @@ describe 'Git HTTP requests' do ...@@ -744,7 +744,7 @@ describe 'Git HTTP requests' do
Blob.decorate(Gitlab::Git::Blob.find(project.repository, 'master', 'bar/branch-test.txt'), project) Blob.decorate(Gitlab::Git::Blob.find(project.repository, 'master', 'bar/branch-test.txt'), project)
end end
get "/#{project.path_with_namespace}/blob/master/info/refs" get "/#{project.full_path}/blob/master/info/refs"
end end
it "returns the file" do it "returns the file" do
...@@ -754,7 +754,7 @@ describe 'Git HTTP requests' do ...@@ -754,7 +754,7 @@ describe 'Git HTTP requests' do
context "when the file does not exist" do context "when the file does not exist" do
before do before do
get "/#{project.path_with_namespace}/blob/master/info/refs" get "/#{project.full_path}/blob/master/info/refs"
end end
it "returns not found" do it "returns not found" do
......
...@@ -701,7 +701,7 @@ describe 'Git LFS API and storage' do ...@@ -701,7 +701,7 @@ describe 'Git LFS API and storage' do
expect(json_response['objects']).to be_kind_of(Array) expect(json_response['objects']).to be_kind_of(Array)
expect(json_response['objects'].first['oid']).to eq("91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897") expect(json_response['objects'].first['oid']).to eq("91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897")
expect(json_response['objects'].first['size']).to eq(1575078) expect(json_response['objects'].first['size']).to eq(1575078)
expect(json_response['objects'].first['actions']['upload']['href']).to eq("#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}.git/gitlab-lfs/objects/91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897/1575078") expect(json_response['objects'].first['actions']['upload']['href']).to eq("#{Gitlab.config.gitlab.url}/#{project.full_path}.git/gitlab-lfs/objects/91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897/1575078")
expect(json_response['objects'].first['actions']['upload']['header']).to eq('Authorization' => authorization) expect(json_response['objects'].first['actions']['upload']['header']).to eq('Authorization' => authorization)
end end
end end
......
...@@ -15,7 +15,7 @@ describe 'Request Profiler' do ...@@ -15,7 +15,7 @@ describe 'Request Profiler' do
it 'creates a profile of the request' do it 'creates a profile of the request' do
project = create(:project, namespace: user.namespace) project = create(:project, namespace: user.namespace)
time = Time.now time = Time.now
path = "/#{project.path_with_namespace}" path = "/#{project.full_path}"
Timecop.freeze(time) do Timecop.freeze(time) do
get path, nil, 'X-Profile-Token' => Gitlab::RequestProfiler.profile_token get path, nil, 'X-Profile-Token' => Gitlab::RequestProfiler.profile_token
......
...@@ -46,7 +46,7 @@ describe Auth::ContainerRegistryAuthenticationService do ...@@ -46,7 +46,7 @@ describe Auth::ContainerRegistryAuthenticationService do
shared_examples 'an accessible' do shared_examples 'an accessible' do
let(:access) do let(:access) do
[{ 'type' => 'repository', [{ 'type' => 'repository',
'name' => project.path_with_namespace, 'name' => project.full_path,
'actions' => actions }] 'actions' => actions }]
end end
...@@ -97,7 +97,7 @@ describe Auth::ContainerRegistryAuthenticationService do ...@@ -97,7 +97,7 @@ describe Auth::ContainerRegistryAuthenticationService do
describe '#full_access_token' do describe '#full_access_token' do
let(:project) { create(:empty_project) } let(:project) { create(:empty_project) }
let(:token) { described_class.full_access_token(project.path_with_namespace) } let(:token) { described_class.full_access_token(project.full_path) }
subject { { token: token } } subject { { token: token } }
...@@ -124,7 +124,7 @@ describe Auth::ContainerRegistryAuthenticationService do ...@@ -124,7 +124,7 @@ describe Auth::ContainerRegistryAuthenticationService do
end end
let(:current_params) do let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:push" } { scope: "repository:#{project.full_path}:push" }
end end
it_behaves_like 'a pushable' it_behaves_like 'a pushable'
...@@ -138,7 +138,7 @@ describe Auth::ContainerRegistryAuthenticationService do ...@@ -138,7 +138,7 @@ describe Auth::ContainerRegistryAuthenticationService do
context 'when pulling from root level repository' do context 'when pulling from root level repository' do
let(:current_params) do let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:pull" } { scope: "repository:#{project.full_path}:pull" }
end end
it_behaves_like 'a pullable' it_behaves_like 'a pullable'
...@@ -152,7 +152,7 @@ describe Auth::ContainerRegistryAuthenticationService do ...@@ -152,7 +152,7 @@ describe Auth::ContainerRegistryAuthenticationService do
end end
let(:current_params) do let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:push,pull" } { scope: "repository:#{project.full_path}:push,pull" }
end end
it_behaves_like 'a pullable' it_behaves_like 'a pullable'
...@@ -165,7 +165,7 @@ describe Auth::ContainerRegistryAuthenticationService do ...@@ -165,7 +165,7 @@ describe Auth::ContainerRegistryAuthenticationService do
end end
let(:current_params) do let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:pull,push" } { scope: "repository:#{project.full_path}:pull,push" }
end end
it_behaves_like 'an inaccessible' it_behaves_like 'an inaccessible'
...@@ -178,7 +178,7 @@ describe Auth::ContainerRegistryAuthenticationService do ...@@ -178,7 +178,7 @@ describe Auth::ContainerRegistryAuthenticationService do
context 'allow anyone to pull images' do context 'allow anyone to pull images' do
let(:current_params) do let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:pull" } { scope: "repository:#{project.full_path}:pull" }
end end
it_behaves_like 'a pullable' it_behaves_like 'a pullable'
...@@ -187,7 +187,7 @@ describe Auth::ContainerRegistryAuthenticationService do ...@@ -187,7 +187,7 @@ describe Auth::ContainerRegistryAuthenticationService do
context 'disallow anyone to push images' do context 'disallow anyone to push images' do
let(:current_params) do let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:push" } { scope: "repository:#{project.full_path}:push" }
end end
it_behaves_like 'an inaccessible' it_behaves_like 'an inaccessible'
...@@ -210,7 +210,7 @@ describe Auth::ContainerRegistryAuthenticationService do ...@@ -210,7 +210,7 @@ describe Auth::ContainerRegistryAuthenticationService do
context 'for internal user' do context 'for internal user' do
context 'allow anyone to pull images' do context 'allow anyone to pull images' do
let(:current_params) do let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:pull" } { scope: "repository:#{project.full_path}:pull" }
end end
it_behaves_like 'a pullable' it_behaves_like 'a pullable'
...@@ -219,7 +219,7 @@ describe Auth::ContainerRegistryAuthenticationService do ...@@ -219,7 +219,7 @@ describe Auth::ContainerRegistryAuthenticationService do
context 'disallow anyone to push images' do context 'disallow anyone to push images' do
let(:current_params) do let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:push" } { scope: "repository:#{project.full_path}:push" }
end end
it_behaves_like 'an inaccessible' it_behaves_like 'an inaccessible'
...@@ -230,7 +230,7 @@ describe Auth::ContainerRegistryAuthenticationService do ...@@ -230,7 +230,7 @@ describe Auth::ContainerRegistryAuthenticationService do
context 'for external user' do context 'for external user' do
let(:current_user) { create(:user, external: true) } let(:current_user) { create(:user, external: true) }
let(:current_params) do let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:pull,push" } { scope: "repository:#{project.full_path}:pull,push" }
end end
it_behaves_like 'an inaccessible' it_behaves_like 'an inaccessible'
...@@ -255,7 +255,7 @@ describe Auth::ContainerRegistryAuthenticationService do ...@@ -255,7 +255,7 @@ describe Auth::ContainerRegistryAuthenticationService do
context 'allow to pull and push images' do context 'allow to pull and push images' do
let(:current_params) do let(:current_params) do
{ scope: "repository:#{current_project.path_with_namespace}:pull,push" } { scope: "repository:#{current_project.full_path}:pull,push" }
end end
it_behaves_like 'a pullable and pushable' do it_behaves_like 'a pullable and pushable' do
...@@ -270,7 +270,7 @@ describe Auth::ContainerRegistryAuthenticationService do ...@@ -270,7 +270,7 @@ describe Auth::ContainerRegistryAuthenticationService do
context 'for other projects' do context 'for other projects' do
context 'when pulling' do context 'when pulling' do
let(:current_params) do let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:pull" } { scope: "repository:#{project.full_path}:pull" }
end end
context 'allow for public' do context 'allow for public' do
...@@ -337,7 +337,7 @@ describe Auth::ContainerRegistryAuthenticationService do ...@@ -337,7 +337,7 @@ describe Auth::ContainerRegistryAuthenticationService do
context 'when pushing' do context 'when pushing' do
let(:current_params) do let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:push" } { scope: "repository:#{project.full_path}:push" }
end end
context 'disallow for all' do context 'disallow for all' do
...@@ -371,7 +371,7 @@ describe Auth::ContainerRegistryAuthenticationService do ...@@ -371,7 +371,7 @@ describe Auth::ContainerRegistryAuthenticationService do
context 'disallow when pulling' do context 'disallow when pulling' do
let(:current_params) do let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:pull" } { scope: "repository:#{project.full_path}:pull" }
end end
it_behaves_like 'an inaccessible' it_behaves_like 'an inaccessible'
...@@ -399,7 +399,7 @@ describe Auth::ContainerRegistryAuthenticationService do ...@@ -399,7 +399,7 @@ describe Auth::ContainerRegistryAuthenticationService do
let(:project) { create(:empty_project, :private) } let(:project) { create(:empty_project, :private) }
let(:current_params) do let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:pull" } { scope: "repository:#{project.full_path}:pull" }
end end
it_behaves_like 'a forbidden' it_behaves_like 'a forbidden'
...@@ -410,7 +410,7 @@ describe Auth::ContainerRegistryAuthenticationService do ...@@ -410,7 +410,7 @@ describe Auth::ContainerRegistryAuthenticationService do
context 'when pulling and pushing' do context 'when pulling and pushing' do
let(:current_params) do let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:pull,push" } { scope: "repository:#{project.full_path}:pull,push" }
end end
it_behaves_like 'a pullable' it_behaves_like 'a pullable'
...@@ -419,7 +419,7 @@ describe Auth::ContainerRegistryAuthenticationService do ...@@ -419,7 +419,7 @@ describe Auth::ContainerRegistryAuthenticationService do
context 'when pushing' do context 'when pushing' do
let(:current_params) do let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:push" } { scope: "repository:#{project.full_path}:push" }
end end
it_behaves_like 'a forbidden' it_behaves_like 'a forbidden'
......
...@@ -873,7 +873,7 @@ describe SystemNoteService do ...@@ -873,7 +873,7 @@ describe SystemNoteService do
describe "existing reference" do describe "existing reference" do
before do before do
allow(JIRA::Resource::Remotelink).to receive(:all).and_return([]) allow(JIRA::Resource::Remotelink).to receive(:all).and_return([])
message = "[#{author.name}|http://localhost/#{author.username}] mentioned this issue in [a commit of #{project.full_path}|http://localhost/#{project.path_with_namespace}/commit/#{commit.id}]:\n'#{commit.title.chomp}'" message = "[#{author.name}|http://localhost/#{author.username}] mentioned this issue in [a commit of #{project.full_path}|http://localhost/#{project.full_path}/commit/#{commit.id}]:\n'#{commit.title.chomp}'"
allow_any_instance_of(JIRA::Resource::Issue).to receive(:comments).and_return([OpenStruct.new(body: message)]) allow_any_instance_of(JIRA::Resource::Issue).to receive(:comments).and_return([OpenStruct.new(body: message)])
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment