diff options
author | Riyad Preukschas <riyad@informatik.uni-bremen.de> | 2013-02-02 00:18:09 +0400 |
---|---|---|
committer | Riyad Preukschas <riyad@informatik.uni-bremen.de> | 2013-02-02 00:22:40 +0400 |
commit | fac503877dbd3541009a30c8b9353d6eef85b059 (patch) | |
tree | 17bc4a79921c1085e0a37b12d5460a3dc5a5f8d8 /lib | |
parent | 42dd006dfc39fc637027a6c2c8c659febde24ad6 (diff) |
Port changes from #2803
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tasks/gitlab/check.rake | 85 |
1 files changed, 47 insertions, 38 deletions
diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index 27e94fca922..b54e63acfbc 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -782,21 +782,25 @@ namespace :gitlab do Project.find_each(batch_size: 100) do |project| print "#{project.name_with_namespace.yellow} ... " - correct_options = options.map do |name, value| - run("git --git-dir=\"#{project.repository.path_to_repo}\" config --get #{name}").try(:chomp) == value - end - - if correct_options.all? - puts "ok".green + if project.empty_repo? + puts "repository is empty".magenta else - puts "wrong or missing".red - try_fixing_it( - sudo_gitlab("bundle exec rake gitlab:gitolite:update_repos RAILS_ENV=production") - ) - for_more_information( - "doc/raketasks/maintenance.md" - ) - fix_and_rerun + correct_options = options.map do |name, value| + run("git --git-dir=\"#{project.repository.path_to_repo}\" config --get #{name}").try(:chomp) == value + end + + if correct_options.all? + puts "ok".green + else + puts "wrong or missing".red + try_fixing_it( + sudo_gitlab("bundle exec rake gitlab:gitolite:update_repos RAILS_ENV=production") + ) + for_more_information( + "doc/raketasks/maintenance.md" + ) + fix_and_rerun + end end end end @@ -822,32 +826,37 @@ namespace :gitlab do Project.find_each(batch_size: 100) do |project| print "#{project.name_with_namespace.yellow} ... " - project_hook_file = File.join(project.repository.path_to_repo, "hooks", hook_file) - 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}" - ) - for_more_information( - "lib/support/rewrite-hooks.sh" - ) - fix_and_rerun - next - end - - if File.lstat(project_hook_file).symlink? && - File.realpath(project_hook_file) == File.realpath(gitolite_hook_file) - puts "ok".green + if project.empty_repo? + puts "repository is empty".magenta 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}" - ) - for_more_information( - "lib/support/rewrite-hooks.sh" - ) - fix_and_rerun + project_hook_file = File.join(project.repository.path_to_repo, "hooks", hook_file) + + 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}" + ) + for_more_information( + "lib/support/rewrite-hooks.sh" + ) + fix_and_rerun + next + end + + if File.lstat(project_hook_file).symlink? && + File.realpath(project_hook_file) == File.realpath(gitolite_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}" + ) + for_more_information( + "lib/support/rewrite-hooks.sh" + ) + fix_and_rerun + end end end end |