lib/gitlab_git/repository.rb in gitlab_git-7.0.1 vs lib/gitlab_git/repository.rb in gitlab_git-7.1.0
- old
+ new
@@ -200,11 +200,15 @@
populated_index(ref).each do |entry|
# Discard submodules
next if submodule?(entry)
- content = rugged.lookup(entry[:oid]).content
+ content = Blob.raw(self, entry[:oid]).data
+
+ # Skip binary files
+ next if content.encoding == Encoding::ASCII_8BIT
+
greps += build_greps(content, query, ref, entry[:path])
end
greps
end
@@ -897,19 +901,19 @@
# Create a pipe to act as the '|' in 'git archive ... | gzip'
pipe_rd, pipe_wr = IO.pipe
# Get the compression process ready to accept data from the read end
# of the pipe
- compress_pid = spawn(*compress_cmd, :in => pipe_rd, :out => file)
+ compress_pid = spawn(*compress_cmd, in: pipe_rd, out: file)
# Set the lowest priority for the compressing process
popen(nice_process(compress_pid), path)
# The read end belongs to the compression process now; we should
# close our file descriptor for it.
pipe_rd.close
# Start 'git archive' and tell it to write into the write end of the
# pipe.
- git_archive_pid = spawn(*git_archive_cmd, :out => pipe_wr)
+ git_archive_pid = spawn(*git_archive_cmd, out: pipe_wr)
# The write end belongs to 'git archive' now; close it.
pipe_wr.close
# When 'git archive' and the compression process are finished, we are
# done.