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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
d7a4a2fe
Commit
d7a4a2fe
authored
Apr 18, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
When a project wiki is disabled skip it for fsck
parent
6d899f46
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
3 deletions
+33
-3
app/workers/repository_check/single_repository_worker.rb
app/workers/repository_check/single_repository_worker.rb
+3
-3
spec/workers/repository_check/single_repository_worker_spec.rb
...workers/repository_check/single_repository_worker_spec.rb
+30
-0
No files found.
app/workers/repository_check/single_repository_worker.rb
View file @
d7a4a2fe
...
@@ -15,10 +15,10 @@ module RepositoryCheck
...
@@ -15,10 +15,10 @@ module RepositoryCheck
private
private
def
check
(
project
)
def
check
(
project
)
repositories
=
[
project
.
repository
]
repositories
<<
project
.
wiki
.
repository
if
project
.
wiki_enabled?
# Use 'map do', not 'all? do', to prevent short-circuiting
# Use 'map do', not 'all? do', to prevent short-circuiting
[
project
.
repository
,
project
.
wiki
.
repository
].
map
do
|
repository
|
repositories
.
map
{
|
repository
|
git_fsck
(
repository
.
path_to_repo
)
}.
all?
git_fsck
(
repository
.
path_to_repo
)
end
.
all?
end
end
def
git_fsck
(
path
)
def
git_fsck
(
path
)
...
...
spec/workers/repository_check/single_repository_worker_spec.rb
0 → 100644
View file @
d7a4a2fe
require
'spec_helper'
require
'fileutils'
describe
RepositoryCheck
::
SingleRepositoryWorker
do
subject
{
described_class
.
new
}
it
'fails if the wiki repository is broken'
do
project
=
create
(
:project_empty_repo
,
wiki_enabled:
true
)
project
.
create_wiki
# Test sanity: everything should be fine before the wiki repo is broken
subject
.
perform
(
project
.
id
)
expect
(
project
.
reload
.
last_repository_check_failed
).
to
eq
(
false
)
FileUtils
.
rm_rf
(
project
.
wiki
.
repository
.
path_to_repo
)
subject
.
perform
(
project
.
id
)
expect
(
project
.
reload
.
last_repository_check_failed
).
to
eq
(
true
)
end
it
'skips wikis when disabled'
do
project
=
create
(
:project_empty_repo
,
wiki_enabled:
false
)
# Make sure the test would fail if it checked the wiki repo
FileUtils
.
rm_rf
(
project
.
wiki
.
repository
.
path_to_repo
)
subject
.
perform
(
project
.
id
)
expect
(
project
.
reload
.
last_repository_check_failed
).
to
eq
(
false
)
end
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