lib/gitlab_git/repository.rb in gitlab_git-7.1.9 vs lib/gitlab_git/repository.rb in gitlab_git-7.1.10
- old
+ new
@@ -764,13 +764,16 @@
unless blob_entry
raise InvalidBlobName.new("Invalid blob name: #{blob_name}")
end
- if blob_entry[:type] == :commit
+ case blob_entry[:type]
+ when :commit
blob_entry[:oid]
- else
+ when :tree
+ raise InvalidBlobName.new("#{blob_name} is a tree, not a blob")
+ when :blob
rugged.lookup(blob_entry[:oid]).content
end
end
# Parses the contents of a .gitmodules file and returns a hash of
@@ -960,14 +963,18 @@
end
def nice_process(pid)
niced_process = %W(renice -n 20 -p #{pid})
- unless RUBY_PLATFORM.include?('darwin') || RUBY_PLATFORM.include?('freebsd')
+ unless unsupported_platform?
niced_process = %W(ionice -c 2 -n 7 -p #{pid}) + niced_process
end
niced_process
+ end
+
+ def unsupported_platform?
+ %w( darwin freebsd solaris ).map{ |platform| RUBY_PLATFORM.include?(platform) }.any?
end
# Returns true if the index entry has the special file mode that denotes
# a submodule.
def submodule?(index_entry)