Открыть боковую панель
nt_test134
nt_project_qgddddf2ot8w
Коммиты
b1cf3225
Коммит
b1cf3225
создал
Янв 16, 2018
по автору
Andrew McCallum
Просмотр файлов
Move Regexp.escape(), fix formatting on tests.
владелец
a539e03d
Изменения
2
Скрыть пробелы
Построчно
Рядом
app/models/repository.rb
Просмотр файла @
b1cf3225
...
...
@@ -938,11 +938,11 @@ def search_files_by_content(query, ref)
end
def
search_files_by_name
(
query
,
ref
)
safe_query
=
query
.
sub
(
/^\/*/
,
""
)
safe_query
=
Regexp
.
escape
(
query
.
sub
(
/^\/*/
,
""
)
)
return
[]
if
empty?
||
safe_query
.
blank?
args
=
%W(ls-tree --full-tree -r
#{
ref
||
root_ref
}
--name-status |
#{
Regexp
.
escape
(
safe_query
)
}
)
args
=
%W(ls-tree --full-tree -r
#{
ref
||
root_ref
}
--name-status |
#{
safe_query
}
)
run_git
(
args
).
first
.
lines
.
map
(
&
:strip
)
end
...
...
spec/models/repository_spec.rb
Просмотр файла @
b1cf3225
...
...
@@ -675,9 +675,9 @@ def expect_to_raise_storage_error
end
it
'properly handles when query is only slashes'
do
results
=
repository
.
search_files_by_name
(
'//'
,
'master'
)
results
=
repository
.
search_files_by_name
(
'//'
,
'master'
)
expect
(
results
).
to
match_array
([])
expect
(
results
).
to
match_array
([])
end
it
'properly handles when query is not present'
do
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать