N+1 TreeEntry queries in Projects::BlobController#show

If you load a Markdown with many links, it looks like it's possible that Projects::BlobController renders a lot of Markdown and calls Commit#tree_entry over and over.

It looks to me that:

  1. RelativeLinkFilter calls Commit#uri_type
  2. Commit#uri_type calls Gitlab::Git::Commit#tree_entry

I think we'll want to make the rugged_tree_entry feature flag use the Rugged implementation as well.

Relates to https://gitlab.com/gitlab-org/gitlab-ce/issues/57317.

This will revert https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/20176/diffs.

When the performance bar is enabled, the look for the JSON request on this page, which make over 600 requests.

Edited by Zeger-Jan van de Weg