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
上级 25cb70ba
......@@ -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)
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册