No gitolite in project any more

This commit is contained in:
Dmitriy Zaporozhets 2013-02-11 19:16:59 +02:00
parent 8e0b58d7e7
commit d64090b8a9
27 changed files with 117 additions and 159 deletions

View file

@ -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.'

View file

@ -1,5 +1,2 @@
class ErrorsController < ApplicationController
def githost
render "errors/gitolite"
end
end

View file

@ -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|

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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}

View file

@ -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

View file

@ -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)