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:
authorSean McGivern <sean@mcgivern.me.uk>2018-01-16 14:03:51 +0300
committerSean McGivern <sean@mcgivern.me.uk>2018-01-16 14:03:51 +0300
commitb94b8aae29112f693bb53b60c6c28c8f7bb8fe9b (patch)
treeddb469e646f82af360ffe1eeb00d82c9f19cf6f5 /app/models
parent480c01a9749ad1aa4ab033ae9e2270ab597c2cce (diff)
parentf32f04a50f702f7a021e79b17dddc8cc1e3f6d5a (diff)
Merge branch 'feature/migrate-commit-uri-to-gitaly' into 'master'
Migrate Commit#uri_type to Gitaly Closes gitaly#915 See merge request gitlab-org/gitlab-ce!16453
Diffstat (limited to 'app/models')
-rw-r--r--app/models/commit.rb8
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)