Clean hierarchy of calls between models and Gitalb::Git for blob search

This commit is contained in:
Alejandro Rodríguez 2017-10-06 20:47:06 -03:00
parent f72598b659
commit 9cc15172de
2 changed files with 5 additions and 3 deletions

View file

@ -468,9 +468,7 @@ class Repository
end
def blob_at(sha, path)
unless Gitlab::Git.blank_ref?(sha)
Blob.decorate(Gitlab::Git::Blob.find(self, sha, path), project)
end
Blob.decorate(raw_repository.blob_at(sha, path), project)
rescue Gitlab::Git::Repository::NoRepository
nil
end

View file

@ -1092,6 +1092,10 @@ module Gitlab
popen(args, @path).last.zero?
end
def blob_at(sha, path)
Gitlab::Git::Blob.find(self, sha, path) unless Gitlab::Git.blank_ref?(sha)
end
def gitaly_repository
Gitlab::GitalyClient::Util.repository(@storage, @relative_path, @gl_repository)
end