Commit b103f614 authored by Stan Hu's avatar Stan Hu

Add convenience methods for creating project and Wiki repositories

This makes it easier to access other project arguments in the future.
parent 1af22dbe
......@@ -1288,7 +1288,7 @@ class Project < ActiveRecord::Base
# Forked import is handled asynchronously
return if forked? && !force
if gitlab_shell.create_repository(repository_storage, disk_path, full_path)
if gitlab_shell.create_project_repository(self)
repository.after_create
true
else
......
......@@ -175,7 +175,7 @@ class ProjectWiki
private
def create_repo!(raw_repository)
gitlab_shell.create_repository(project.repository_storage, disk_path, project.full_path)
gitlab_shell.create_wiki_repository(project)
raise CouldNotCreateWikiError unless raw_repository.exists?
......
......@@ -93,7 +93,7 @@ module Backup
progress.puts "Error: #{e}".color(:red)
end
else
restore_repo_success = gitlab_shell.create_repository(project.repository_storage, project.disk_path, project.full_path)
restore_repo_success = gitlab_shell.create_project_repository(project)
end
if restore_repo_success
......
......@@ -64,6 +64,14 @@ module Gitlab
end
end
def create_project_repository(project)
create_repository(project.repository_storage, project.disk_path, project.full_path)
end
def create_wiki_repository(project)
create_repository(project.repository_storage, project.wiki.disk_path, project.wiki.full_path)
end
# Init new repository
#
# storage - the shard key
......
......@@ -75,7 +75,7 @@ describe ProjectWiki do
# Create a fresh project which will not have a wiki
project_wiki = described_class.new(create(:project), user)
gitlab_shell = double(:gitlab_shell)
allow(gitlab_shell).to receive(:create_repository)
allow(gitlab_shell).to receive(:create_wiki_repository)
allow(project_wiki).to receive(:gitlab_shell).and_return(gitlab_shell)
expect { project_wiki.send(:wiki) }.to raise_exception(ProjectWiki::CouldNotCreateWikiError)
......
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