From 6d3b40c1d4c4128014d2cd3185d3bc553eaaf1d0 Mon Sep 17 00:00:00 2001 From: Sirupsen Date: Sun, 29 Aug 2010 15:05:17 +0200 Subject: [PATCH] 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. --- lib/gollum/wiki.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/gollum/wiki.rb b/lib/gollum/wiki.rb index 64fa6238..4154dab4 100644 --- a/lib/gollum/wiki.rb +++ b/lib/gollum/wiki.rb @@ -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(':')