diff options
-rw-r--r-- | config/gitlab.yml.example | 1 | ||||
-rw-r--r-- | config/initializers/1_settings.rb | 4 | ||||
-rw-r--r-- | lib/tasks/gitlab/backup.rake | 2 | ||||
-rw-r--r-- | lib/tasks/gitlab/status.rake | 2 | ||||
-rw-r--r-- | lib/tasks/gitlab/write_hook.rake | 2 |
5 files changed, 8 insertions, 3 deletions
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index be36ee6da0d..d05cc1bead6 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -33,6 +33,7 @@ app: git_host: admin_uri: git@localhost:gitolite-admin base_path: /home/git/repositories/ + # hooks_path: /var/lib/gitolite/.gitolite/hooks/ # only needed when gitolite is not installed according the manual # host: localhost git_user: git upload_pack: true diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 8165d6c2eea..27c5bc2270c 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -66,6 +66,10 @@ class Settings < Settingslogic git_host['base_path'] || '/home/git/repositories/' end + def git_hooks_path + git_host['hooks_path'] || '/home/git/share/gitolite/hooks/' + end + def git_upload_pack if git_host['upload_pack'] != false true diff --git a/lib/tasks/gitlab/backup.rake b/lib/tasks/gitlab/backup.rake index 8e2fa2c0133..04d240f6b12 100644 --- a/lib/tasks/gitlab/backup.rake +++ b/lib/tasks/gitlab/backup.rake @@ -144,7 +144,7 @@ namespace :gitlab do if Kernel.system("cd #{File.dirname(project.second)} > /dev/null 2>&1 && git clone --bare #{backup_path_repo}/#{project.first}.bundle #{project.first}.git > /dev/null 2>&1") permission_commands = [ "sudo chmod -R g+rwX #{Gitlab.config.git_base_path}", - "sudo chown -R #{Gitlab.config.ssh_user}:#{Gitlab.config.ssh_user} #{Gitlab.config.git_base_path}", + "sudo chown -R #{Gitlab.config.ssh_user}:#{Gitlab.config.ssh_user} #{Gitlab.config.git_base_path}" ] permission_commands.each { |command| Kernel.system(command) } puts "[DONE]".green diff --git a/lib/tasks/gitlab/status.rake b/lib/tasks/gitlab/status.rake index 9483a95cccc..e5b5e122a18 100644 --- a/lib/tasks/gitlab/status.rake +++ b/lib/tasks/gitlab/status.rake @@ -56,7 +56,7 @@ namespace :gitlab do return end - gitolite_hooks_path = File.join("/home", Gitlab.config.ssh_user, "share", "gitolite", "hooks", "common") + gitolite_hooks_path = File.join(Gitlab.config.git_hooks_path, "common") gitlab_hook_files = ['post-receive'] gitlab_hook_files.each do |file_name| dest = File.join(gitolite_hooks_path, file_name) diff --git a/lib/tasks/gitlab/write_hook.rake b/lib/tasks/gitlab/write_hook.rake index 098331b8cd7..9ec9c8383e2 100644 --- a/lib/tasks/gitlab/write_hook.rake +++ b/lib/tasks/gitlab/write_hook.rake @@ -2,7 +2,7 @@ namespace :gitlab do namespace :gitolite do desc "GITLAB | Write GITLAB hook for gitolite" task :write_hooks => :environment do - gitolite_hooks_path = File.join("/home", Gitlab.config.ssh_user, "share", "gitolite", "hooks", "common") + gitolite_hooks_path = File.join(Gitlab.config.git_hooks_path, "common") gitlab_hooks_path = Rails.root.join("lib", "hooks") gitlab_hook_files = ['post-receive'] |