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
8c2e2e1c
Commit
8c2e2e1c
authored
Jul 09, 2018
by
Jacob Vosmaer (GitLab)
Committed by
Nick Thomas
Jul 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use gitaly to set/unset git config
parent
46cae736
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
8 deletions
+34
-8
ee/app/models/ee/repository.rb
ee/app/models/ee/repository.rb
+2
-7
ee/spec/models/repository_spec.rb
ee/spec/models/repository_spec.rb
+27
-0
ee/spec/services/geo/repository_sync_service_spec.rb
ee/spec/services/geo/repository_sync_service_spec.rb
+5
-1
No files found.
ee/app/models/ee/repository.rb
View file @
8c2e2e1c
...
...
@@ -11,17 +11,12 @@ module EE
end
# Transiently sets a configuration variable
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/1241
def
with_config
(
values
=
{})
::
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
values
.
each
{
|
k
,
v
|
rugged
.
config
[
k
]
=
v
}
end
raw_repository
.
set_config
(
values
)
yield
ensure
::
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
values
.
keys
.
each
{
|
key
|
rugged
.
config
.
delete
(
key
)
}
end
raw_repository
.
delete_config
(
*
values
.
keys
)
end
# Runs code after a repository has been synced.
...
...
ee/spec/models/repository_spec.rb
View file @
8c2e2e1c
...
...
@@ -34,6 +34,33 @@ describe Repository do
end
end
describe
'#with_config'
do
let
(
:rugged
)
do
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
repository
.
rugged
end
end
let
(
:entries
)
{
{
'test.foo1'
=>
'hello'
,
'test.foo2'
=>
'world'
}
}
it
'sets config only during the block'
do
keys_should_not_be_set
repository
.
with_config
(
entries
)
do
entries
.
each
do
|
key
,
value
|
expect
(
rugged
.
config
[
key
]).
to
eq
(
value
)
end
end
keys_should_not_be_set
end
def
keys_should_not_be_set
entries
.
each
do
|
key
,
value
|
expect
(
rugged
.
config
[
key
]).
to
be_blank
end
end
end
describe
"Elastic search"
,
:elastic
do
before
do
stub_ee_application_setting
(
elasticsearch_search:
true
,
elasticsearch_indexing:
true
)
...
...
ee/spec/services/geo/repository_sync_service_spec.rb
View file @
8c2e2e1c
...
...
@@ -283,7 +283,11 @@ describe Geo::RepositorySyncService do
subject
.
execute
expect
(
File
.
directory?
(
project
.
repository
.
path
)).
to
be
true
repo_path
=
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
project
.
repository
.
path
end
expect
(
File
.
directory?
(
repo_path
)).
to
be
true
end
it
'tries to redownload repo when force_redownload flag is set'
do
...
...
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