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:
parent
25cb70ba60
commit
e02f1271f5
2 changed files with 7 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue