diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2018-01-15 10:39:06 +0100 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2018-01-15 14:16:22 +0100 |
commit | f32f04a50f702f7a021e79b17dddc8cc1e3f6d5a (patch) | |
tree | 88c4b2d9e1a591de4a01f7da8e1cae480c20ec18 /app/models/commit.rb | |
parent | 74f2f9b30fb1972a26481072486b358eb943309f (diff) | |
download | gitlab-ce-f32f04a50f702f7a021e79b17dddc8cc1e3f6d5a.tar.gz |
Migrate Commit#uri_type to Gitalyfeature/migrate-commit-uri-to-gitaly
Closes gitaly#915
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r-- | app/models/commit.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index 21904c87f01..2d2d89af030 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -372,19 +372,19 @@ class Commit # uri_type('doc/README.md') # => :blob # uri_type('doc/logo.png') # => :raw # uri_type('doc/api') # => :tree - # uri_type('not/found') # => :nil + # uri_type('not/found') # => nil # # Returns a symbol def uri_type(path) - entry = @raw.rugged_tree_entry(path) + entry = @raw.tree_entry(path) + return unless entry + if entry[:type] == :blob blob = ::Blob.decorate(Gitlab::Git::Blob.new(name: entry[:name]), @project) blob.image? || blob.video? ? :raw : :blob else entry[:type] end - rescue Rugged::TreeError - nil end def raw_diffs(*args) |