Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-09-21 14:22:12 +0300
committerStan Hu <stanhu@gmail.com>2017-09-21 21:49:51 +0300
commit794b4c5579075ec5361b4ab864052d0717b29492 (patch)
tree8d1c91119835e37bcc077856ce6b30e8c6cbe0a8 /lib/gitlab/git
parentcfccb2785fb8b98a013170aae4b931e9431739d1 (diff)
Ensure that Blob.raw returns always returns a valid blob object
In gitlab-org/gitlab-ee!2976, we saw that a given OID could point to a commit, which would cause the delta size check to fail. Gitaly already returns nil if the OID isn't a blob, so this change makes the Rugged implementation consistent.
Diffstat (limited to 'lib/gitlab/git')
-rw-r--r--lib/gitlab/git/blob.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/gitlab/git/blob.rb b/lib/gitlab/git/blob.rb
index 8d96826f6ee..a4336facee5 100644
--- a/lib/gitlab/git/blob.rb
+++ b/lib/gitlab/git/blob.rb
@@ -32,6 +32,8 @@ module Gitlab
else
blob = repository.lookup(sha)
+ next unless blob.is_a?(Rugged::Blob)
+
new(
id: blob.oid,
size: blob.size,