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
b33e7281
Commit
b33e7281
authored
Jan 23, 2018
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure we're passing ASCII-8BIT to Gitaly
when counting commit count.
parent
b472411e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
2 deletions
+30
-2
changelogs/unreleased/42161-gitaly-commitservice-encoding-undefinedconversionerror-u-c124-from-utf-8-to-ascii-8bit.yml
...efinedconversionerror-u-c124-from-utf-8-to-ascii-8bit.yml
+5
-0
lib/gitlab/gitaly_client/commit_service.rb
lib/gitlab/gitaly_client/commit_service.rb
+2
-2
spec/lib/gitlab/gitaly_client/commit_service_spec.rb
spec/lib/gitlab/gitaly_client/commit_service_spec.rb
+23
-0
No files found.
changelogs/unreleased/42161-gitaly-commitservice-encoding-undefinedconversionerror-u-c124-from-utf-8-to-ascii-8bit.yml
0 → 100644
View file @
b33e7281
---
title
:
Fix encoding issue when counting commit count
merge_request
:
16637
author
:
type
:
fixed
lib/gitlab/gitaly_client/commit_service.rb
View file @
b33e7281
...
...
@@ -125,11 +125,11 @@ module Gitlab
def
commit_count
(
ref
,
options
=
{})
request
=
Gitaly
::
CountCommitsRequest
.
new
(
repository:
@gitaly_repo
,
revision:
ref
revision:
encode_binary
(
ref
)
)
request
.
after
=
Google
::
Protobuf
::
Timestamp
.
new
(
seconds:
options
[
:after
].
to_i
)
if
options
[
:after
].
present?
request
.
before
=
Google
::
Protobuf
::
Timestamp
.
new
(
seconds:
options
[
:before
].
to_i
)
if
options
[
:before
].
present?
request
.
path
=
options
[
:path
]
if
options
[
:path
].
present?
request
.
path
=
encode_binary
(
options
[
:path
])
if
options
[
:path
].
present?
request
.
max_count
=
options
[
:max_count
]
if
options
[
:max_count
].
present?
GitalyClient
.
call
(
@repository
.
storage
,
:commit_service
,
:count_commits
,
request
,
timeout:
GitalyClient
.
medium_timeout
).
count
...
...
spec/lib/gitlab/gitaly_client/commit_service_spec.rb
View file @
b33e7281
...
...
@@ -131,6 +131,29 @@ describe Gitlab::GitalyClient::CommitService do
end
end
describe
'#commit_count'
do
before
do
expect_any_instance_of
(
Gitaly
::
CommitService
::
Stub
)
.
to
receive
(
:count_commits
)
.
with
(
gitaly_request_with_path
(
storage_name
,
relative_path
),
kind_of
(
Hash
))
.
and_return
([])
end
it
'sends a commit_count message'
do
client
.
commit_count
(
revision
)
end
context
'with UTF-8 params strings'
do
let
(
:revision
)
{
"branch
\u
011F"
}
let
(
:path
)
{
"foo/
\u
011F.txt"
}
it
'handles string encodings correctly'
do
client
.
commit_count
(
revision
,
path:
path
)
end
end
end
describe
'#find_commit'
do
let
(
:revision
)
{
'4b825dc642cb6eb9a060e54bf8d69288fbee4904'
}
it
'sends an RPC request'
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