diff options
author | Nick Thomas <nick@gitlab.com> | 2017-08-14 14:29:47 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2017-08-15 20:33:07 +0300 |
commit | 5fc871381ad0768bb38879ab1621e538ca3008d0 (patch) | |
tree | 2beb6d17e4064400a633b4c871a6453089055efe /lib/gitlab/shell.rb | |
parent | 4a2a6d521a260981482ee8e4931ebf06cb4f5b6a (diff) |
Speed up project creation by inlining repository creation
Diffstat (limited to 'lib/gitlab/shell.rb')
-rw-r--r-- | lib/gitlab/shell.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/gitlab/shell.rb b/lib/gitlab/shell.rb index 0cb28732402..280a9abf03e 100644 --- a/lib/gitlab/shell.rb +++ b/lib/gitlab/shell.rb @@ -73,8 +73,10 @@ module Gitlab # # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/387 def add_repository(storage, name) - gitlab_shell_fast_execute([gitlab_shell_projects_path, - 'add-project', storage, "#{name}.git"]) + Gitlab::Git::Repository.create(storage, name, bare: true, symlink_hooks_to: gitlab_shell_hooks_path) + rescue => err + Rails.logger.error("Failed to add repository #{storage}/#{name}: #{err}") + false end # Import repository @@ -273,7 +275,11 @@ module Gitlab protected def gitlab_shell_path - Gitlab.config.gitlab_shell.path + File.expand_path(Gitlab.config.gitlab_shell.path) + end + + def gitlab_shell_hooks_path + File.expand_path(Gitlab.config.gitlab_shell.hooks_path) end def gitlab_shell_user_home |