Skip to content

git: Remove unused root tree object ID from Git::Tree

What does this MR do and why?

When retrieving Git trees via either Rugged or Gitaly, we also request the root tree object ID of the current tree entry, which is the object ID of the top-level tree object where we start searching from. So in the general case where start from a specific revision, it is equal to that revision peeled to a tree.

This information is not actually used anywhere in Rails, even though we still make sure to have it accessible. The problem with this field is that on the Gitaly-side, we have no way to determine the root object ID without spawning a second instance of git-cat-file(1). This is because for every requested tree entry, we both have to parse the content of the requested treeish, but also resolve the root treeish as well. While we could reuse the same git-cat-file(1) process to do this, it would mean that we have to needlessly request the contents of the root tree even though we really only want to have its object ID.

So ultimately, having the root tree object in the response requires Gitaly to always do two round-trips. This is quite inefficient, and seeing that we don't even use the information, ultimately a wasted effort. So let's remove the unused accessor so that Gitaly can deprecate the field.

MR acceptance checklist

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

Merge request reports