Commit a9e41961 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'more-legacy' into 'master'

Remove some easy cases of 'path_to_repo' use

See merge request gitlab-org/gitlab-ce!17997
parents 066d2e0a c43e18fc
...@@ -36,7 +36,7 @@ class GemnasiumService < Service ...@@ -36,7 +36,7 @@ class GemnasiumService < Service
after: data[:after], after: data[:after],
token: token, token: token,
api_key: api_key, api_key: api_key,
repo: project.repository.path_to_repo repo: project.repository.path_to_repo # Gitaly: fixed by https://gitlab.com/gitlab-org/security-products/gemnasium-migration/issues/9
) )
end end
end end
...@@ -93,10 +93,6 @@ class Repository ...@@ -93,10 +93,6 @@ class Repository
"#<#{self.class.name}:#{@disk_path}>" "#<#{self.class.name}:#{@disk_path}>"
end end
def create_hooks
Gitlab::Git::Repository.create_hooks(path_to_repo, Gitlab.config.gitlab_shell.hooks_path)
end
def commit(ref = 'HEAD') def commit(ref = 'HEAD')
return nil unless exists? return nil unless exists?
return ref if ref.is_a?(::Commit) return ref if ref.is_a?(::Commit)
......
...@@ -62,12 +62,16 @@ ...@@ -62,12 +62,16 @@
= link_to @project.ssh_url_to_repo, project_path(@project) = link_to @project.ssh_url_to_repo, project_path(@project)
- if @project.repository.exists? - if @project.repository.exists?
%li %li
%span.light fs: %span.light Gitaly storage name:
%strong %strong
= @project.repository.path_to_repo = @project.repository.storage
%li
%span.light Gitaly relative path:
%strong
= @project.repository.relative_path
%li %li
%span.light Storage: %span.light Storage used:
%strong= storage_counter(@project.statistics.storage_size) %strong= storage_counter(@project.statistics.storage_size)
( (
= storage_counter(@project.statistics.repository_size) = storage_counter(@project.statistics.repository_size)
......
...@@ -28,16 +28,17 @@ class GitGarbageCollectWorker ...@@ -28,16 +28,17 @@ class GitGarbageCollectWorker
task = task.to_sym task = task.to_sym
cmd = command(task) cmd = command(task)
repo_path = project.repository.path_to_repo
description = "'#{cmd.join(' ')}' in #{repo_path}"
Gitlab::GitLogger.info(description)
gitaly_migrate(GITALY_MIGRATED_TASKS[task]) do |is_enabled| gitaly_migrate(GITALY_MIGRATED_TASKS[task]) do |is_enabled|
if is_enabled if is_enabled
gitaly_call(task, project.repository.raw_repository) gitaly_call(task, project.repository.raw_repository)
else else
repo_path = project.repository.path_to_repo
description = "'#{cmd.join(' ')}' in #{repo_path}"
Gitlab::GitLogger.info(description)
output, status = Gitlab::Popen.popen(cmd, repo_path) output, status = Gitlab::Popen.popen(cmd, repo_path)
Gitlab::GitLogger.error("#{description} failed:\n#{output}") unless status.zero? Gitlab::GitLogger.error("#{description} failed:\n#{output}") unless status.zero?
end end
end end
......
# Gitaly issue: https://gitlab.com/gitlab-org/gitaly/issues/1110
class RepositoryForkWorker class RepositoryForkWorker
include ApplicationWorker include ApplicationWorker
include Gitlab::ShellAdapter include Gitlab::ShellAdapter
......
...@@ -63,7 +63,7 @@ module Gitlab ...@@ -63,7 +63,7 @@ module Gitlab
log " * Created #{project.name} (#{project_full_path})".color(:green) log " * Created #{project.name} (#{project_full_path})".color(:green)
project.write_repository_config project.write_repository_config
project.repository.create_hooks Gitlab::Git::Repository.create_hooks(project.repository.path_to_repo, Gitlab.config.gitlab_shell.hooks_path)
ProjectCacheWorker.perform_async(project.id) ProjectCacheWorker.perform_async(project.id)
else else
......
...@@ -21,12 +21,10 @@ module Gitlab ...@@ -21,12 +21,10 @@ module Gitlab
raise "Unsupported action: #{action}" unless ALLOWED_GIT_HTTP_ACTIONS.include?(action.to_s) raise "Unsupported action: #{action}" unless ALLOWED_GIT_HTTP_ACTIONS.include?(action.to_s)
project = repository.project project = repository.project
repo_path = repository.path_to_repo
params = { params = {
GL_ID: Gitlab::GlId.gl_id(user), GL_ID: Gitlab::GlId.gl_id(user),
GL_REPOSITORY: Gitlab::GlRepository.gl_repository(project, is_wiki), GL_REPOSITORY: Gitlab::GlRepository.gl_repository(project, is_wiki),
GL_USERNAME: user&.username, GL_USERNAME: user&.username,
RepoPath: repo_path,
ShowAllRefs: show_all_refs ShowAllRefs: show_all_refs
} }
server = { server = {
......
...@@ -275,14 +275,12 @@ describe Gitlab::Workhorse do ...@@ -275,14 +275,12 @@ describe Gitlab::Workhorse do
describe '.git_http_ok' do describe '.git_http_ok' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:repo_path) { repository.path_to_repo }
let(:action) { 'info_refs' } let(:action) { 'info_refs' }
let(:params) do let(:params) do
{ {
GL_ID: "user-#{user.id}", GL_ID: "user-#{user.id}",
GL_USERNAME: user.username, GL_USERNAME: user.username,
GL_REPOSITORY: "project-#{project.id}", GL_REPOSITORY: "project-#{project.id}",
RepoPath: repo_path,
ShowAllRefs: false ShowAllRefs: false
} }
end end
...@@ -297,7 +295,6 @@ describe Gitlab::Workhorse do ...@@ -297,7 +295,6 @@ describe Gitlab::Workhorse do
GL_ID: "user-#{user.id}", GL_ID: "user-#{user.id}",
GL_USERNAME: user.username, GL_USERNAME: user.username,
GL_REPOSITORY: "wiki-#{project.id}", GL_REPOSITORY: "wiki-#{project.id}",
RepoPath: repo_path,
ShowAllRefs: false ShowAllRefs: false
} }
end end
......
...@@ -501,28 +501,6 @@ describe Repository do ...@@ -501,28 +501,6 @@ describe Repository do
end end
end end
describe '#create_hooks' do
let(:hook_path) { File.join(repository.path_to_repo, 'hooks') }
it 'symlinks the global hooks directory' do
repository.create_hooks
expect(File.symlink?(hook_path)).to be true
expect(File.readlink(hook_path)).to eq(Gitlab.config.gitlab_shell.hooks_path)
end
it 'replaces existing symlink with the right directory' do
FileUtils.mkdir_p(hook_path)
expect(File.symlink?(hook_path)).to be false
repository.create_hooks
expect(File.symlink?(hook_path)).to be true
expect(File.readlink(hook_path)).to eq(Gitlab.config.gitlab_shell.hooks_path)
end
end
describe "#create_dir" do describe "#create_dir" do
it "commits a change that creates a new directory" do it "commits a change that creates a new directory" do
expect do expect do
......
...@@ -163,7 +163,7 @@ describe 'Git HTTP requests' do ...@@ -163,7 +163,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.disk_path) expect(json_body['Repository']['relative_path']).to eq(wiki.repository.relative_path)
end end
end end
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