lib/gitlab_git/repository.rb in gitlab_git-1.0.6 vs lib/gitlab_git/repository.rb in gitlab_git-1.1.0

- old
+ new

@@ -201,9 +201,21 @@ rescue Grit::Git::GitTimeout [Gitlab::Git::Diff::BROKEN_DIFF] end + def search_files(query, ref = nil) + if ref.nil? || ref == "" + ref = root_ref + end + + greps = repo.grep(query, 3, ref) + + greps.map do |grep| + Gitlab::Git::BlobSnippet.new(ref, grep.content, grep.startline, grep.filename) + end + end + protected def decorate_commit(commit, ref = nil) Gitlab::Git::Commit.new(commit, ref) end