Merge pull request #2803 from donnykurnia/fix-2776

Improve gitlab:check. Fix 2776
This commit is contained in:
Riyad Preukschas 2013-02-01 11:38:59 -08:00
commit 72e2a49819

View file

@ -780,6 +780,9 @@ namespace :gitlab do
Project.find_each(batch_size: 100) do |project| Project.find_each(batch_size: 100) do |project|
print "#{project.name_with_namespace.yellow} ... " print "#{project.name_with_namespace.yellow} ... "
if project.empty_repo?
puts "repository is empty".magenta
else
correct_options = options.map do |name, value| correct_options = options.map do |name, value|
run("git --git-dir=\"#{project.repository.path_to_repo}\" config --get #{name}").try(:chomp) == value run("git --git-dir=\"#{project.repository.path_to_repo}\" config --get #{name}").try(:chomp) == value
end end
@ -798,6 +801,7 @@ namespace :gitlab do
end end
end end
end end
end
def check_repos_post_receive_hooks_is_link def check_repos_post_receive_hooks_is_link
print "post-receive hooks in repos are links: ... " print "post-receive hooks in repos are links: ... "
@ -820,6 +824,10 @@ namespace :gitlab do
Project.find_each(batch_size: 100) do |project| Project.find_each(batch_size: 100) do |project|
print "#{project.name_with_namespace.yellow} ... " print "#{project.name_with_namespace.yellow} ... "
if project.empty_repo?
puts "repository is empty".magenta
else
project_hook_file = File.join(project.repository.path_to_repo, "hooks", hook_file) project_hook_file = File.join(project.repository.path_to_repo, "hooks", hook_file)
unless File.exists?(project_hook_file) unless File.exists?(project_hook_file)
@ -849,6 +857,7 @@ namespace :gitlab do
end end
end end
end end
end
# Helper methods # Helper methods