Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
f0b052e1
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
f0b052e1
编写于
3月 09, 2016
作者:
H
Hiroyuki Sato
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix wiki search results point to raw source
上级
374037b8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
25 addition
and
4 deletion
+25
-4
CHANGELOG
CHANGELOG
+1
-0
app/models/repository.rb
app/models/repository.rb
+4
-0
app/views/search/results/_wiki_blob.html.haml
app/views/search/results/_wiki_blob.html.haml
+2
-2
features/steps/search.rb
features/steps/search.rb
+1
-1
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+17
-1
未找到文件。
CHANGELOG
浏览文件 @
f0b052e1
...
...
@@ -11,6 +11,7 @@ v 8.6.0 (unreleased)
GitLab will ask the user to create a new one upon first visit.
- Fix issue when pushing to projects ending in .wiki
- Add support for wiki with UTF-8 page names (Hiroyuki Sato)
- Fix wiki search results point to raw source (Hiroyuki Sato)
- Don't load all of GitLab in mail_room
- Update `omniauth-saml` to 1.5.0 to allow for custom response attributes to be set
- Memoize @group in Admin::GroupsController (Yatish Mehta)
...
...
app/models/repository.rb
浏览文件 @
f0b052e1
...
...
@@ -758,12 +758,15 @@ class Repository
def
parse_search_result
(
result
)
ref
=
nil
filename
=
nil
basename
=
nil
startline
=
0
result
.
each_line
.
each_with_index
do
|
line
,
index
|
if
line
=~
/^.*:.*:\d+:/
ref
,
filename
,
startline
=
line
.
split
(
':'
)
startline
=
startline
.
to_i
-
index
extname
=
File
.
extname
(
filename
)
basename
=
filename
.
sub
(
/
#{
extname
}
$/
,
''
)
break
end
end
...
...
@@ -776,6 +779,7 @@ class Repository
OpenStruct
.
new
(
filename:
filename
,
basename:
basename
,
ref:
ref
,
startline:
startline
,
data:
data
...
...
app/views/search/results/_wiki_blob.html.haml
浏览文件 @
f0b052e1
...
...
@@ -2,9 +2,9 @@
.blob-result
.file-holder
.file-title
=
link_to
namespace_project_wiki_path
(
@project
.
namespace
,
@project
,
wiki_blob
.
fil
ename
)
do
=
link_to
namespace_project_wiki_path
(
@project
.
namespace
,
@project
,
wiki_blob
.
bas
ename
)
do
%i
.fa.fa-file
%strong
=
wiki_blob
.
fil
ename
=
wiki_blob
.
bas
ename
.file-content.code.term
=
render
'shared/file_highlight'
,
blob:
wiki_blob
,
first_line_number:
wiki_blob
.
startline
features/steps/search.rb
浏览文件 @
f0b052e1
...
...
@@ -100,7 +100,7 @@ class Spinach::Features::Search < Spinach::FeatureSteps
step
'I should see "test_wiki" link in the search results'
do
page
.
within
(
'.results'
)
do
find
(
:css
,
'.search-results'
).
should
have_link
'test_wiki.md
'
expect
(
find
(
:css
,
'.search-results'
)).
to
have_link
'test_wiki
'
end
end
...
...
spec/models/repository_spec.rb
浏览文件 @
f0b052e1
...
...
@@ -101,13 +101,29 @@ describe Repository, models: true do
end
describe
'parsing result'
do
subject
{
repository
.
parse_search_result
(
results
.
first
)
}
subject
{
repository
.
parse_search_result
(
search_result
)
}
let
(
:search_result
)
{
results
.
first
}
it
{
is_expected
.
to
be_an
OpenStruct
}
it
{
expect
(
subject
.
filename
).
to
eq
(
'CHANGELOG'
)
}
it
{
expect
(
subject
.
basename
).
to
eq
(
'CHANGELOG'
)
}
it
{
expect
(
subject
.
ref
).
to
eq
(
'master'
)
}
it
{
expect
(
subject
.
startline
).
to
eq
(
186
)
}
it
{
expect
(
subject
.
data
.
lines
[
2
]).
to
eq
(
" - Feature: Replace teams with group membership
\n
"
)
}
context
"when filename has extension"
do
let
(
:search_result
)
{
"master:CONTRIBUTE.md:5:- [Contribute to GitLab](#contribute-to-gitlab)
\n
"
}
it
{
expect
(
subject
.
filename
).
to
eq
(
'CONTRIBUTE.md'
)
}
it
{
expect
(
subject
.
basename
).
to
eq
(
'CONTRIBUTE'
)
}
end
context
"when file under directory"
do
let
(
:search_result
)
{
"master:a/b/c.md:5:a b c
\n
"
}
it
{
expect
(
subject
.
filename
).
to
eq
(
'a/b/c.md'
)
}
it
{
expect
(
subject
.
basename
).
to
eq
(
'a/b/c'
)
}
end
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录