lib/gitlab_git/repository.rb in gitlab_git-7.2.24 vs lib/gitlab_git/repository.rb in gitlab_git-8.0.0
- old
+ new
@@ -195,11 +195,11 @@
File.join(storage_path, self.name, file_name)
end
# Return repo size in megabytes
def size
- size = popen(%W(du -s), path).first.strip.to_i
+ size = popen(%W(du -sk), path).first.strip.to_i
(size.to_f / 1024).round(2)
end
# Returns an array of BlobSnippets for files at the specified +ref+ that
# contain the +query+ string.
@@ -209,15 +209,16 @@
populated_index(ref).each do |entry|
# Discard submodules
next if submodule?(entry)
- content = Blob.raw(self, entry[:oid]).data
+ blob = Blob.raw(self, entry[:oid])
# Skip binary files
- next if content.encoding == Encoding::ASCII_8BIT
+ next if blob.data.encoding == Encoding::ASCII_8BIT
- greps += build_greps(content, query, ref, entry[:path])
+ blob.load_all_data!(self)
+ greps += build_greps(blob.data, query, ref, entry[:path])
end
greps
end