Skip to content

gitlab: Handle errors thrown by tree_entries

What does this MR do and why?

gitlab: Handle errors thrown by tree_entries

The tree_entries function, provides a safe way to retrieve the entries of a particular tree via an RPC call to Gitaly. Historically Gitaly would return an nil response when the revision/path was invalid.

With the upcoming introduction of structured errors, Gitaly will begin to throw errors. While we introduced parsing for such errors in commit_service.rb:tree_entries, we now throw a Gitlab::Git::Index::IndexError. This error needs to be handled in the upper layers.

So in gitlab/git/tree.rb, handle this error and return an empty list and cursor.

Screenshots or screen recordings

N/A

How to set up and validate locally

Tests against the gitaly MR gitaly!5895 (diffs) should run successfully with this patch

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #5036 (closed)

Merge request reports