BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
27cc1c2b
Commit
27cc1c2b
authored
Oct 03, 2017
by
Andrew Newdigate
Committed by
Sean McGivern
Oct 03, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for Gitaly nil encoding issue
parent
d14230dd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
2 deletions
+18
-2
gitaly_client.rb
lib/gitlab/gitaly_client.rb
+2
-0
commit_service.rb
lib/gitlab/gitaly_client/commit_service.rb
+1
-1
commit_service_spec.rb
spec/lib/gitlab/gitaly_client/commit_service_spec.rb
+1
-1
gitaly_client_spec.rb
spec/lib/gitlab/gitaly_client_spec.rb
+14
-0
No files found.
lib/gitlab/gitaly_client.rb
View file @
27cc1c2b
...
...
@@ -233,6 +233,8 @@ module Gitlab
end
def
self
.
encode
(
s
)
return
""
if
s
.
nil?
s
.
dup
.
force_encoding
(
Encoding
::
ASCII_8BIT
)
end
...
...
lib/gitlab/gitaly_client/commit_service.rb
View file @
27cc1c2b
...
...
@@ -274,7 +274,7 @@ module Gitlab
repository:
@gitaly_repo
,
left_commit_id:
from_id
,
right_commit_id:
to_id
,
paths:
options
.
fetch
(
:paths
,
[]).
map
{
|
path
|
GitalyClient
.
encode
(
path
)
}
paths:
options
.
fetch
(
:paths
,
[]).
compact
.
map
{
|
path
|
GitalyClient
.
encode
(
path
)
}
}
end
...
...
spec/lib/gitlab/gitaly_client/commit_service_spec.rb
View file @
27cc1c2b
...
...
@@ -53,7 +53,7 @@ describe Gitlab::GitalyClient::CommitService do
end
it
'encodes paths correctly'
do
expect
{
client
.
diff_from_parent
(
commit
,
paths:
[
'encoding/test.txt'
,
'encoding/テスト.txt'
])
}.
not_to
raise_error
expect
{
client
.
diff_from_parent
(
commit
,
paths:
[
'encoding/test.txt'
,
'encoding/テスト.txt'
,
nil
])
}.
not_to
raise_error
end
end
...
...
spec/lib/gitlab/gitaly_client_spec.rb
View file @
27cc1c2b
...
...
@@ -38,6 +38,20 @@ describe Gitlab::GitalyClient, skip_gitaly_mock: true do
end
end
describe
'encode'
do
[
[
nil
,
""
],
[
""
,
""
],
[
" "
,
" "
],
%w(a1 a1)
,
[
"编码"
,
"
\xE7\xBC\x96\xE7\xA0\x81
"
.
b
]
].
each
do
|
input
,
result
|
it
"encodes
#{
input
.
inspect
}
to
#{
result
.
inspect
}
"
do
expect
(
described_class
.
encode
(
input
)).
to
eq
result
end
end
end
describe
'allow_n_plus_1_calls'
do
context
'when RequestStore is enabled'
,
:request_store
do
it
'returns the result of the allow_n_plus_1_calls block'
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