diff options
-rw-r--r-- | app/workers/repository_check/single_repository_worker.rb | 1 | ||||
-rw-r--r-- | lib/gitlab/git/repository.rb | 12 |
2 files changed, 6 insertions, 7 deletions
diff --git a/app/workers/repository_check/single_repository_worker.rb b/app/workers/repository_check/single_repository_worker.rb index 684bef90553..d07e0192046 100644 --- a/app/workers/repository_check/single_repository_worker.rb +++ b/app/workers/repository_check/single_repository_worker.rb @@ -33,6 +33,7 @@ module RepositoryCheck def git_fsck(repository) return false unless repository.exists? + repository.raw_repository.fsck true diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 2545c71bc59..865f3d49033 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -1119,12 +1119,10 @@ module Gitlab # Refactoring aid; allows us to copy code from app/models/repository.rb def run_git(args, env: {}, nice: true) + cmd = [Gitlab.config.git.bin_path, *args] + cmd.unshift("nice") if nice circuit_breaker.perform do - if nice - popen(["nice", Gitlab.config.git.bin_path, *args], path, env) - else - popen([Gitlab.config.git.bin_path, *args], path, env) - end + popen(cmd, path, env) end end @@ -1192,9 +1190,9 @@ module Gitlab end def fsck - ret = run_git(%W[--git-dir=#{path} fsck], nice: true) + output, status = run_git(%W[--git-dir=#{path} fsck], nice: true) - raise GitError.new("command failed: nice git --git-dir=#{path} fsck\n#{ret.first}") unless ret.last.zero? + raise GitError.new("Could not fsck repository:\n#{output}") unless status.zero? end def gitaly_repository |