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
Jérome Perrin
gitlab-ce
Commits
c4dd7b82
Commit
c4dd7b82
authored
Jan 12, 2018
by
James Edwards-Jones
Committed by
James Edwards-Jones
Jan 16, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent RevList failing on non utf8 paths
parent
a52d8c10
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
changelogs/unreleased/jej-lfs-rev-list-handles-non-utf-paths-41627.yml
...released/jej-lfs-rev-list-handles-non-utf-paths-41627.yml
+5
-0
lib/gitlab/git/rev_list.rb
lib/gitlab/git/rev_list.rb
+1
-1
spec/lib/gitlab/git/rev_list_spec.rb
spec/lib/gitlab/git/rev_list_spec.rb
+10
-1
No files found.
changelogs/unreleased/jej-lfs-rev-list-handles-non-utf-paths-41627.yml
0 → 100644
View file @
c4dd7b82
---
title
:
Prevent RevList failing on non utf8 paths
merge_request
:
16440
author
:
type
:
fixed
lib/gitlab/git/rev_list.rb
View file @
c4dd7b82
...
@@ -95,7 +95,7 @@ module Gitlab
...
@@ -95,7 +95,7 @@ module Gitlab
object_output
.
map
do
|
output_line
|
object_output
.
map
do
|
output_line
|
sha
,
path
=
output_line
.
split
(
' '
,
2
)
sha
,
path
=
output_line
.
split
(
' '
,
2
)
next
if
require_path
&&
path
.
blank
?
next
if
require_path
&&
path
.
to_s
.
empty
?
sha
sha
end
.
reject
(
&
:nil?
)
end
.
reject
(
&
:nil?
)
...
...
spec/lib/gitlab/git/rev_list_spec.rb
View file @
c4dd7b82
...
@@ -39,7 +39,7 @@ describe Gitlab::Git::RevList do
...
@@ -39,7 +39,7 @@ describe Gitlab::Git::RevList do
]
]
expect
(
rev_list
).
to
receive
(
:popen
).
with
(
*
params
)
do
|*
_
,
lazy_block
:|
expect
(
rev_list
).
to
receive
(
:popen
).
with
(
*
params
)
do
|*
_
,
lazy_block
:|
lazy_block
.
call
(
output
.
split
(
"
\n
"
).
lazy
)
lazy_block
.
call
(
output
.
lines
.
lazy
.
map
(
&
:chomp
)
)
end
end
end
end
...
@@ -64,6 +64,15 @@ describe Gitlab::Git::RevList do
...
@@ -64,6 +64,15 @@ describe Gitlab::Git::RevList do
expect
(
rev_list
.
new_objects
(
require_path:
true
)).
to
eq
(
%w[sha2]
)
expect
(
rev_list
.
new_objects
(
require_path:
true
)).
to
eq
(
%w[sha2]
)
end
end
it
'can handle non utf-8 paths'
do
non_utf_char
=
[
0x89
].
pack
(
"c*"
).
force_encoding
(
"UTF-8"
)
stub_lazy_popen_rev_list
(
'newrev'
,
'--not'
,
'--all'
,
'--objects'
,
output:
"sha2 πå†h/†ø/ƒîlé
#{
non_utf_char
}
\n
sha1"
)
rev_list
.
new_objects
(
require_path:
true
)
do
|
object_ids
|
expect
(
object_ids
.
force
).
to
eq
(
%w[sha2]
)
end
end
it
'can yield a lazy enumerator'
do
it
'can yield a lazy enumerator'
do
stub_lazy_popen_rev_list
(
'newrev'
,
'--not'
,
'--all'
,
'--objects'
,
output:
"sha1
\n
sha2"
)
stub_lazy_popen_rev_list
(
'newrev'
,
'--not'
,
'--all'
,
'--objects'
,
output:
"sha1
\n
sha2"
)
...
...
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