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
42c06178
Commit
42c06178
authored
Sep 07, 2018
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Encode remote root ref
parent
88239e94
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletion
+16
-1
lib/gitlab/gitaly_client/remote_service.rb
lib/gitlab/gitaly_client/remote_service.rb
+3
-1
spec/lib/gitlab/git/repository_spec.rb
spec/lib/gitlab/git/repository_spec.rb
+4
-0
spec/lib/gitlab/gitaly_client/remote_service_spec.rb
spec/lib/gitlab/gitaly_client/remote_service_spec.rb
+9
-0
No files found.
lib/gitlab/gitaly_client/remote_service.rb
View file @
42c06178
module
Gitlab
module
GitalyClient
class
RemoteService
include
Gitlab
::
EncodingHelper
MAX_MSG_SIZE
=
128
.
kilobytes
.
freeze
def
self
.
exists?
(
remote_url
)
...
...
@@ -61,7 +63,7 @@ module Gitlab
response
=
GitalyClient
.
call
(
@storage
,
:remote_service
,
:find_remote_root_ref
,
request
)
response
.
ref
.
presence
encode_utf8
(
response
.
ref
)
end
def
update_remote_mirror
(
ref_name
,
only_branches_matching
)
...
...
spec/lib/gitlab/git/repository_spec.rb
View file @
42c06178
...
...
@@ -591,6 +591,10 @@ describe Gitlab::Git::Repository, :seed_helper do
expect
(
repository
.
find_remote_root_ref
(
'origin'
)).
to
eq
'master'
end
it
'returns UTF-8'
do
expect
(
repository
.
find_remote_root_ref
(
'origin'
)).
to
be_utf8
end
it
'returns nil when remote name is nil'
do
expect_any_instance_of
(
Gitlab
::
GitalyClient
::
RemoteService
)
.
not_to
receive
(
:find_remote_root_ref
)
...
...
spec/lib/gitlab/gitaly_client/remote_service_spec.rb
View file @
42c06178
...
...
@@ -54,6 +54,15 @@ describe Gitlab::GitalyClient::RemoteService do
expect
(
client
.
find_remote_root_ref
(
'origin'
)).
to
eq
'master'
end
it
'ensure ref is a valid UTF-8 string'
do
expect_any_instance_of
(
Gitaly
::
RemoteService
::
Stub
)
.
to
receive
(
:find_remote_root_ref
)
.
with
(
gitaly_request_with_path
(
storage_name
,
relative_path
),
kind_of
(
Hash
))
.
and_return
(
double
(
ref:
"an_invalid_ref_
\xE5
"
))
expect
(
client
.
find_remote_root_ref
(
'origin'
)).
to
eq
"an_invalid_ref_å"
end
end
describe
'#update_remote_mirror'
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