Using Grit instead of backticked bash.

A bit unclear what's going on though, would be more explicit to say:
{:count => query}, however Grit::Git#transform_options converts to this
syntax:
`--count='query'` and `git grep` can't take this syntax, it has to be:
`git grep --count query`, and this is why we're using :c, and not
:count. As {:c => query} converts to: `git grep -c 'query'` which works
as expected.

Linked to this commit, for above information in comment.

Updated comment in Wiki.search to link describing commit.
This commit is contained in:
Sirupsen
2010-08-29 15:05:17 +02:00
committed by Henrik Hansen
parent 45eb364a6d
commit 6d3b40c1d4
+2 -1
View File
@@ -214,7 +214,8 @@ module Gollum
#
# Returns an Array with Objects of page name and count of matches
def search(query)
search_output = `cd #{$path} && git grep -c '#{query}' master`
# See: http://github.com/Sirupsen/gollum/commit/f0a6f52bdaf6bee8253ca33bb3fceaeb27bfb87e
search_output = @repo.git.grep({:c => query}, 'master')
search_output.split("\n").collect do |line|
result = line.split(':')