# File lib/git/lib.rb, line 104 def grep(string, opts = {}) opts[:object] = 'HEAD' if !opts[:object] grep_opts = ['-n'] grep_opts << '-i' if opts[:ignore_case] grep_opts << '-v' if opts[:invert_match] grep_opts << "-e '#{string}'" grep_opts << opts[:object] if opts[:object].is_a?(String) grep_opts << ('-- ' + opts[:path_limiter]) if opts[:path_limiter].is_a? String hsh = {} command_lines('grep', grep_opts).each do |line| if m = /(.*)\:(\d+)\:(.*)/.match(line) hsh[m[1]] ||= [] hsh[m[1]] << [m[2].to_i, m[3]] end end hsh end