FIX: results of Wiki#search contains files out of page_file_dir
This commit is contained in:
+5
-1
@@ -246,7 +246,11 @@ module Gollum
|
||||
# Returns an Array with Objects of page name and count of matches
|
||||
def search(query)
|
||||
# See: http://github.com/Sirupsen/gollum/commit/f0a6f52bdaf6bee8253ca33bb3fceaeb27bfb87e
|
||||
search_output = @repo.git.grep({:c => query}, 'master')
|
||||
if @page_file_dir
|
||||
search_output = @repo.git.grep({:c => query}, 'master', '--', @page_file_dir)
|
||||
else
|
||||
search_output = @repo.git.grep({:c => query}, 'master')
|
||||
end
|
||||
|
||||
search_output.split("\n").collect do |line|
|
||||
result = line.split(':')
|
||||
|
||||
@@ -314,6 +314,12 @@ context "page_file_dir option" do
|
||||
assert !@wiki.page("bar")
|
||||
end
|
||||
|
||||
test "search results should be restricted in page filer dir" do
|
||||
results = @wiki.search("Hello")
|
||||
assert_equal 1, results.size
|
||||
assert_equal "foo", results[0][:name]
|
||||
end
|
||||
|
||||
teardown do
|
||||
FileUtils.rm_r(@path)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user