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
Boxiang Sun
gitlab-ce
Commits
a0808df0
Commit
a0808df0
authored
Jun 05, 2018
by
Jacob Vosmaer (GitLab)
Committed by
Douwe Maan
Jun 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Find and mark more Git disk access locations
parent
78d2e91b
Changes
31
Show whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
198 additions
and
80 deletions
+198
-80
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+4
-1
lib/backup.rb
lib/backup.rb
+3
-0
lib/backup/database.rb
lib/backup/database.rb
+2
-2
lib/backup/files.rb
lib/backup/files.rb
+7
-3
lib/backup/manager.rb
lib/backup/manager.rb
+3
-3
lib/backup/repository.rb
lib/backup/repository.rb
+10
-3
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+1
-1
lib/gitlab/import_export/repo_saver.rb
lib/gitlab/import_export/repo_saver.rb
+0
-4
lib/gitlab/import_export/wiki_repo_saver.rb
lib/gitlab/import_export/wiki_repo_saver.rb
+1
-5
lib/gitlab/task_helpers.rb
lib/gitlab/task_helpers.rb
+6
-4
lib/tasks/gitlab/cleanup.rake
lib/tasks/gitlab/cleanup.rake
+3
-2
spec/features/projects/import_export/import_file_spec.rb
spec/features/projects/import_export/import_file_spec.rb
+4
-2
spec/lib/backup/files_spec.rb
spec/lib/backup/files_spec.rb
+3
-1
spec/lib/backup/repository_spec.rb
spec/lib/backup/repository_spec.rb
+3
-1
spec/lib/gitlab/bare_repository_import/importer_spec.rb
spec/lib/gitlab/bare_repository_import/importer_spec.rb
+7
-0
spec/lib/gitlab/bare_repository_import/repository_spec.rb
spec/lib/gitlab/bare_repository_import/repository_spec.rb
+4
-2
spec/lib/gitlab/git/repository_spec.rb
spec/lib/gitlab/git/repository_spec.rb
+4
-0
spec/lib/gitlab/git/rev_list_spec.rb
spec/lib/gitlab/git/rev_list_spec.rb
+3
-1
spec/lib/gitlab/git_access_spec.rb
spec/lib/gitlab/git_access_spec.rb
+17
-15
spec/lib/gitlab/import_export/fork_spec.rb
spec/lib/gitlab/import_export/fork_spec.rb
+4
-2
spec/lib/gitlab/import_export/repo_restorer_spec.rb
spec/lib/gitlab/import_export/repo_restorer_spec.rb
+7
-3
spec/lib/gitlab/shell_spec.rb
spec/lib/gitlab/shell_spec.rb
+5
-1
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+10
-2
spec/models/namespace_spec.rb
spec/models/namespace_spec.rb
+8
-2
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+38
-5
spec/requests/api/tags_spec.rb
spec/requests/api/tags_spec.rb
+4
-1
spec/services/projects/transfer_service_spec.rb
spec/services/projects/transfer_service_spec.rb
+11
-3
spec/services/projects/update_service_spec.rb
spec/services/projects/update_service_spec.rb
+2
-2
spec/support/helpers/cycle_analytics_helpers.rb
spec/support/helpers/cycle_analytics_helpers.rb
+5
-1
spec/tasks/gitlab/backup_rake_spec.rb
spec/tasks/gitlab/backup_rake_spec.rb
+13
-6
spec/workers/repository_check/single_repository_worker_spec.rb
...workers/repository_check/single_repository_worker_spec.rb
+6
-2
No files found.
app/helpers/projects_helper.rb
View file @
a0808df0
...
@@ -412,7 +412,10 @@ module ProjectsHelper
...
@@ -412,7 +412,10 @@ module ProjectsHelper
exports_path
=
File
.
join
(
Settings
.
shared
[
'path'
],
'tmp/project_exports'
)
exports_path
=
File
.
join
(
Settings
.
shared
[
'path'
],
'tmp/project_exports'
)
filtered_message
=
message
.
strip
.
gsub
(
exports_path
,
"[REPO EXPORT PATH]"
)
filtered_message
=
message
.
strip
.
gsub
(
exports_path
,
"[REPO EXPORT PATH]"
)
disk_path
=
Gitlab
.
config
.
repositories
.
storages
[
project
.
repository_storage
].
legacy_disk_path
disk_path
=
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
Gitlab
.
config
.
repositories
.
storages
[
project
.
repository_storage
].
legacy_disk_path
end
filtered_message
.
gsub
(
disk_path
.
chomp
(
'/'
),
"[REPOS PATH]"
)
filtered_message
.
gsub
(
disk_path
.
chomp
(
'/'
),
"[REPOS PATH]"
)
end
end
...
...
lib/backup.rb
0 → 100644
View file @
a0808df0
module
Backup
Error
=
Class
.
new
(
StandardError
)
end
lib/backup/database.rb
View file @
a0808df0
...
@@ -44,7 +44,7 @@ module Backup
...
@@ -44,7 +44,7 @@ module Backup
end
end
report_success
(
success
)
report_success
(
success
)
abort
'Backup failed'
unless
success
raise
Backup
::
Error
,
'Backup failed'
unless
success
end
end
def
restore
def
restore
...
@@ -72,7 +72,7 @@ module Backup
...
@@ -72,7 +72,7 @@ module Backup
end
end
report_success
(
success
)
report_success
(
success
)
abort
'Restore failed'
unless
success
abort
Backup
::
Error
,
'Restore failed'
unless
success
end
end
protected
protected
...
...
lib/backup/files.rb
View file @
a0808df0
...
@@ -26,7 +26,7 @@ module Backup
...
@@ -26,7 +26,7 @@ module Backup
unless
status
.
zero?
unless
status
.
zero?
puts
output
puts
output
abort
'Backup failed'
raise
Backup
::
Error
,
'Backup failed'
end
end
run_pipeline!
([
%W(tar --exclude=lost+found -C
#{
@backup_files_dir
}
-cf - .)
,
%w(gzip -c -1)
],
out:
[
backup_tarball
,
'w'
,
0600
])
run_pipeline!
([
%W(tar --exclude=lost+found -C
#{
@backup_files_dir
}
-cf - .)
,
%w(gzip -c -1)
],
out:
[
backup_tarball
,
'w'
,
0600
])
...
@@ -39,7 +39,11 @@ module Backup
...
@@ -39,7 +39,11 @@ module Backup
def
restore
def
restore
backup_existing_files_dir
backup_existing_files_dir
run_pipeline!
([
%w(gzip -cd)
,
%W(tar --unlink-first --recursive-unlink -C
#{
app_files_dir
}
-xf -)
],
in:
backup_tarball
)
run_pipeline!
([
%w(gzip -cd)
,
%W(
#{
tar
}
--unlink-first --recursive-unlink -C
#{
app_files_dir
}
-xf -)
],
in:
backup_tarball
)
end
def
tar
system
(
*
%w[gtar --version]
,
out:
'/dev/null'
)
?
'gtar'
:
'tar'
end
end
def
backup_existing_files_dir
def
backup_existing_files_dir
...
@@ -61,7 +65,7 @@ module Backup
...
@@ -61,7 +65,7 @@ module Backup
def
run_pipeline!
(
cmd_list
,
options
=
{})
def
run_pipeline!
(
cmd_list
,
options
=
{})
status_list
=
Open3
.
pipeline
(
*
cmd_list
,
options
)
status_list
=
Open3
.
pipeline
(
*
cmd_list
,
options
)
abort
'Backup failed'
unless
status_list
.
compact
.
all?
(
&
:success?
)
raise
Backup
::
Error
,
'Backup failed'
unless
status_list
.
compact
.
all?
(
&
:success?
)
end
end
end
end
end
end
lib/backup/manager.rb
View file @
a0808df0
...
@@ -27,7 +27,7 @@ module Backup
...
@@ -27,7 +27,7 @@ module Backup
progress
.
puts
"done"
.
color
(
:green
)
progress
.
puts
"done"
.
color
(
:green
)
else
else
puts
"creating archive
#{
tar_file
}
failed"
.
color
(
:red
)
puts
"creating archive
#{
tar_file
}
failed"
.
color
(
:red
)
abort
'Backup failed'
raise
Backup
::
Error
,
'Backup failed'
end
end
upload
upload
...
@@ -52,7 +52,7 @@ module Backup
...
@@ -52,7 +52,7 @@ module Backup
progress
.
puts
"done"
.
color
(
:green
)
progress
.
puts
"done"
.
color
(
:green
)
else
else
puts
"uploading backup to
#{
remote_directory
}
failed"
.
color
(
:red
)
puts
"uploading backup to
#{
remote_directory
}
failed"
.
color
(
:red
)
abort
'Backup failed'
raise
Backup
::
Error
,
'Backup failed'
end
end
end
end
...
@@ -66,7 +66,7 @@ module Backup
...
@@ -66,7 +66,7 @@ module Backup
progress
.
puts
"done"
.
color
(
:green
)
progress
.
puts
"done"
.
color
(
:green
)
else
else
puts
"deleting tmp directory '
#{
dir
}
' failed"
.
color
(
:red
)
puts
"deleting tmp directory '
#{
dir
}
' failed"
.
color
(
:red
)
abort
'Backup failed'
raise
Backup
::
Error
,
'Backup failed'
end
end
end
end
end
end
...
...
lib/backup/repository.rb
View file @
a0808df0
...
@@ -17,7 +17,10 @@ module Backup
...
@@ -17,7 +17,10 @@ module Backup
Project
.
find_each
(
batch_size:
1000
)
do
|
project
|
Project
.
find_each
(
batch_size:
1000
)
do
|
project
|
progress
.
print
" *
#{
display_repo_path
(
project
)
}
... "
progress
.
print
" *
#{
display_repo_path
(
project
)
}
... "
path_to_project_repo
=
path_to_repo
(
project
)
path_to_project_repo
=
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
path_to_repo
(
project
)
end
path_to_project_bundle
=
path_to_bundle
(
project
)
path_to_project_bundle
=
path_to_bundle
(
project
)
# Create namespace dir or hashed path if missing
# Create namespace dir or hashed path if missing
...
@@ -51,7 +54,9 @@ module Backup
...
@@ -51,7 +54,9 @@ module Backup
end
end
wiki
=
ProjectWiki
.
new
(
project
)
wiki
=
ProjectWiki
.
new
(
project
)
path_to_wiki_repo
=
path_to_repo
(
wiki
)
path_to_wiki_repo
=
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
path_to_repo
(
wiki
)
end
path_to_wiki_bundle
=
path_to_bundle
(
wiki
)
path_to_wiki_bundle
=
path_to_bundle
(
wiki
)
if
File
.
exist?
(
path_to_wiki_repo
)
if
File
.
exist?
(
path_to_wiki_repo
)
...
@@ -111,7 +116,9 @@ module Backup
...
@@ -111,7 +116,9 @@ module Backup
# TODO: Need to find a way to do this for gitaly
# TODO: Need to find a way to do this for gitaly
# Gitaly migration issue: https://gitlab.com/gitlab-org/gitaly/issues/1195
# Gitaly migration issue: https://gitlab.com/gitlab-org/gitaly/issues/1195
in_path
(
path_to_tars
(
project
))
do
|
dir
|
in_path
(
path_to_tars
(
project
))
do
|
dir
|
path_to_project_repo
=
path_to_repo
(
project
)
path_to_project_repo
=
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
path_to_repo
(
project
)
end
cmd
=
%W(tar -xf
#{
path_to_tars
(
project
,
dir
)
}
-C
#{
path_to_project_repo
}
#{
dir
}
)
cmd
=
%W(tar -xf
#{
path_to_tars
(
project
,
dir
)
}
-C
#{
path_to_project_repo
}
#{
dir
}
)
output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
)
output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
)
...
...
lib/gitlab/git/repository.rb
View file @
a0808df0
...
@@ -109,7 +109,7 @@ module Gitlab
...
@@ -109,7 +109,7 @@ module Gitlab
end
end
def
==
(
other
)
def
==
(
other
)
path
==
other
.
path
[
storage
,
relative_path
]
==
[
other
.
storage
,
other
.
relative_path
]
end
end
def
path
def
path
...
...
lib/gitlab/import_export/repo_saver.rb
View file @
a0808df0
...
@@ -26,10 +26,6 @@ module Gitlab
...
@@ -26,10 +26,6 @@ module Gitlab
@shared
.
error
(
e
)
@shared
.
error
(
e
)
false
false
end
end
def
path_to_repo
@project
.
repository
.
path_to_repo
end
end
end
end
end
end
end
lib/gitlab/import_export/wiki_repo_saver.rb
View file @
a0808df0
...
@@ -22,12 +22,8 @@ module Gitlab
...
@@ -22,12 +22,8 @@ module Gitlab
"project.wiki.bundle"
"project.wiki.bundle"
end
end
def
path_to_repo
@wiki
.
repository
.
path_to_repo
end
def
wiki_repository_exists?
def
wiki_repository_exists?
File
.
exist?
(
@wiki
.
repository
.
path_to_repo
)
&&
!
@wiki
.
repository
.
empty?
@wiki
.
repository
.
exists?
&&
!
@wiki
.
repository
.
empty?
end
end
end
end
end
end
...
...
lib/gitlab/task_helpers.rb
View file @
a0808df0
...
@@ -128,6 +128,7 @@ module Gitlab
...
@@ -128,6 +128,7 @@ module Gitlab
end
end
def
all_repos
def
all_repos
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
Gitlab
.
config
.
repositories
.
storages
.
each_value
do
|
repository_storage
|
Gitlab
.
config
.
repositories
.
storages
.
each_value
do
|
repository_storage
|
IO
.
popen
(
%W(find
#{
repository_storage
.
legacy_disk_path
}
-mindepth 2 -type d -name *.git)
)
do
|
find
|
IO
.
popen
(
%W(find
#{
repository_storage
.
legacy_disk_path
}
-mindepth 2 -type d -name *.git)
)
do
|
find
|
find
.
each_line
do
|
path
|
find
.
each_line
do
|
path
|
...
@@ -136,6 +137,7 @@ module Gitlab
...
@@ -136,6 +137,7 @@ module Gitlab
end
end
end
end
end
end
end
def
repository_storage_paths_args
def
repository_storage_paths_args
Gitlab
.
config
.
repositories
.
storages
.
values
.
map
{
|
rs
|
rs
.
legacy_disk_path
}
Gitlab
.
config
.
repositories
.
storages
.
values
.
map
{
|
rs
|
rs
.
legacy_disk_path
}
...
...
lib/tasks/gitlab/cleanup.rake
View file @
a0808df0
...
@@ -12,7 +12,7 @@ namespace :gitlab do
...
@@ -12,7 +12,7 @@ namespace :gitlab do
namespaces
=
Namespace
.
pluck
(
:path
)
namespaces
=
Namespace
.
pluck
(
:path
)
namespaces
<<
HASHED_REPOSITORY_NAME
# add so that it will be ignored
namespaces
<<
HASHED_REPOSITORY_NAME
# add so that it will be ignored
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
repository_storage
|
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
repository_storage
|
git_base_path
=
repository_storage
.
legacy_disk_path
git_base_path
=
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
{
repository_storage
.
legacy_disk_path
}
all_dirs
=
Dir
.
glob
(
git_base_path
+
'/*'
)
all_dirs
=
Dir
.
glob
(
git_base_path
+
'/*'
)
puts
git_base_path
.
color
(
:yellow
)
puts
git_base_path
.
color
(
:yellow
)
...
@@ -54,7 +54,8 @@ namespace :gitlab do
...
@@ -54,7 +54,8 @@ namespace :gitlab do
move_suffix
=
"+orphaned+
#{
Time
.
now
.
to_i
}
"
move_suffix
=
"+orphaned+
#{
Time
.
now
.
to_i
}
"
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
repository_storage
|
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
repository_storage
|
repo_root
=
repository_storage
.
legacy_disk_path
repo_root
=
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
{
repository_storage
.
legacy_disk_path
}
# Look for global repos (legacy, depth 1) and normal repos (depth 2)
# Look for global repos (legacy, depth 1) and normal repos (depth 2)
IO
.
popen
(
%W(find
#{
repo_root
}
-mindepth 1 -maxdepth 2 -name *.git)
)
do
|
find
|
IO
.
popen
(
%W(find
#{
repo_root
}
-mindepth 1 -maxdepth 2 -name *.git)
)
do
|
find
|
find
.
each_line
do
|
path
|
find
.
each_line
do
|
path
|
...
...
spec/features/projects/import_export/import_file_spec.rb
View file @
a0808df0
...
@@ -87,12 +87,14 @@ feature 'Import/Export - project import integration test', :js do
...
@@ -87,12 +87,14 @@ feature 'Import/Export - project import integration test', :js do
def
wiki_exists?
(
project
)
def
wiki_exists?
(
project
)
wiki
=
ProjectWiki
.
new
(
project
)
wiki
=
ProjectWiki
.
new
(
project
)
File
.
exist?
(
wiki
.
repository
.
path_to_repo
)
&&
!
wiki
.
repository
.
empty?
wiki
.
repository
.
exists?
&&
!
wiki
.
repository
.
empty?
end
end
def
project_hook_exists?
(
project
)
def
project_hook_exists?
(
project
)
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
Gitlab
::
Git
::
Hook
.
new
(
'post-receive'
,
project
.
repository
.
raw_repository
).
exists?
Gitlab
::
Git
::
Hook
.
new
(
'post-receive'
,
project
.
repository
.
raw_repository
).
exists?
end
end
end
def
click_import_project_tab
def
click_import_project_tab
find
(
'#import-project-tab'
).
click
find
(
'#import-project-tab'
).
click
...
...
spec/lib/backup/files_spec.rb
View file @
a0808df0
...
@@ -46,7 +46,9 @@ describe Backup::Files do
...
@@ -46,7 +46,9 @@ describe Backup::Files do
end
end
it
'calls tar command with unlink'
do
it
'calls tar command with unlink'
do
expect
(
subject
).
to
receive
(
:run_pipeline!
).
with
([
%w(gzip -cd)
,
%w(tar --unlink-first --recursive-unlink -C /var/gitlab-registry -xf -)
],
any_args
)
expect
(
subject
).
to
receive
(
:tar
).
and_return
(
'blabla-tar'
)
expect
(
subject
).
to
receive
(
:run_pipeline!
).
with
([
%w(gzip -cd)
,
%w(blabla-tar --unlink-first --recursive-unlink -C /var/gitlab-registry -xf -)
],
any_args
)
subject
.
restore
subject
.
restore
end
end
end
end
...
...
spec/lib/backup/repository_spec.rb
View file @
a0808df0
...
@@ -34,9 +34,11 @@ describe Backup::Repository do
...
@@ -34,9 +34,11 @@ describe Backup::Repository do
let
(
:timestamp
)
{
Time
.
utc
(
2017
,
3
,
22
)
}
let
(
:timestamp
)
{
Time
.
utc
(
2017
,
3
,
22
)
}
let
(
:temp_dirs
)
do
let
(
:temp_dirs
)
do
Gitlab
.
config
.
repositories
.
storages
.
map
do
|
name
,
storage
|
Gitlab
.
config
.
repositories
.
storages
.
map
do
|
name
,
storage
|
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
File
.
join
(
storage
.
legacy_disk_path
,
'..'
,
'repositories.old.'
+
timestamp
.
to_i
.
to_s
)
File
.
join
(
storage
.
legacy_disk_path
,
'..'
,
'repositories.old.'
+
timestamp
.
to_i
.
to_s
)
end
end
end
end
end
around
do
|
example
|
around
do
|
example
|
Timecop
.
freeze
(
timestamp
)
{
example
.
run
}
Timecop
.
freeze
(
timestamp
)
{
example
.
run
}
...
...
spec/lib/gitlab/bare_repository_import/importer_spec.rb
View file @
a0808df0
...
@@ -20,6 +20,13 @@ describe Gitlab::BareRepositoryImport::Importer, repository: true do
...
@@ -20,6 +20,13 @@ describe Gitlab::BareRepositoryImport::Importer, repository: true do
Rainbow
.
enabled
=
@rainbow
Rainbow
.
enabled
=
@rainbow
end
end
around
do
|
example
|
# TODO migrate BareRepositoryImport https://gitlab.com/gitlab-org/gitaly/issues/953
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
example
.
run
end
end
shared_examples
'importing a repository'
do
shared_examples
'importing a repository'
do
describe
'.execute'
do
describe
'.execute'
do
it
'creates a project for a repository in storage'
do
it
'creates a project for a repository in storage'
do
...
...
spec/lib/gitlab/bare_repository_import/repository_spec.rb
View file @
a0808df0
...
@@ -62,9 +62,11 @@ describe ::Gitlab::BareRepositoryImport::Repository do
...
@@ -62,9 +62,11 @@ describe ::Gitlab::BareRepositoryImport::Repository do
before
do
before
do
gitlab_shell
.
create_repository
(
repository_storage
,
hashed_path
)
gitlab_shell
.
create_repository
(
repository_storage
,
hashed_path
)
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
repository
=
Rugged
::
Repository
.
new
(
repo_path
)
repository
=
Rugged
::
Repository
.
new
(
repo_path
)
repository
.
config
[
'gitlab.fullpath'
]
=
'to/repo'
repository
.
config
[
'gitlab.fullpath'
]
=
'to/repo'
end
end
end
after
do
after
do
gitlab_shell
.
remove_repository
(
repository_storage
,
hashed_path
)
gitlab_shell
.
remove_repository
(
repository_storage
,
hashed_path
)
...
...
spec/lib/gitlab/git/repository_spec.rb
View file @
a0808df0
...
@@ -159,6 +159,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
...
@@ -159,6 +159,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
let
(
:feature2
)
{
'feature2'
}
let
(
:feature2
)
{
'feature2'
}
around
do
|
example
|
around
do
|
example
|
# discover_default_branch will be moved to gitaly-ruby
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
example
.
run
example
.
run
end
end
...
@@ -373,6 +374,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
...
@@ -373,6 +374,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
context
'#submodules'
do
context
'#submodules'
do
around
do
|
example
|
around
do
|
example
|
# TODO #submodules will be removed, has been migrated to gitaly
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
example
.
run
example
.
run
end
end
...
@@ -1055,6 +1057,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
...
@@ -1055,6 +1057,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
describe
"#rugged_commits_between"
do
describe
"#rugged_commits_between"
do
around
do
|
example
|
around
do
|
example
|
# TODO #rugged_commits_between will be removed, has been migrated to gitaly
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
example
.
run
example
.
run
end
end
...
@@ -1703,6 +1706,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
...
@@ -1703,6 +1706,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
let
(
:refs
)
{
[
'deadbeef'
,
SeedRepo
::
RubyBlob
::
ID
,
'909e6157199'
]
}
let
(
:refs
)
{
[
'deadbeef'
,
SeedRepo
::
RubyBlob
::
ID
,
'909e6157199'
]
}
around
do
|
example
|
around
do
|
example
|
# TODO #batch_existence isn't used anywhere, can we remove it?
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
example
.
run
example
.
run
end
end
...
...
spec/lib/gitlab/git/rev_list_spec.rb
View file @
a0808df0
...
@@ -9,9 +9,11 @@ describe Gitlab::Git::RevList do
...
@@ -9,9 +9,11 @@ describe Gitlab::Git::RevList do
end
end
def
stub_popen_rev_list
(
*
additional_args
,
with_lazy_block:
true
,
output
:)
def
stub_popen_rev_list
(
*
additional_args
,
with_lazy_block:
true
,
output
:)
repo_path
=
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
{
repository
.
path
}
params
=
[
params
=
[
args_for_popen
(
additional_args
),
args_for_popen
(
additional_args
),
repo
sitory
.
path
,
repo
_
path
,
{},
{},
hash_including
(
lazy_block:
with_lazy_block
?
anything
:
nil
)
hash_including
(
lazy_block:
with_lazy_block
?
anything
:
nil
)
]
]
...
...
spec/lib/gitlab/git_access_spec.rb
View file @
a0808df0
...
@@ -552,7 +552,7 @@ describe Gitlab::GitAccess do
...
@@ -552,7 +552,7 @@ describe Gitlab::GitAccess do
it
'returns not found'
do
it
'returns not found'
do
project
.
add_guest
(
user
)
project
.
add_guest
(
user
)
repo
=
project
.
repository
repo
=
project
.
repository
FileUtils
.
rm_rf
(
repo
.
path
)
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
{
FileUtils
.
rm_rf
(
repo
.
path
)
}
# Sanity check for rm_rf
# Sanity check for rm_rf
expect
(
repo
.
exists?
).
to
eq
(
false
)
expect
(
repo
.
exists?
).
to
eq
(
false
)
...
@@ -750,6 +750,7 @@ describe Gitlab::GitAccess do
...
@@ -750,6 +750,7 @@ describe Gitlab::GitAccess do
def
merge_into_protected_branch
def
merge_into_protected_branch
@protected_branch_merge_commit
||=
begin
@protected_branch_merge_commit
||=
begin
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
stub_git_hooks
stub_git_hooks
project
.
repository
.
add_branch
(
user
,
unprotected_branch
,
'feature'
)
project
.
repository
.
add_branch
(
user
,
unprotected_branch
,
'feature'
)
target_branch
=
project
.
repository
.
lookup
(
'feature'
)
target_branch
=
project
.
repository
.
lookup
(
'feature'
)
...
@@ -766,6 +767,7 @@ describe Gitlab::GitAccess do
...
@@ -766,6 +767,7 @@ describe Gitlab::GitAccess do
Rugged
::
Commit
.
create
(
rugged
,
author:
author
,
committer:
author
,
message:
"commit message"
,
parents:
[
target_branch
,
source_branch
],
tree:
merge_index
.
write_tree
(
rugged
))
Rugged
::
Commit
.
create
(
rugged
,
author:
author
,
committer:
author
,
message:
"commit message"
,
parents:
[
target_branch
,
source_branch
],
tree:
merge_index
.
write_tree
(
rugged
))
end
end
end
end
end
def
self
.
run_permission_checks
(
permissions_matrix
)
def
self
.
run_permission_checks
(
permissions_matrix
)
permissions_matrix
.
each_pair
do
|
role
,
matrix
|
permissions_matrix
.
each_pair
do
|
role
,
matrix
|
...
...
spec/lib/gitlab/import_export/fork_spec.rb
View file @
a0808df0
...
@@ -41,9 +41,11 @@ describe 'forked project import' do
...
@@ -41,9 +41,11 @@ describe 'forked project import' do
after
do
after
do
FileUtils
.
rm_rf
(
export_path
)
FileUtils
.
rm_rf
(
export_path
)
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
FileUtils
.
rm_rf
(
project_with_repo
.
repository
.
path_to_repo
)
FileUtils
.
rm_rf
(
project_with_repo
.
repository
.
path_to_repo
)
FileUtils
.
rm_rf
(
project
.
repository
.
path_to_repo
)
FileUtils
.
rm_rf
(
project
.
repository
.
path_to_repo
)
end
end
end
it
'can access the MR'
do
it
'can access the MR'
do
project
.
merge_requests
.
first
.
fetch_ref!
project
.
merge_requests
.
first
.
fetch_ref!
...
...
spec/lib/gitlab/import_export/repo_restorer_spec.rb
View file @
a0808df0
...
@@ -23,9 +23,11 @@ describe Gitlab::ImportExport::RepoRestorer do
...
@@ -23,9 +23,11 @@ describe Gitlab::ImportExport::RepoRestorer do
after
do
after
do
FileUtils
.
rm_rf
(
export_path
)
FileUtils
.
rm_rf
(
export_path
)
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
FileUtils
.
rm_rf
(
project_with_repo
.
repository
.
path_to_repo
)
FileUtils
.
rm_rf
(
project_with_repo
.
repository
.
path_to_repo
)
FileUtils
.
rm_rf
(
project
.
repository
.
path_to_repo
)
FileUtils
.
rm_rf
(
project
.
repository
.
path_to_repo
)
end
end
end
it
'restores the repo successfully'
do
it
'restores the repo successfully'
do
expect
(
restorer
.
restore
).
to
be
true
expect
(
restorer
.
restore
).
to
be
true
...
@@ -34,7 +36,9 @@ describe Gitlab::ImportExport::RepoRestorer do
...
@@ -34,7 +36,9 @@ describe Gitlab::ImportExport::RepoRestorer do
it
'has the webhooks'
do
it
'has the webhooks'
do
restorer
.
restore
restorer
.
restore
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
expect
(
Gitlab
::
Git
::
Hook
.
new
(
'post-receive'
,
project
.
repository
.
raw_repository
)).
to
exist
expect
(
Gitlab
::
Git
::
Hook
.
new
(
'post-receive'
,
project
.
repository
.
raw_repository
)).
to
exist
end
end
end
end
end
end
end
spec/lib/gitlab/shell_spec.rb
View file @
a0808df0
...
@@ -405,7 +405,11 @@ describe Gitlab::Shell do
...
@@ -405,7 +405,11 @@ describe Gitlab::Shell do
describe
'#create_repository'
do
describe
'#create_repository'
do
shared_examples
'#create_repository'
do
shared_examples
'#create_repository'
do
let
(
:repository_storage
)
{
'default'
}
let
(
:repository_storage
)
{
'default'
}
let
(
:repository_storage_path
)
{
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
].
legacy_disk_path
}
let
(
:repository_storage_path
)
do
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
].
legacy_disk_path
end
end
let
(
:repo_name
)
{
'project/path'
}
let
(
:repo_name
)
{
'project/path'
}
let
(
:created_path
)
{
File
.
join
(
repository_storage_path
,
repo_name
+
'.git'
)
}
let
(
:created_path
)
{
File
.
join
(
repository_storage_path
,
repo_name
+
'.git'
)
}
...
...
spec/models/merge_request_spec.rb
View file @
a0808df0
...
@@ -16,7 +16,11 @@ describe MergeRequest do
...
@@ -16,7 +16,11 @@ describe MergeRequest do
describe
'#squash_in_progress?'
do
describe
'#squash_in_progress?'
do
shared_examples
'checking whether a squash is in progress'
do
shared_examples
'checking whether a squash is in progress'
do
let
(
:repo_path
)
{
subject
.
source_project
.
repository
.
path
}
let
(
:repo_path
)
do
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
subject
.
source_project
.
repository
.
path
end
end
let
(
:squash_path
)
{
File
.
join
(
repo_path
,
"gitlab-worktree"
,
"squash-
#{
subject
.
id
}
"
)
}
let
(
:squash_path
)
{
File
.
join
(
repo_path
,
"gitlab-worktree"
,
"squash-
#{
subject
.
id
}
"
)
}
before
do
before
do
...
@@ -2197,7 +2201,11 @@ describe MergeRequest do
...
@@ -2197,7 +2201,11 @@ describe MergeRequest do
describe
'#rebase_in_progress?'
do
describe
'#rebase_in_progress?'
do
shared_examples
'checking whether a rebase is in progress'
do
shared_examples
'checking whether a rebase is in progress'
do
let
(
:repo_path
)
{
subject
.
source_project
.
repository
.
path
}
let
(
:repo_path
)
do
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
subject
.
source_project
.
repository
.
path
end
end
let
(
:rebase_path
)
{
File
.
join
(
repo_path
,
"gitlab-worktree"
,
"rebase-
#{
subject
.
id
}
"
)
}
let
(
:rebase_path
)
{
File
.
join
(
repo_path
,
"gitlab-worktree"
,
"rebase-
#{
subject
.
id
}
"
)
}
before
do
before
do
...
...
spec/models/namespace_spec.rb
View file @
a0808df0
...
@@ -301,12 +301,18 @@ describe Namespace do
...
@@ -301,12 +301,18 @@ describe Namespace do
end
end
def
project_rugged
(
project
)
def
project_rugged
(
project
)
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
project
.
repository
.
rugged
project
.
repository
.
rugged
end
end
end
end
end
describe
'#rm_dir'
,
'callback'
do
describe
'#rm_dir'
,
'callback'
do
let
(
:repository_storage_path
)
{
Gitlab
.
config
.
repositories
.
storages
.
default
.
legacy_disk_path
}
let
(
:repository_storage_path
)
do
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
Gitlab
.
config
.
repositories
.
storages
.
default
.
legacy_disk_path
end
end
let
(
:path_in_dir
)
{
File
.
join
(
repository_storage_path
,
namespace
.
full_path
)
}
let
(
:path_in_dir
)
{
File
.
join
(
repository_storage_path
,
namespace
.
full_path
)
}
let
(
:deleted_path
)
{
namespace
.
full_path
.
gsub
(
namespace
.
path
,
"
#{
namespace
.
full_path
}
+
#{
namespace
.
id
}
+deleted"
)
}
let
(
:deleted_path
)
{
namespace
.
full_path
.
gsub
(
namespace
.
path
,
"
#{
namespace
.
full_path
}
+
#{
namespace
.
id
}
+deleted"
)
}
let
(
:deleted_path_in_dir
)
{
File
.
join
(
repository_storage_path
,
deleted_path
)
}
let
(
:deleted_path_in_dir
)
{
File
.
join
(
repository_storage_path
,
deleted_path
)
}
...
...
spec/models/repository_spec.rb
View file @
a0808df0
...
@@ -136,7 +136,10 @@ describe Repository do
...
@@ -136,7 +136,10 @@ describe Repository do
before
do
before
do
options
=
{
message:
'test tag message\n'
,
options
=
{
message:
'test tag message\n'
,
tagger:
{
name:
'John Smith'
,
email:
'john@gmail.com'
}
}
tagger:
{
name:
'John Smith'
,
email:
'john@gmail.com'
}
}
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
repository
.
rugged
.
tags
.
create
(
annotated_tag_name
,
'a48e4fc218069f68ef2e769dd8dfea3991362175'
,
options
)
repository
.
rugged
.
tags
.
create
(
annotated_tag_name
,
'a48e4fc218069f68ef2e769dd8dfea3991362175'
,
options
)
end
double_first
=
double
(
committed_date:
Time
.
now
-
1
.
second
)
double_first
=
double
(
committed_date:
Time
.
now
-
1
.
second
)
double_last
=
double
(
committed_date:
Time
.
now
)
double_last
=
double
(
committed_date:
Time
.
now
)
...
@@ -1048,6 +1051,13 @@ describe Repository do
...
@@ -1048,6 +1051,13 @@ describe Repository do
let
(
:target_project
)
{
project
}
let
(
:target_project
)
{
project
}
let
(
:target_repository
)
{
target_project
.
repository
}
let
(
:target_repository
)
{
target_project
.
repository
}
around
do
|
example
|
# TODO Gitlab::Git::OperationService will be moved to gitaly-ruby and disappear from this repo
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
example
.
run
end
end
context
'when pre hooks were successful'
do
context
'when pre hooks were successful'
do
before
do
before
do
service
=
Gitlab
::
Git
::
HooksService
.
new
service
=
Gitlab
::
Git
::
HooksService
.
new
...
@@ -1309,6 +1319,13 @@ describe Repository do
...
@@ -1309,6 +1319,13 @@ describe Repository do
end
end
describe
'#update_autocrlf_option'
do
describe
'#update_autocrlf_option'
do
around
do
|
example
|
# TODO Gitlab::Git::OperationService will be moved to gitaly-ruby and disappear from this repo
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
example
.
run
end
end
describe
'when autocrlf is not already set to :input'
do
describe
'when autocrlf is not already set to :input'
do
before
do
before
do
repository
.
raw_repository
.
autocrlf
=
true
repository
.
raw_repository
.
autocrlf
=
true
...
@@ -1802,7 +1819,9 @@ describe Repository do
...
@@ -1802,7 +1819,9 @@ describe Repository do
expect
(
repository
.
branch_count
).
to
be_an
(
Integer
)
expect
(
repository
.
branch_count
).
to
be_an
(
Integer
)
# NOTE: Until rugged goes away, make sure rugged and gitaly are in sync
# NOTE: Until rugged goes away, make sure rugged and gitaly are in sync
rugged_count
=
repository
.
raw_repository
.
rugged
.
branches
.
count
rugged_count
=
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
repository
.
raw_repository
.
rugged
.
branches
.
count
end
expect
(
repository
.
branch_count
).
to
eq
(
rugged_count
)
expect
(
repository
.
branch_count
).
to
eq
(
rugged_count
)
end
end
...
@@ -1813,7 +1832,9 @@ describe Repository do
...
@@ -1813,7 +1832,9 @@ describe Repository do
expect
(
repository
.
tag_count
).
to
be_an
(
Integer
)
expect
(
repository
.
tag_count
).
to
be_an
(
Integer
)
# NOTE: Until rugged goes away, make sure rugged and gitaly are in sync
# NOTE: Until rugged goes away, make sure rugged and gitaly are in sync
rugged_count
=
repository
.
raw_repository
.
rugged
.
tags
.
count
rugged_count
=
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
repository
.
raw_repository
.
rugged
.
tags
.
count
end
expect
(
repository
.
tag_count
).
to
eq
(
rugged_count
)
expect
(
repository
.
tag_count
).
to
eq
(
rugged_count
)
end
end
...
@@ -2073,7 +2094,10 @@ describe Repository do
...
@@ -2073,7 +2094,10 @@ describe Repository do
it
"attempting to call keep_around on truncated ref does not fail"
do
it
"attempting to call keep_around on truncated ref does not fail"
do
repository
.
keep_around
(
sample_commit
.
id
)
repository
.
keep_around
(
sample_commit
.
id
)
ref
=
repository
.
send
(
:keep_around_ref_name
,
sample_commit
.
id
)
ref
=
repository
.
send
(
:keep_around_ref_name
,
sample_commit
.
id
)
path
=
File
.
join
(
repository
.
path
,
ref
)
path
=
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
File
.
join
(
repository
.
path
,
ref
)
end
# Corrupt the reference
# Corrupt the reference
File
.
truncate
(
path
,
0
)
File
.
truncate
(
path
,
0
)
...
@@ -2088,6 +2112,13 @@ describe Repository do
...
@@ -2088,6 +2112,13 @@ describe Repository do
end
end
describe
'#update_ref'
do
describe
'#update_ref'
do
around
do
|
example
|
# TODO Gitlab::Git::OperationService will be moved to gitaly-ruby and disappear from this repo
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
example
.
run
end
end
it
'can create a ref'
do
it
'can create a ref'
do
Gitlab
::
Git
::
OperationService
.
new
(
nil
,
repository
.
raw_repository
).
send
(
:update_ref
,
'refs/heads/foobar'
,
'refs/heads/master'
,
Gitlab
::
Git
::
BLANK_SHA
)
Gitlab
::
Git
::
OperationService
.
new
(
nil
,
repository
.
raw_repository
).
send
(
:update_ref
,
'refs/heads/foobar'
,
'refs/heads/master'
,
Gitlab
::
Git
::
BLANK_SHA
)
...
@@ -2372,7 +2403,9 @@ describe Repository do
...
@@ -2372,7 +2403,9 @@ describe Repository do
end
end
def
create_remote_branch
(
remote_name
,
branch_name
,
target
)
def
create_remote_branch
(
remote_name
,
branch_name
,
target
)
rugged
=
repository
.
rugged
rugged
=
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
repository
.
rugged
end
rugged
.
references
.
create
(
"refs/remotes/
#{
remote_name
}
/
#{
branch_name
}
"
,
target
.
id
)
rugged
.
references
.
create
(
"refs/remotes/
#{
remote_name
}
/
#{
branch_name
}
"
,
target
.
id
)
end
end
...
...
spec/requests/api/tags_spec.rb
View file @
a0808df0
...
@@ -287,7 +287,10 @@ describe API::Tags do
...
@@ -287,7 +287,10 @@ describe API::Tags do
context
'annotated tag'
do
context
'annotated tag'
do
it
'creates a new annotated tag'
do
it
'creates a new annotated tag'
do
# Identity must be set in .gitconfig to create annotated tag.
# Identity must be set in .gitconfig to create annotated tag.
repo_path
=
project
.
repository
.
path_to_repo
repo_path
=
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
project
.
repository
.
path_to_repo
end
system
(
*
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
--git-dir=
#{
repo_path
}
config user.name
#{
user
.
name
}
)
)
system
(
*
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
--git-dir=
#{
repo_path
}
config user.name
#{
user
.
name
}
)
)
system
(
*
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
--git-dir=
#{
repo_path
}
config user.email
#{
user
.
email
}
)
)
system
(
*
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
--git-dir=
#{
repo_path
}
config user.email
#{
user
.
email
}
)
)
...
...
spec/services/projects/transfer_service_spec.rb
View file @
a0808df0
...
@@ -64,7 +64,7 @@ describe Projects::TransferService do
...
@@ -64,7 +64,7 @@ describe Projects::TransferService do
it
'updates project full path in .git/config'
do
it
'updates project full path in .git/config'
do
transfer_project
(
project
,
user
,
group
)
transfer_project
(
project
,
user
,
group
)
expect
(
project
.
repository
.
rugged
.
config
[
'gitlab.fullpath'
]).
to
eq
"
#{
group
.
full_path
}
/
#{
project
.
path
}
"
expect
(
rugged_
config
[
'gitlab.fullpath'
]).
to
eq
"
#{
group
.
full_path
}
/
#{
project
.
path
}
"
end
end
end
end
...
@@ -84,8 +84,10 @@ describe Projects::TransferService do
...
@@ -84,8 +84,10 @@ describe Projects::TransferService do
end
end
def
project_path
(
project
)
def
project_path
(
project
)
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
project
.
repository
.
path_to_repo
project
.
repository
.
path_to_repo
end
end
end
def
current_path
def
current_path
project_path
(
project
)
project_path
(
project
)
...
@@ -101,7 +103,7 @@ describe Projects::TransferService do
...
@@ -101,7 +103,7 @@ describe Projects::TransferService do
it
'rolls back project full path in .git/config'
do
it
'rolls back project full path in .git/config'
do
attempt_project_transfer
attempt_project_transfer
expect
(
project
.
repository
.
rugged
.
config
[
'gitlab.fullpath'
]).
to
eq
project
.
full_path
expect
(
rugged_
config
[
'gitlab.fullpath'
]).
to
eq
project
.
full_path
end
end
it
"doesn't send move notifications"
do
it
"doesn't send move notifications"
do
...
@@ -264,4 +266,10 @@ describe Projects::TransferService do
...
@@ -264,4 +266,10 @@ describe Projects::TransferService do
transfer_project
(
project
,
owner
,
group
)
transfer_project
(
project
,
owner
,
group
)
end
end
end
end
def
rugged_config
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
project
.
repository
.
rugged
.
config
end
end
end
end
spec/services/projects/update_service_spec.rb
View file @
a0808df0
...
@@ -125,7 +125,7 @@ describe Projects::UpdateService do
...
@@ -125,7 +125,7 @@ describe Projects::UpdateService do
context
'when we update project but not enabling a wiki'
do
context
'when we update project but not enabling a wiki'
do
it
'does not try to create an empty wiki'
do
it
'does not try to create an empty wiki'
do
FileUtils
.
rm_rf
(
project
.
wiki
.
repository
.
path
)
Gitlab
::
Shell
.
new
.
rm_directory
(
project
.
repository_storage
,
project
.
wiki
.
path
)
result
=
update_project
(
project
,
user
,
{
name:
'test1'
})
result
=
update_project
(
project
,
user
,
{
name:
'test1'
})
...
@@ -146,7 +146,7 @@ describe Projects::UpdateService do
...
@@ -146,7 +146,7 @@ describe Projects::UpdateService do
context
'when enabling a wiki'
do
context
'when enabling a wiki'
do
it
'creates a wiki'
do
it
'creates a wiki'
do
project
.
project_feature
.
update
(
wiki_access_level:
ProjectFeature
::
DISABLED
)
project
.
project_feature
.
update
(
wiki_access_level:
ProjectFeature
::
DISABLED
)
FileUtils
.
rm_rf
(
project
.
wiki
.
repository
.
path
)
Gitlab
::
Shell
.
new
.
rm_directory
(
project
.
repository_storage
,
project
.
wiki
.
path
)
result
=
update_project
(
project
,
user
,
project_feature_attributes:
{
wiki_access_level:
ProjectFeature
::
ENABLED
})
result
=
update_project
(
project
,
user
,
project_feature_attributes:
{
wiki_access_level:
ProjectFeature
::
ENABLED
})
...
...
spec/support/helpers/cycle_analytics_helpers.rb
View file @
a0808df0
...
@@ -123,7 +123,11 @@ module CycleAnalyticsHelpers
...
@@ -123,7 +123,11 @@ module CycleAnalyticsHelpers
if
branch_update
.
newrev
if
branch_update
.
newrev
_
,
opts
=
args
_
,
opts
=
args
commit
=
raw_repository
.
commit
(
branch_update
.
newrev
).
rugged_commit
commit
=
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
raw_repository
.
commit
(
branch_update
.
newrev
).
rugged_commit
end
branch_update
.
newrev
=
commit
.
amend
(
branch_update
.
newrev
=
commit
.
amend
(
update_ref:
"
#{
Gitlab
::
Git
::
BRANCH_REF_PREFIX
}#{
opts
[
:branch_name
]
}
"
,
update_ref:
"
#{
Gitlab
::
Git
::
BRANCH_REF_PREFIX
}#{
opts
[
:branch_name
]
}
"
,
author:
commit
.
author
.
merge
(
time:
new_date
),
author:
commit
.
author
.
merge
(
time:
new_date
),
...
...
spec/tasks/gitlab/backup_rake_spec.rb
View file @
a0808df0
...
@@ -101,7 +101,9 @@ describe 'gitlab:app namespace rake task' do
...
@@ -101,7 +101,9 @@ describe 'gitlab:app namespace rake task' do
before
do
before
do
stub_env
(
'SKIP'
,
'db'
)
stub_env
(
'SKIP'
,
'db'
)
path
=
File
.
join
(
project
.
repository
.
path_to_repo
,
'custom_hooks'
)
path
=
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
File
.
join
(
project
.
repository
.
path_to_repo
,
'custom_hooks'
)
end
FileUtils
.
mkdir_p
(
path
)
FileUtils
.
mkdir_p
(
path
)
FileUtils
.
touch
(
File
.
join
(
path
,
"dummy.txt"
))
FileUtils
.
touch
(
File
.
join
(
path
,
"dummy.txt"
))
end
end
...
@@ -122,7 +124,10 @@ describe 'gitlab:app namespace rake task' do
...
@@ -122,7 +124,10 @@ describe 'gitlab:app namespace rake task' do
expect
{
run_rake_task
(
'gitlab:backup:create'
)
}.
to
output
.
to_stdout
expect
{
run_rake_task
(
'gitlab:backup:create'
)
}.
to
output
.
to_stdout
expect
{
run_rake_task
(
'gitlab:backup:restore'
)
}.
to
output
.
to_stdout
expect
{
run_rake_task
(
'gitlab:backup:restore'
)
}.
to
output
.
to_stdout
expect
(
Dir
.
entries
(
File
.
join
(
project
.
repository
.
path
,
'custom_hooks'
))).
to
include
(
"dummy.txt"
)
repo_path
=
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
project
.
repository
.
path
end
expect
(
Dir
.
entries
(
File
.
join
(
repo_path
,
'custom_hooks'
))).
to
include
(
"dummy.txt"
)
end
end
end
end
...
@@ -243,10 +248,12 @@ describe 'gitlab:app namespace rake task' do
...
@@ -243,10 +248,12 @@ describe 'gitlab:app namespace rake task' do
FileUtils
.
mkdir_p
(
b_storage_dir
)
FileUtils
.
mkdir_p
(
b_storage_dir
)
# Even when overriding the storage, we have to move it there, so it exists
# Even when overriding the storage, we have to move it there, so it exists
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
FileUtils
.
mv
(
FileUtils
.
mv
(
File
.
join
(
Settings
.
absolute
(
storages
[
'default'
].
legacy_disk_path
),
project_b
.
repository
.
disk_path
+
'.git'
),
File
.
join
(
Settings
.
absolute
(
storages
[
'default'
].
legacy_disk_path
),
project_b
.
repository
.
disk_path
+
'.git'
),
Rails
.
root
.
join
(
storages
[
'test_second_storage'
].
legacy_disk_path
,
project_b
.
repository
.
disk_path
+
'.git'
)
Rails
.
root
.
join
(
storages
[
'test_second_storage'
].
legacy_disk_path
,
project_b
.
repository
.
disk_path
+
'.git'
)
)
)
end
expect
{
run_rake_task
(
'gitlab:backup:create'
)
}.
to
output
.
to_stdout
expect
{
run_rake_task
(
'gitlab:backup:create'
)
}.
to
output
.
to_stdout
...
...
spec/workers/repository_check/single_repository_worker_spec.rb
View file @
a0808df0
...
@@ -88,16 +88,20 @@ describe RepositoryCheck::SingleRepositoryWorker do
...
@@ -88,16 +88,20 @@ describe RepositoryCheck::SingleRepositoryWorker do
end
end
def
break_wiki
(
project
)
def
break_wiki
(
project
)
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
break_repo
(
wiki_path
(
project
))
break_repo
(
wiki_path
(
project
))
end
end
end
def
wiki_path
(
project
)
def
wiki_path
(
project
)
project
.
wiki
.
repository
.
path_to_repo
project
.
wiki
.
repository
.
path_to_repo
end
end
def
break_project
(
project
)
def
break_project
(
project
)
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
break_repo
(
project
.
repository
.
path_to_repo
)
break_repo
(
project
.
repository
.
path_to_repo
)
end
end
end
def
break_repo
(
repo
)
def
break_repo
(
repo
)
# Create or replace blob ffffffffffffffffffffffffffffffffffffffff with an empty file
# Create or replace blob ffffffffffffffffffffffffffffffffffffffff with an empty file
...
...
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