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
08554787
Commit
08554787
authored
Jun 25, 2018
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Write Config is mandatory
Closes
https://gitlab.com/gitlab-org/gitaly/issues/879
parent
901159bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
40 deletions
+24
-40
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+3
-9
spec/lib/gitlab/git/repository_spec.rb
spec/lib/gitlab/git/repository_spec.rb
+21
-31
No files found.
lib/gitlab/git/repository.rb
View file @
08554787
...
...
@@ -1268,16 +1268,10 @@ module Gitlab
return
unless
full_path
.
present?
# This guard avoids Gitaly log/error spam
unless
exists?
raise
NoRepository
,
'repository does not exist'
end
raise
NoRepository
,
'repository does not exist'
unless
exists?
gitaly_migrate
(
:write_config
)
do
|
is_enabled
|
if
is_enabled
gitaly_repository_client
.
write_config
(
full_path:
full_path
)
else
rugged_write_config
(
full_path:
full_path
)
end
wrapped_gitaly_errors
do
gitaly_repository_client
.
write_config
(
full_path:
full_path
)
end
end
...
...
spec/lib/gitlab/git/repository_spec.rb
View file @
08554787
...
...
@@ -1871,49 +1871,39 @@ describe Gitlab::Git::Repository, seed_helper: true do
repository_rugged
.
config
[
"gitlab.fullpath"
]
=
repository_path
end
shared_examples
'writing repo config'
do
context
'is given a path'
do
it
'writes it to disk'
do
repository
.
write_config
(
full_path:
"not-the/real-path.git"
)
context
'is given a path'
do
it
'writes it to disk'
do
repository
.
write_config
(
full_path:
"not-the/real-path.git"
)
config
=
File
.
read
(
File
.
join
(
repository_path
,
"config"
))
config
=
File
.
read
(
File
.
join
(
repository_path
,
"config"
))
expect
(
config
).
to
include
(
"[gitlab]"
)
expect
(
config
).
to
include
(
"fullpath = not-the/real-path.git"
)
end
expect
(
config
).
to
include
(
"[gitlab]"
)
expect
(
config
).
to
include
(
"fullpath = not-the/real-path.git"
)
end
end
context
'it is given an empty path'
do
it
'does not write it to disk'
do
repository
.
write_config
(
full_path:
""
)
context
'it is given an empty path'
do
it
'does not write it to disk'
do
repository
.
write_config
(
full_path:
""
)
config
=
File
.
read
(
File
.
join
(
repository_path
,
"config"
))
config
=
File
.
read
(
File
.
join
(
repository_path
,
"config"
))
expect
(
config
).
to
include
(
"[gitlab]"
)
expect
(
config
).
to
include
(
"fullpath =
#{
repository_path
}
"
)
end
expect
(
config
).
to
include
(
"[gitlab]"
)
expect
(
config
).
to
include
(
"fullpath =
#{
repository_path
}
"
)
end
end
context
'repository does not exist'
do
it
'raises NoRepository and does not call Gitaly WriteConfig'
do
repository
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
'does/not/exist.git'
,
''
)
context
'repository does not exist'
do
it
'raises NoRepository and does not call Gitaly WriteConfig'
do
repository
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
'does/not/exist.git'
,
''
)
expect
(
repository
.
gitaly_repository_client
).
not_to
receive
(
:write_config
)
expect
(
repository
.
gitaly_repository_client
).
not_to
receive
(
:write_config
)
expect
do
repository
.
write_config
(
full_path:
'foo/bar.git'
)
end
.
to
raise_error
(
Gitlab
::
Git
::
Repository
::
NoRepository
)
end
expect
do
repository
.
write_config
(
full_path:
'foo/bar.git'
)
end
.
to
raise_error
(
Gitlab
::
Git
::
Repository
::
NoRepository
)
end
end
context
"when gitaly_write_config is enabled"
do
it_behaves_like
"writing repo config"
end
context
"when gitaly_write_config is disabled"
,
:disable_gitaly
do
it_behaves_like
"writing repo config"
end
end
describe
'#merge'
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