summaryrefslogtreecommitdiff
path: root/lib/tasks
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2018-01-03 14:51:04 +0100
committerJames Lopez <james@jameslopez.es>2018-01-04 11:22:43 +0100
commitf8e1b44dc5d2a78676672dfc7d44c17e6defeda6 (patch)
tree8080544b278edd73f241bfdbf08cca898ebdbe9e /lib/tasks
parentbc46c822fc94cfa54a190cfb0e89afeae799f57a (diff)
downloadgitlab-ce-f8e1b44dc5d2a78676672dfc7d44c17e6defeda6.tar.gz
add locks chek
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/gitlab/git.rake26
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/tasks/gitlab/git.rake b/lib/tasks/gitlab/git.rake
index f3ffff43726..5c1b19860f0 100644
--- a/lib/tasks/gitlab/git.rake
+++ b/lib/tasks/gitlab/git.rake
@@ -32,7 +32,10 @@ namespace :gitlab do
desc 'GitLab | Git | Check all repos integrity'
task fsck: :environment do
- failures = perform_git_cmd(%W(#{Gitlab.config.git.bin_path} fsck --name-objects --no-progress), "Checking integrity")
+ failures = perform_git_cmd(%W(#{Gitlab.config.git.bin_path} fsck --name-objects --no-progress), "Checking integrity") do |repo|
+ check_config_lock(repo)
+ check_ref_locks(repo)
+ end
if failures.empty?
puts "Done".color(:green)
else
@@ -50,6 +53,8 @@ namespace :gitlab do
else
failures << repo
end
+
+ yield(repo) if block_given?
end
failures
@@ -59,5 +64,24 @@ namespace :gitlab do
puts "The following repositories reported errors:".color(:red)
failures.each { |f| puts "- #{f}" }
end
+
+ def check_config_lock(repo_dir)
+ config_exists = File.exist?(File.join(repo_dir, 'config.lock'))
+ config_output = config_exists ? 'yes'.color(:red) : 'no'.color(:green)
+
+ puts "'config.lock' file exists?".color(:yellow) + " ... #{config_output}"
+ end
+
+ def check_ref_locks(repo_dir)
+ lock_files = Dir.glob(File.join(repo_dir, 'refs/heads/*.lock'))
+
+ if lock_files.present?
+ puts "Ref lock files exist:".color(:red)
+
+ lock_files.each { |lock_file| puts " #{lock_file}" }
+ else
+ puts "No ref lock files exist".color(:green)
+ end
+ end
end
end