Commit 26093586 authored by James Lopez's avatar James Lopez

add new git fsck rake task and spec

parent ac409fb4
...@@ -30,6 +30,16 @@ namespace :gitlab do ...@@ -30,6 +30,16 @@ namespace :gitlab do
end end
end end
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")
if failures.empty?
puts "Done".color(:green)
else
output_failures(failures)
end
end
def perform_git_cmd(cmd, message) def perform_git_cmd(cmd, message)
puts "Starting #{message} on all repositories" puts "Starting #{message} on all repositories"
......
require 'rake_helper'
describe 'gitlab:git rake tasks' do
before do
Rake.application.rake_require 'tasks/gitlab/git'
stub_warn_user_is_not_gitlab
FileUtils.mkdir(Settings.absolute('tmp/tests/default_storage'))
end
after do
FileUtils.rm_rf(Settings.absolute('tmp/tests/default_storage'))
end
describe 'fsck' do
let(:storages) do
{ 'default' => { 'path' => Settings.absolute('tmp/tests/default_storage') } }
end
it 'outputs the right git command' do
expect(Kernel).to receive(:system).with('').and_return(true)
run_rake_task('gitlab:git:fsck')
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment