gitlab-org--gitlab-foss/lib/gitlab/wiki_file_finder.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
481 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2018-06-04 07:41:37 -04:00
module Gitlab
class WikiFileFinder < FileFinder
attr_reader :repository
def initialize(project, ref)
@project = project
@ref = ref
@repository = project.wiki.repository
end
private
def search_paths(query)
2018-06-04 07:41:37 -04:00
safe_query = Regexp.escape(query.tr(' ', '-'))
safe_query = Regexp.new(safe_query, Regexp::IGNORECASE)
paths = repository.ls_files(ref)
2018-06-04 07:41:37 -04:00
paths.grep(safe_query)
2018-06-04 07:41:37 -04:00
end
end
end