Merge pull request #8258 from cirosantilli/factor-repo-path

Factor using Repository#path_to_repo
This commit is contained in:
Dmitriy Zaporozhets 2014-11-06 10:57:05 +02:00
commit 0ce1826b44
5 changed files with 5 additions and 8 deletions

View file

@ -37,13 +37,12 @@ class FlowdockService < Service
end
def execute(push_data)
repo_path = File.join(Gitlab.config.gitlab_shell.repos_path, "#{project.path_with_namespace}.git")
Flowdock::Git.post(
push_data[:ref],
push_data[:before],
push_data[:after],
token: token,
repo: repo_path,
repo: project.repository.path_to_repo,
repo_url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}",
commit_url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/commit/%s",
diff_url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/compare/%s...%s",

View file

@ -38,14 +38,13 @@ class GemnasiumService < Service
end
def execute(push_data)
repo_path = File.join(Gitlab.config.gitlab_shell.repos_path, "#{project.path_with_namespace}.git")
Gemnasium::GitlabService.execute(
ref: push_data[:ref],
before: push_data[:before],
after: push_data[:after],
token: token,
api_key: api_key,
repo: repo_path
repo: project.repository.path_to_repo
)
end
end

View file

@ -91,7 +91,7 @@ module Backup
protected
def path_to_repo(project)
File.join(repos_path, project.path_with_namespace + '.git')
project.repository.path_to_repo
end
def path_to_bundle(project)

View file

@ -76,7 +76,7 @@ namespace :gitlab do
desc "GITLAB | Build missing projects"
task build_missing_projects: :environment do
Project.find_each(batch_size: 1000) do |project|
path_to_repo = File.join(Gitlab.config.gitlab_shell.repos_path, "#{project.path_with_namespace}.git")
path_to_repo = project.repository.path_to_repo
if File.exists?(path_to_repo)
print '-'
else

View file

@ -37,8 +37,7 @@ describe API::API, api: true do
context 'annotated tag' do
it 'should create a new annotated tag' do
# Identity must be set in .gitconfig to create annotated tag.
repo_path = File.join(Gitlab.config.gitlab_shell.repos_path,
project.path_with_namespace + '.git')
repo_path = project.repository.path_to_repo
system(*%W(git --git-dir=#{repo_path} config user.name #{user.name}))
system(*%W(git --git-dir=#{repo_path} config user.email #{user.email}))