diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-12-04 15:58:53 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-12-04 15:58:53 +0000 |
commit | a1cd9be42910c89192e82659c09bf0242c8e5dae (patch) | |
tree | 40378af8cfd79c61f1b692a852d0f54ce571bf0e /lib | |
parent | 0f3f50d188e5c3f458d65b91765f080288cb06ab (diff) | |
parent | 12f61e0d2cabb07172ef93143b084104141dd771 (diff) | |
download | gitlab-ce-a1cd9be42910c89192e82659c09bf0242c8e5dae.tar.gz |
Merge branch 'git-fsck-worker-client-prep' into 'master'
Move SingleRepositoryWorker#fsck into Gitlab::Git::Repository
Closes gitaly#802
See merge request gitlab-org/gitlab-ce!15710
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/git/repository.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index dbc08747228..867fc2a42f6 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -1118,9 +1118,11 @@ module Gitlab end # Refactoring aid; allows us to copy code from app/models/repository.rb - def run_git(args, env: {}) + def run_git(args, env: {}, nice: false) + cmd = [Gitlab.config.git.bin_path, *args] + cmd.unshift("nice") if nice circuit_breaker.perform do - popen([Gitlab.config.git.bin_path, *args], path, env) + popen(cmd, path, env) end end @@ -1187,6 +1189,12 @@ module Gitlab end end + def fsck + output, status = run_git(%W[--git-dir=#{path} fsck], nice: true) + + raise GitError.new("Could not fsck repository:\n#{output}") unless status.zero? + end + def gitaly_repository Gitlab::GitalyClient::Util.repository(@storage, @relative_path, @gl_repository) end |