Skip to content

gitlab/git: Recognize SHA256-style object SHAs

Patrick Steinhardt requested to merge pks-git-recognize-sha256-object-id into master

What does this MR do and why?

The Git project has introduced support for SHA256 object hashes quite a while ago, with recent efforts to start declaring this hash as stable. Furthermore, Gitaly has invested significant resources over the last year to make it compatible with SHA256. While not all of the RPCs do work with SHA256, the majority does indeed work alright.

Thus our focus is shifting more towards downstream projects and setting the groundwork there. This MR here is a first step towards supporting SHA256 object hashes in Rails. It refactors our routing logic and some other parts that try to recognize object hashes to support parsing both SHA1 and SHA256 object hashes.

It is by far not everything that we'll have to do. Most importantly, what is still missing in this context is testing infrastructure for SHA256. This requires a lot of work though and can only land iteratively. But as a consequence, the testing introduced by this MR is only rather shallow. No integration-style testing is done as that is simply not possible right now.

These changes already help to get a small subset of GitLab working with SHA256 repositories. This mostly only involves read-only operations, and not even all of those work right now.

How to set up and validate locally

  1. Import a SHA256 repository. It is not yet possible to create SHA256 from the scratch, so you have to import something like e.g. this test repository via the repository importer.
  2. Verify that a subset of functionality works. Expected to work is e.g. the project summary, list of commits, cloning and other functionality. A lot of functionality does not work though, and this is expected.

MR acceptance checklist

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

Edited by Patrick Steinhardt

Merge request reports