summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG3
-rw-r--r--app/controllers/admin/projects_controller.rb2
-rw-r--r--app/controllers/errors_controller.rb3
-rw-r--r--app/controllers/projects_controller.rb2
-rw-r--r--app/models/namespace.rb11
-rw-r--r--app/models/project.rb8
-rw-r--r--app/models/repository.rb2
-rw-r--r--app/views/admin/groups/show.html.haml2
-rw-r--r--app/views/errors/gitolite.html.haml25
-rw-r--r--app/workers/gitlab_shell_worker.rb (renamed from app/workers/gitolite_worker.rb)4
-rw-r--r--app/workers/post_receive.rb9
-rw-r--r--config/gitlab.yml.example22
-rw-r--r--config/initializers/1_settings.rb46
-rw-r--r--config/routes.rb6
-rw-r--r--features/support/env.rb6
-rw-r--r--lib/gitlab/backend/shell.rb2
-rw-r--r--lib/gitlab/project_mover.rb4
-rw-r--r--lib/gitolited.rb4
-rw-r--r--lib/tasks/gitlab/backup.rake2
-rw-r--r--lib/tasks/gitlab/check.rake74
-rw-r--r--lib/tasks/gitlab/cleanup.rake11
-rw-r--r--lib/tasks/gitlab/enable_namespaces.rake7
-rw-r--r--lib/tasks/gitlab/import.rake3
-rw-r--r--lib/tasks/gitlab/info.rake12
-rw-r--r--lib/tasks/gitlab/shell.rake2
-rw-r--r--lib/tasks/sidekiq.rake2
-rw-r--r--spec/spec_helper.rb2
27 files changed, 117 insertions, 159 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 65344736e9c..a692bbfa8f2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,7 +1,8 @@
v 5.0.0
- - replaced gitolite with gitlab-shell
+ - Replaced gitolite with gitlab-shell
v 4.2.0
+ - Teams
- User show page. Via /u/username
- Show help contents on pages for better navigation
diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb
index 711817395f1..8ae0bba9a2d 100644
--- a/app/controllers/admin/projects_controller.rb
+++ b/app/controllers/admin/projects_controller.rb
@@ -41,9 +41,7 @@ class Admin::ProjectsController < Admin::ApplicationController
end
def destroy
- # Delete team first in order to prevent multiple gitolite calls
@project.team.truncate
-
@project.destroy
redirect_to admin_projects_path, notice: 'Project was successfully deleted.'
diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb
index e998d72365c..a0c8a000fc7 100644
--- a/app/controllers/errors_controller.rb
+++ b/app/controllers/errors_controller.rb
@@ -1,5 +1,2 @@
class ErrorsController < ApplicationController
- def githost
- render "errors/gitolite"
- end
end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 7978ea6222c..5da3fbf591c 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -93,9 +93,7 @@ class ProjectsController < ProjectResourceController
def destroy
return access_denied! unless can?(current_user, :remove_project, project)
- # Delete team first in order to prevent multiple gitolite calls
project.team.truncate
-
project.destroy
respond_to do |format|
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index f17d8f65183..547d383d911 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -31,8 +31,6 @@ class Namespace < ActiveRecord::Base
scope :root, where('type IS NULL')
- attr_accessor :require_update_gitolite
-
def self.search query
where("name LIKE :query OR path LIKE :query", query: "%#{query}%")
end
@@ -60,13 +58,13 @@ class Namespace < ActiveRecord::Base
end
def namespace_full_path
- @namespace_full_path ||= File.join(Gitlab.config.gitolite.repos_path, path)
+ @namespace_full_path ||= File.join(Gitlab.config.gitlab_shell.repos_path, path)
end
def move_dir
if path_changed?
- old_path = File.join(Gitlab.config.gitolite.repos_path, path_was)
- new_path = File.join(Gitlab.config.gitolite.repos_path, path)
+ old_path = File.join(Gitlab.config.gitlab_shell.repos_path, path_was)
+ new_path = File.join(Gitlab.config.gitlab_shell.repos_path, path)
if File.exists?(new_path)
raise "Already exists"
end
@@ -81,7 +79,6 @@ class Namespace < ActiveRecord::Base
FileUtils.mv( old_path, new_path )
send_update_instructions
- @require_update_gitolite = true
rescue Exception => e
raise "Namespace move error #{old_path} #{new_path}"
end
@@ -89,7 +86,7 @@ class Namespace < ActiveRecord::Base
end
def rm_dir
- dir_path = File.join(Gitlab.config.gitolite.repos_path, path)
+ dir_path = File.join(Gitlab.config.gitlab_shell.repos_path, path)
FileUtils.rm_r( dir_path, force: true )
end
diff --git a/app/models/project.rb b/app/models/project.rb
index e6be2d2ce84..fee45f57735 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -140,10 +140,6 @@ class Project < ActiveRecord::Base
nil
end
- def git_error?
- error_code == :gitolite
- end
-
def saved?
id && valid?
end
@@ -157,7 +153,7 @@ class Project < ActiveRecord::Base
end
def repo_name
- denied_paths = %w(gitolite-admin admin dashboard groups help profile projects search)
+ denied_paths = %w(admin dashboard groups help profile projects search)
if denied_paths.include?(path)
errors.add(:path, "like #{path} is not allowed")
@@ -450,7 +446,7 @@ class Project < ActiveRecord::Base
end
def url_to_repo
- gitolite.url_to_repo(path_with_namespace)
+ gitlab_shell.url_to_repo(path_with_namespace)
end
def namespace_dir
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 6d490980764..37431fe3b0e 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -25,7 +25,7 @@ class Repository
end
def path_to_repo
- @path_to_repo ||= File.join(Gitlab.config.gitolite.repos_path, "#{path_with_namespace}.git")
+ @path_to_repo ||= File.join(Gitlab.config.gitlab_shell.repos_path, "#{path_with_namespace}.git")
end
def repo
diff --git a/app/views/admin/groups/show.html.haml b/app/views/admin/groups/show.html.haml
index 6ae8a75d696..90f8fc0f814 100644
--- a/app/views/admin/groups/show.html.haml
+++ b/app/views/admin/groups/show.html.haml
@@ -22,7 +22,7 @@
%b
Path:
%td
- %span.monospace= File.join(Gitlab.config.gitolite.repos_path, @group.path)
+ %span.monospace= File.join(Gitlab.config.gitlab_shell.repos_path, @group.path)
%tr
%td
%b
diff --git a/app/views/errors/gitolite.html.haml b/app/views/errors/gitolite.html.haml
deleted file mode 100644
index 33ea8c1a8b7..00000000000
--- a/app/views/errors/gitolite.html.haml
+++ /dev/null
@@ -1,25 +0,0 @@
-%h1.http_status_code 500
-%h3.page_title GitLab was unable to access your Gitolite system.
-%hr
-
-.git_error_tips
- %h4 Tips for Administrator:
- %ol
- %li
- %p
- Check git logs in admin area
- %li
- %p
- Check config/gitlab.yml for correct settings.
- %li
- %p
- Diagnostic tool:
- %pre
- bundle exec rake gitlab:check RAILS_ENV=production
- %li
- %p
- Permissions:
- %pre
- = preserve do
- sudo chown -R git:git #{Gitlab.config.gitolite.repos_path}
- sudo chmod -R ug+rwXs #{Gitlab.config.gitolite.repos_path}
diff --git a/app/workers/gitolite_worker.rb b/app/workers/gitlab_shell_worker.rb
index bff7a8c6a6f..0b8a5497111 100644
--- a/app/workers/gitolite_worker.rb
+++ b/app/workers/gitlab_shell_worker.rb
@@ -2,9 +2,9 @@ class GitoliteWorker
include Sidekiq::Worker
include Gitolited
- sidekiq_options queue: :gitolite
+ sidekiq_options queue: :gitlab_shell
def perform(action, *arg)
- gitolite.send(action, *arg)
+ gitlab_shell.send(action, *arg)
end
end
diff --git a/app/workers/post_receive.rb b/app/workers/post_receive.rb
index 6e2d0e7aba2..e3f62d736ef 100644
--- a/app/workers/post_receive.rb
+++ b/app/workers/post_receive.rb
@@ -5,10 +5,10 @@ class PostReceive
def perform(repo_path, oldrev, newrev, ref, identifier)
- if repo_path.start_with?(Gitlab.config.gitolite.repos_path.to_s)
- repo_path.gsub!(Gitlab.config.gitolite.repos_path.to_s, "")
+ if repo_path.start_with?(Gitlab.config.gitlab_shell.repos_path.to_s)
+ repo_path.gsub!(Gitlab.config.gitlab_shell.repos_path.to_s, "")
else
- Gitlab::GitLogger.error("POST-RECEIVE: Check gitlab.yml config for correct gitolite.repos_path variable. \"#{Gitlab.config.gitolite.repos_path}\" does not match \"#{repo_path}\"")
+ Gitlab::GitLogger.error("POST-RECEIVE: Check gitlab.yml config for correct gitlab_shell.repos_path variable. \"#{Gitlab.config.gitlab_shell.repos_path}\" does not match \"#{repo_path}\"")
end
repo_path.gsub!(/.git$/, "")
@@ -22,7 +22,8 @@ class PostReceive
end
# Ignore push from non-gitlab users
- user = if identifier.eql? Gitlab.config.gitolite.admin_key
+ user = if identifier.nil?
+ raise identifier.inspect
email = project.repository.commit(newrev).author.email rescue nil
User.find_by_email(email) if email
elsif /^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier)
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
index 8fb4deeb52d..72d85e89b37 100644
--- a/config/gitlab.yml.example
+++ b/config/gitlab.yml.example
@@ -5,8 +5,7 @@
# How to use:
# 1. copy file as gitlab.yml
# 2. Replace gitlab -> host with your domain
-# 3. Replace gitolite -> ssh_host with your domain
-# 4. Replace gitlab -> email_from
+# 3. Replace gitlab -> email_from
#
# 1. GitLab app settings
@@ -22,8 +21,8 @@ gitlab:
# Note that ENV['RAILS_RELATIVE_URL_ROOT'] in config/unicorn.rb may need to be changed
# relative_url_root: /gitlab
- # Uncomment and customize if you can't use the default user to run GitLab (default: 'gitlab')
- # user: user123
+ # Uncomment and customize if you can't use the default user to run GitLab (default: 'git')
+ # user: git
## Email settings
# Email address used in the "From" field in mails sent by GitLab
@@ -103,21 +102,18 @@ backup:
path: "tmp/backups" # Relative paths are relative to Rails.root (default: tmp/backups/)
# keep_time: 604800 # default: 0 (forever) (in seconds)
-## Gitolite settings
-gitolite:
+## GitLab Shell settings
+gitlab_shell:
# REPOS_PATH MUST NOT BE A SYMLINK!!!
repos_path: /home/git/repositories/
hooks_path: /home/git/gitlab-shell/hooks/
- admin_key: gitlab
+
+ # Git over HTTP
upload_pack: true
receive_pack: true
- ssh_user: git
- ssh_host: localhost
- # ssh_port: 22
- # config_file: gitolite.conf
- # Uncomment and customize if you can't use the default group to own the repositories and run Gitolite (default: same as the 'ssh_user' above)
- # owner_group: group123
+ # If you use non-standart ssh port you need to specify it
+ # ssh_port: 22
## Git settings
# CAUTION!
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index c3179d78cc5..c1469530024 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -8,11 +8,11 @@ class Settings < Settingslogic
private
- def build_gitolite_ssh_path_prefix
- if gitolite.ssh_port != 22
- "ssh://#{gitolite.ssh_user}@#{gitolite.ssh_host}:#{gitolite.ssh_port}/"
+ def build_gitlab_shell_ssh_path_prefix
+ if gitlab_shell.ssh_port != 22
+ "ssh://#{gitlab_shell.ssh_user}@#{gitlab_shell.ssh_host}:#{gitlab_shell.ssh_port}/"
else
- "#{gitolite.ssh_user}@#{gitolite.ssh_host}:"
+ "#{gitlab_shell.ssh_user}@#{gitlab_shell.ssh_host}:"
end
end
@@ -41,6 +41,9 @@ Settings['omniauth'] ||= Settingslogic.new({})
Settings.omniauth['enabled'] = false if Settings.omniauth['enabled'].nil?
Settings.omniauth['providers'] ||= []
+#
+# GitLab
+#
Settings['gitlab'] ||= Settingslogic.new({})
Settings.gitlab['default_projects_limit'] ||= 10
Settings.gitlab['host'] ||= 'localhost'
@@ -54,29 +57,38 @@ Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url)
Settings.gitlab['user'] ||= 'git'
Settings.gitlab['signup_enabled'] ||= false
+#
+# Gravatar
+#
Settings['gravatar'] ||= Settingslogic.new({})
Settings.gravatar['enabled'] = true if Settings.gravatar['enabled'].nil?
Settings.gravatar['plain_url'] ||= 'http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm'
Settings.gravatar['ssl_url'] ||= 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm'
-Settings['gitolite'] ||= Settingslogic.new({})
-Settings.gitolite['admin_key'] ||= 'gitlab'
-Settings.gitolite['admin_uri'] ||= 'git@localhost:gitolite-admin'
-Settings.gitolite['config_file'] ||= 'gitolite.conf'
-Settings.gitolite['hooks_path'] ||= '/home/git/share/gitolite/hooks/'
-Settings.gitolite['receive_pack'] = true if Settings.gitolite['receive_pack'].nil?
-Settings.gitolite['upload_pack'] = true if Settings.gitolite['upload_pack'].nil?
-Settings.gitolite['repos_path'] ||= '/home/git/repositories/'
-Settings.gitolite['ssh_host'] ||= (Settings.gitlab.host || 'localhost')
-Settings.gitolite['ssh_port'] ||= 22
-Settings.gitolite['ssh_user'] ||= 'git'
-Settings.gitolite['owner_group'] ||= Settings.gitolite.ssh_user
-Settings.gitolite['ssh_path_prefix'] ||= Settings.send(:build_gitolite_ssh_path_prefix)
+#
+# GitLab Shell
+#
+Settings['gitlab_shell'] ||= Settingslogic.new({})
+Settings.gitlab_shell['hooks_path'] ||= '/home/git/gitlab-shell/hooks/'
+Settings.gitlab_shell['receive_pack'] = true if Settings.gitlab_shell['receive_pack'].nil?
+Settings.gitlab_shell['upload_pack'] = true if Settings.gitlab_shell['upload_pack'].nil?
+Settings.gitlab_shell['repos_path'] ||= '/home/git/repositories/'
+Settings.gitlab_shell['ssh_host'] ||= (Settings.gitlab.host || 'localhost')
+Settings.gitlab_shell['ssh_port'] ||= 22
+Settings.gitlab_shell['ssh_user'] ||= Settings.gitlab.user
+Settings.gitlab_shell['owner_group'] ||= Settings.gitlab.user
+Settings.gitlab_shell['ssh_path_prefix'] ||= Settings.send(:build_gitlab_shell_ssh_path_prefix)
+#
+# Backup
+#
Settings['backup'] ||= Settingslogic.new({})
Settings.backup['keep_time'] ||= 0
Settings.backup['path'] = File.expand_path(Settings.backup['path'] || "tmp/backups/", Rails.root)
+#
+# Git
+#
Settings['git'] ||= Settingslogic.new({})
Settings.git['max_size'] ||= 5242880 # 5.megabytes
Settings.git['bin_path'] ||= '/usr/bin/git'
diff --git a/config/routes.rb b/config/routes.rb
index d6432b86007..47c8a4122f5 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -18,9 +18,9 @@ Gitlab::Application.routes.draw do
# Enable Grack support
mount Grack::Bundle.new({
git_path: Gitlab.config.git.bin_path,
- project_root: Gitlab.config.gitolite.repos_path,
- upload_pack: Gitlab.config.gitolite.upload_pack,
- receive_pack: Gitlab.config.gitolite.receive_pack
+ project_root: Gitlab.config.gitlab_shell.repos_path,
+ upload_pack: Gitlab.config.gitlab_shell.upload_pack,
+ receive_pack: Gitlab.config.gitlab_shell.receive_pack
}), at: '/', constraints: lambda { |request| /[-\/\w\.]+\.git\//.match(request.path_info) }
#
diff --git a/features/support/env.rb b/features/support/env.rb
index c19ca3088cb..da40b38b79c 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -31,9 +31,9 @@ DatabaseCleaner.strategy = :truncation
Spinach.hooks.before_scenario do
# Use tmp dir for FS manipulations
- Gitlab.config.gitolite.stub(repos_path: Rails.root.join('tmp', 'test-git-base-path'))
- FileUtils.rm_rf Gitlab.config.gitolite.repos_path
- FileUtils.mkdir_p Gitlab.config.gitolite.repos_path
+ Gitlab.config.gitlab_shell.stub(repos_path: Rails.root.join('tmp', 'test-git-base-path'))
+ FileUtils.rm_rf Gitlab.config.gitlab_shell.repos_path
+ FileUtils.mkdir_p Gitlab.config.gitlab_shell.repos_path
end
Spinach.hooks.after_scenario do
diff --git a/lib/gitlab/backend/shell.rb b/lib/gitlab/backend/shell.rb
index 50ebfc5b07c..a779e88d3b8 100644
--- a/lib/gitlab/backend/shell.rb
+++ b/lib/gitlab/backend/shell.rb
@@ -44,7 +44,7 @@ module Gitlab
def url_to_repo path
- Gitlab.config.gitolite.ssh_path_prefix + "#{path}.git"
+ Gitlab.config.gitlab_shell.ssh_path_prefix + "#{path}.git"
end
end
end
diff --git a/lib/gitlab/project_mover.rb b/lib/gitlab/project_mover.rb
index 207e585f572..e21f45c6564 100644
--- a/lib/gitlab/project_mover.rb
+++ b/lib/gitlab/project_mover.rb
@@ -15,10 +15,10 @@ module Gitlab
def execute
# Create new dir if missing
- new_dir_path = File.join(Gitlab.config.gitolite.repos_path, new_dir)
+ new_dir_path = File.join(Gitlab.config.gitlab_shell.repos_path, new_dir)
FileUtils.mkdir( new_dir_path, mode: 0770 ) unless File.exists?(new_dir_path)
- old_path = File.join(Gitlab.config.gitolite.repos_path, old_dir, "#{project.path}.git")
+ old_path = File.join(Gitlab.config.gitlab_shell.repos_path, old_dir, "#{project.path}.git")
new_path = File.join(new_dir_path, "#{project.path}.git")
if File.exists? new_path
diff --git a/lib/gitolited.rb b/lib/gitolited.rb
index 4911a473f05..a7fc4148106 100644
--- a/lib/gitolited.rb
+++ b/lib/gitolited.rb
@@ -1,11 +1,11 @@
# == Gitolited mixin
#
-# Provide a shortcut to Gitlab::Gitolite instance by gitolite
+# Provide a shortcut to Gitlab::Shell instance by gitlab_shell
#
# Used by Project, UsersProject, etc
#
module Gitolited
- def gitolite
+ def gitlab_shell
Gitlab::Shell.new
end
end
diff --git a/lib/tasks/gitlab/backup.rake b/lib/tasks/gitlab/backup.rake
index ae2b1bb793f..214ce720e7a 100644
--- a/lib/tasks/gitlab/backup.rake
+++ b/lib/tasks/gitlab/backup.rake
@@ -144,7 +144,7 @@ namespace :gitlab do
task :restore => :environment do
backup_path_repo = File.join(Gitlab.config.backup.path, "repositories")
- repos_path = Gitlab.config.gitolite.repos_path
+ repos_path = Gitlab.config.gitlab_shell.repos_path
puts "Restoring repositories ... "
diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake
index c07cdb9615e..4e252f026bc 100644
--- a/lib/tasks/gitlab/check.rake
+++ b/lib/tasks/gitlab/check.rake
@@ -1,7 +1,7 @@
namespace :gitlab do
desc "GITLAB | Check the configuration of GitLab and its environment"
task check: %w{gitlab:env:check
- gitlab:gitolite:check
+ gitlab:gitlab_shell:check
gitlab:sidekiq:check
gitlab:app:check}
@@ -296,10 +296,10 @@ namespace :gitlab do
# see https://github.com/gitlabhq/gitlabhq/issues/1059
def check_issue_1059_shell_profile_error
- gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
- print "Has no \"-e\" in ~#{gitolite_ssh_user}/.profile ... "
+ gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user
+ print "Has no \"-e\" in ~#{gitlab_shell_ssh_user}/.profile ... "
- profile_file = File.join(gitolite_user_home, ".profile")
+ profile_file = File.join(gitlab_shell_user_home, ".profile")
unless File.read(profile_file) =~ /^-e PATH/
puts "yes".green
@@ -367,7 +367,7 @@ namespace :gitlab do
- namespace :gitolite do
+ namespace :gitlab_shell do
desc "GITLAB | Check the configuration of Gitolite"
task check: :environment do
warn_user_is_not_gitlab
@@ -392,25 +392,25 @@ namespace :gitlab do
print "post-receive hook up-to-date? ... "
hook_file = "post-receive"
- gitolite_hooks_path = File.join(Gitlab.config.gitolite.hooks_path, "common")
- gitolite_hook_file = File.join(gitolite_hooks_path, hook_file)
- gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
+ gitlab_shell_hooks_path = File.join(Gitlab.config.gitlab_shell.hooks_path, "common")
+ gitlab_shell_hook_file = File.join(gitlab_shell_hooks_path, hook_file)
+ gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user
- unless File.exists?(gitolite_hook_file)
+ unless File.exists?(gitlab_shell_hook_file)
puts "can't check because of previous errors".magenta
return
end
- gitolite_hook_content = File.read(gitolite_hook_file)
+ gitlab_shell_hook_content = File.read(gitlab_shell_hook_file)
gitlab_hook_file = Rails.root.join.join("lib", "hooks", hook_file)
gitlab_hook_content = File.read(gitlab_hook_file)
- if gitolite_hook_content == gitlab_hook_content
+ if gitlab_shell_hook_content == gitlab_hook_content
puts "yes".green
else
puts "no".red
try_fixing_it(
- "sudo -u #{gitolite_ssh_user} cp #{gitlab_hook_file} #{gitolite_hook_file}"
+ "sudo -u #{gitlab_shell_ssh_user} cp #{gitlab_hook_file} #{gitlab_shell_hook_file}"
)
for_more_information(
see_installation_guide_section "Setup GitLab Hooks"
@@ -422,7 +422,7 @@ namespace :gitlab do
def check_repo_base_exists
print "Repo base directory exists? ... "
- repo_base_path = Gitlab.config.gitolite.repos_path
+ repo_base_path = Gitlab.config.gitlab_shell.repos_path
if File.exists?(repo_base_path)
puts "yes".green
@@ -444,7 +444,7 @@ namespace :gitlab do
def check_repo_base_is_not_symlink
print "Repo base directory is a symlink? ... "
- repo_base_path = Gitlab.config.gitolite.repos_path
+ repo_base_path = Gitlab.config.gitlab_shell.repos_path
unless File.exists?(repo_base_path)
puts "can't check because of previous errors".magenta
return
@@ -464,7 +464,7 @@ namespace :gitlab do
def check_repo_base_permissions
print "Repo base access is drwxrws---? ... "
- repo_base_path = Gitlab.config.gitolite.repos_path
+ repo_base_path = Gitlab.config.gitlab_shell.repos_path
unless File.exists?(repo_base_path)
puts "can't check because of previous errors".magenta
return
@@ -487,23 +487,23 @@ namespace :gitlab do
end
def check_repo_base_user_and_group
- gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
- gitolite_owner_group = Gitlab.config.gitolite.owner_group
- print "Repo base owned by #{gitolite_ssh_user}:#{gitolite_owner_group}? ... "
+ gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user
+ gitlab_shell_owner_group = Gitlab.config.gitlab_shell.owner_group
+ print "Repo base owned by #{gitlab_shell_ssh_user}:#{gitlab_shell_owner_group}? ... "
- repo_base_path = Gitlab.config.gitolite.repos_path
+ repo_base_path = Gitlab.config.gitlab_shell.repos_path
unless File.exists?(repo_base_path)
puts "can't check because of previous errors".magenta
return
end
- if File.stat(repo_base_path).uid == uid_for(gitolite_ssh_user) &&
- File.stat(repo_base_path).gid == gid_for(gitolite_owner_group)
+ if File.stat(repo_base_path).uid == uid_for(gitlab_shell_ssh_user) &&
+ File.stat(repo_base_path).gid == gid_for(gitlab_shell_owner_group)
puts "yes".green
else
puts "no".red
try_fixing_it(
- "sudo chown -R #{gitolite_ssh_user}:#{gitolite_owner_group} #{repo_base_path}"
+ "sudo chown -R #{gitlab_shell_ssh_user}:#{gitlab_shell_owner_group} #{repo_base_path}"
)
for_more_information(
see_installation_guide_section "Gitolite"
@@ -516,11 +516,11 @@ namespace :gitlab do
print "post-receive hooks in repos are links: ... "
hook_file = "post-receive"
- gitolite_hooks_path = File.join(Gitlab.config.gitolite.hooks_path, "common")
- gitolite_hook_file = File.join(gitolite_hooks_path, hook_file)
- gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
+ gitlab_shell_hooks_path = File.join(Gitlab.config.gitlab_shell.hooks_path, "common")
+ gitlab_shell_hook_file = File.join(gitlab_shell_hooks_path, hook_file)
+ gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user
- unless File.exists?(gitolite_hook_file)
+ unless File.exists?(gitlab_shell_hook_file)
puts "can't check because of previous errors".magenta
return
end
@@ -542,7 +542,7 @@ namespace :gitlab do
unless File.exists?(project_hook_file)
puts "missing".red
try_fixing_it(
- "sudo -u #{gitolite_ssh_user} ln -sf #{gitolite_hook_file} #{project_hook_file}"
+ "sudo -u #{gitlab_shell_ssh_user} ln -sf #{gitlab_shell_hook_file} #{project_hook_file}"
)
for_more_information(
"lib/support/rewrite-hooks.sh"
@@ -552,12 +552,12 @@ namespace :gitlab do
end
if File.lstat(project_hook_file).symlink? &&
- File.realpath(project_hook_file) == File.realpath(gitolite_hook_file)
+ File.realpath(project_hook_file) == File.realpath(gitlab_shell_hook_file)
puts "ok".green
else
puts "not a link to Gitolite's hook".red
try_fixing_it(
- "sudo -u #{gitolite_ssh_user} ln -sf #{gitolite_hook_file} #{project_hook_file}"
+ "sudo -u #{gitlab_shell_ssh_user} ln -sf #{gitlab_shell_hook_file} #{project_hook_file}"
)
for_more_information(
"lib/support/rewrite-hooks.sh"
@@ -572,19 +572,19 @@ namespace :gitlab do
# Helper methods
########################
- def gitolite_user_home
- File.expand_path("~#{Gitlab.config.gitolite.ssh_user}")
+ def gitlab_shell_user_home
+ File.expand_path("~#{Gitlab.config.gitlab_shell.ssh_user}")
end
- def gitolite_version
- gitolite_version_file = "#{gitolite_user_home}/gitolite/src/VERSION"
- if File.readable?(gitolite_version_file)
- File.read(gitolite_version_file)
+ def gitlab_shell_version
+ gitlab_shell_version_file = "#{gitlab_shell_user_home}/gitlab_shell/src/VERSION"
+ if File.readable?(gitlab_shell_version_file)
+ File.read(gitlab_shell_version_file)
end
end
- def has_gitolite3?
- gitolite_version.try(:start_with?, "v3.")
+ def has_gitlab_shell3?
+ gitlab_shell_version.try(:start_with?, "v3.")
end
end
diff --git a/lib/tasks/gitlab/cleanup.rake b/lib/tasks/gitlab/cleanup.rake
index a81ef22ffb8..d8ee56e5523 100644
--- a/lib/tasks/gitlab/cleanup.rake
+++ b/lib/tasks/gitlab/cleanup.rake
@@ -7,7 +7,7 @@ namespace :gitlab do
namespaces = Namespace.pluck(:path)
- git_base_path = Gitlab.config.gitolite.repos_path
+ git_base_path = Gitlab.config.gitlab_shell.repos_path
all_dirs = Dir.glob(git_base_path + '/*')
puts git_base_path.yellow
@@ -48,7 +48,7 @@ namespace :gitlab do
warn_user_is_not_gitlab
remove_flag = ENV['REMOVE']
- git_base_path = Gitlab.config.gitolite.repos_path
+ git_base_path = Gitlab.config.gitlab_shell.repos_path
all_dirs = Dir.glob(git_base_path + '/*')
global_projects = Project.where(namespace_id: nil).pluck(:path)
@@ -68,13 +68,6 @@ namespace :gitlab do
global_projects.include?(path)
end
- # skip gitolite admin
- all_dirs.reject! do |dir|
- repo_name = File.basename dir
- repo_name == 'gitolite-admin.git'
- end
-
-
all_dirs.each do |dir_path|
if remove_flag
if FileUtils.rm_rf dir_path
diff --git a/lib/tasks/gitlab/enable_namespaces.rake b/lib/tasks/gitlab/enable_namespaces.rake
index aa76a2f7d83..a33639a0013 100644
--- a/lib/tasks/gitlab/enable_namespaces.rake
+++ b/lib/tasks/gitlab/enable_namespaces.rake
@@ -6,11 +6,6 @@ namespace :gitlab do
migrate_user_namespaces
migrate_groups
migrate_projects
-
- puts "Rebuild Gitolite ... "
- gitolite = Gitlab::Gitolite.new
- gitolite.update_repositories(Project.where('namespace_id IS NOT NULL'))
- puts "... #{"done".green}"
end
def migrate_user_namespaces
@@ -80,7 +75,7 @@ namespace :gitlab do
end
def migrate_projects
- git_path = Gitlab.config.gitolite.repos_path
+ git_path = Gitlab.config.gitlab_shell.repos_path
puts "\nMove projects in groups into respective directories ... ".blue
Project.where('namespace_id IS NOT NULL').find_each(batch_size: 500) do |project|
next unless project.group
diff --git a/lib/tasks/gitlab/import.rake b/lib/tasks/gitlab/import.rake
index 0ca652faa74..bddbd7ef855 100644
--- a/lib/tasks/gitlab/import.rake
+++ b/lib/tasks/gitlab/import.rake
@@ -12,7 +12,7 @@ namespace :gitlab do
desc "GITLAB | Import bare repositories from git_host -> base_path into GitLab project instance"
task :repos => :environment do
- git_base_path = Gitlab.config.gitolite.repos_path
+ git_base_path = Gitlab.config.gitlab_shell.repos_path
repos_to_import = Dir.glob(git_base_path + '/*')
namespaces = Namespace.pluck(:path)
@@ -26,7 +26,6 @@ namespace :gitlab do
# skip if not git repo
next unless repo_name =~ /.git$/
- # skip gitolite admin
next if repo_name == 'gitolite-admin.git'
path = repo_name.sub(/\.git$/, '')
diff --git a/lib/tasks/gitlab/info.rake b/lib/tasks/gitlab/info.rake
index c55990762bb..c44016ef6e8 100644
--- a/lib/tasks/gitlab/info.rake
+++ b/lib/tasks/gitlab/info.rake
@@ -54,16 +54,16 @@ namespace :gitlab do
# check Gitolite version
- gitolite_version_file = "#{Gitlab.config.gitolite.repos_path}/../gitlab-shell/VERSION"
- if File.readable?(gitolite_version_file)
- gitolite_version = File.read(gitolite_version_file)
+ gitlab_shell_version_file = "#{Gitlab.config.gitlab_shell.repos_path}/../gitlab-shell/VERSION"
+ if File.readable?(gitlab_shell_version_file)
+ gitlab_shell_version = File.read(gitlab_shell_version_file)
end
puts ""
puts "GitLab Shell".yellow
- puts "Version:\t#{gitolite_version || "unknown".red}"
- puts "Repositories:\t#{Gitlab.config.gitolite.repos_path}"
- puts "Hooks:\t\t#{Gitlab.config.gitolite.hooks_path}"
+ puts "Version:\t#{gitlab_shell_version || "unknown".red}"
+ puts "Repositories:\t#{Gitlab.config.gitlab_shell.repos_path}"
+ puts "Hooks:\t\t#{Gitlab.config.gitlab_shell.hooks_path}"
puts "Git:\t\t#{Gitlab.config.git.bin_path}"
end
diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake
index c02fbad0214..0ab8df1d094 100644
--- a/lib/tasks/gitlab/shell.rake
+++ b/lib/tasks/gitlab/shell.rake
@@ -8,7 +8,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.gitolite.repos_path, "#{project.path_with_namespace}.git")
+ path_to_repo = File.join(Gitlab.config.gitlab_shell.repos_path, "#{project.path_with_namespace}.git")
if File.exists?(path_to_repo)
print '-'
else
diff --git a/lib/tasks/sidekiq.rake b/lib/tasks/sidekiq.rake
index e4eb0e6776f..67e8daafec7 100644
--- a/lib/tasks/sidekiq.rake
+++ b/lib/tasks/sidekiq.rake
@@ -6,7 +6,7 @@ namespace :sidekiq do
desc "GITLAB | Start sidekiq"
task :start do
- run "nohup bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitolite,common,default -e #{Rails.env} -P #{pidfile} >> #{Rails.root.join("log", "sidekiq.log")} 2>&1 &"
+ run "nohup bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e #{Rails.env} -P #{pidfile} >> #{Rails.root.join("log", "sidekiq.log")} 2>&1 &"
end
def pidfile
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index bb314e60eb7..77497991f99 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -35,7 +35,7 @@ RSpec.configure do |config|
config.before do
# Use tmp dir for FS manipulations
temp_repos_path = Rails.root.join('tmp', 'test-git-base-path')
- Gitlab.config.gitolite.stub(repos_path: temp_repos_path)
+ Gitlab.config.gitlab_shell.stub(repos_path: temp_repos_path)
FileUtils.rm_rf temp_repos_path
FileUtils.mkdir_p temp_repos_path
end