Return nil on empty path

The execution path wasn't clear from the error, but either way this is a
fix.

Closes gitlab-org/gitaly#1115
This commit is contained in:
Zeger-Jan van de Weg 2018-04-17 16:30:16 +02:00
parent 25cb70ba60
commit e02f1271f5
No known key found for this signature in database
GPG Key ID: 65F6A8D64A88ABAC
2 changed files with 7 additions and 0 deletions

View File

@ -486,6 +486,8 @@ module Gitlab
end
def tree_entry(path)
return unless path.present?
@repository.gitaly_migrate(:commit_tree_entry) do |is_migrated|
if is_migrated
gitaly_tree_entry(path)

View File

@ -450,6 +450,11 @@ eos
it "returns nil if the path doesn't exists" do
expect(commit.uri_type('this/path/doesnt/exist')).to be_nil
end
it 'is nil if the path is nil or empty' do
expect(commit.uri_type(nil)).to be_nil
expect(commit.uri_type("")).to be_nil
end
end
context 'when Gitaly commit_tree_entry feature is enabled' do