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
39c911ea
Commit
39c911ea
authored
Mar 27, 2018
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix listing commit branch/tags that contain special characters
parent
f56ef206
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
2 deletions
+11
-2
changelogs/unreleased/dm-refs-contains-sha-encoding.yml
changelogs/unreleased/dm-refs-contains-sha-encoding.yml
+5
-0
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+2
-1
spec/lib/gitlab/git/repository_spec.rb
spec/lib/gitlab/git/repository_spec.rb
+4
-1
No files found.
changelogs/unreleased/dm-refs-contains-sha-encoding.yml
0 → 100644
View file @
39c911ea
---
title
:
Fix listing commit branch/tags that contain special characters
merge_request
:
author
:
type
:
fixed
lib/gitlab/git/repository.rb
View file @
39c911ea
...
@@ -8,6 +8,7 @@ module Gitlab
...
@@ -8,6 +8,7 @@ module Gitlab
class
Repository
class
Repository
include
Gitlab
::
Git
::
RepositoryMirroring
include
Gitlab
::
Git
::
RepositoryMirroring
include
Gitlab
::
Git
::
Popen
include
Gitlab
::
Git
::
Popen
include
Gitlab
::
EncodingHelper
ALLOWED_OBJECT_DIRECTORIES_VARIABLES
=
%w[
ALLOWED_OBJECT_DIRECTORIES_VARIABLES
=
%w[
GIT_OBJECT_DIRECTORY
GIT_OBJECT_DIRECTORY
...
@@ -1479,7 +1480,7 @@ module Gitlab
...
@@ -1479,7 +1480,7 @@ module Gitlab
names
.
lines
.
each
do
|
line
|
names
.
lines
.
each
do
|
line
|
next
unless
line
.
start_with?
(
refs_prefix
)
next
unless
line
.
start_with?
(
refs_prefix
)
refs
<<
line
.
rstrip
[
left_slice_count
..-
1
]
refs
<<
encode_utf8
(
line
.
rstrip
[
left_slice_count
..-
1
])
end
end
refs
refs
...
...
spec/lib/gitlab/git/repository_spec.rb
View file @
39c911ea
...
@@ -604,17 +604,20 @@ describe Gitlab::Git::Repository, seed_helper: true do
...
@@ -604,17 +604,20 @@ describe Gitlab::Git::Repository, seed_helper: true do
shared_examples
'returning the right branches'
do
shared_examples
'returning the right branches'
do
let
(
:head_id
)
{
repository
.
rugged
.
head
.
target
.
oid
}
let
(
:head_id
)
{
repository
.
rugged
.
head
.
target
.
oid
}
let
(
:new_branch
)
{
head_id
}
let
(
:new_branch
)
{
head_id
}
let
(
:utf8_branch
)
{
'branch-é'
}
before
do
before
do
repository
.
create_branch
(
new_branch
,
'master'
)
repository
.
create_branch
(
new_branch
,
'master'
)
repository
.
create_branch
(
utf8_branch
,
'master'
)
end
end
after
do
after
do
repository
.
delete_branch
(
new_branch
)
repository
.
delete_branch
(
new_branch
)
repository
.
delete_branch
(
utf8_branch
)
end
end
it
'displays that branch'
do
it
'displays that branch'
do
expect
(
repository
.
branch_names_contains_sha
(
head_id
)).
to
include
(
'master'
,
new_branch
)
expect
(
repository
.
branch_names_contains_sha
(
head_id
)).
to
include
(
'master'
,
new_branch
,
utf8_branch
)
end
end
end
end
...
...
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