Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
12f61e0d
Commit
12f61e0d
authored
Dec 04, 2017
by
Kim "BKC" Carlbäcker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move SingleRepositoryWorker#fsck into Gitlab::Git::Repository
parent
e0f84130
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
11 deletions
+17
-11
app/workers/repository_check/single_repository_worker.rb
app/workers/repository_check/single_repository_worker.rb
+7
-9
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+10
-2
No files found.
app/workers/repository_check/single_repository_worker.rb
View file @
12f61e0d
...
...
@@ -32,17 +32,15 @@ module RepositoryCheck
end
def
git_fsck
(
repository
)
path
=
repository
.
path_to_repo
cmd
=
%W(nice git --git-dir=
#{
path
}
fsck)
output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
)
return
false
unless
repository
.
exists?
repository
.
raw_repository
.
fsck
if
status
.
zero?
true
els
e
Gitlab
::
RepositoryCheckLogger
.
error
(
"command failed:
#{
cmd
.
join
(
' '
)
}
\n
#{
output
}
"
)
rescue
Gitlab
::
Git
::
Repository
::
GitError
=>
e
Gitlab
::
RepositoryCheckLogger
.
error
(
e
.
message
)
false
end
end
def
has_pushes?
(
project
)
Project
.
with_push
.
exists?
(
project
.
id
)
...
...
lib/gitlab/git/repository.rb
View file @
12f61e0d
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment