Skip to content

Fix 500 error in Commits API when the repository is empty

What does this MR do and why?

Contributes to #452488 (closed)

Problem

Gitaly started returning an internal error, when the user requests commits of the empty repository: gitaly!6590 (merged). Rails doesn't handle it and returns a 500 error.

Solution

Add a temporary handler for this error, before the Gitaly code is updated.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

  1. Create a project with an empty repository (without README.md)
  2. Visit http://127.0.0.1:3000/api/v4/projects/<project_id>/repository/commits
  3. You should see an empty array response instead of an internal error.

Merge request reports