Skip to content

Introduce empty_tree_id to correctly work with SHA256 repository

Vasilii Iakliushin requested to merge 441465_use_empty_tree_id into master

What does this MR do and why?

Contributes to #441465 (closed)

Problem

We use a hardcoded EMPTY_TREE_ID value to detect the empty repository tree. But SHA256 repositories have a different empty tree id.

Solution

Use repository object format to detect the empty tree id.

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. Enable feature flag Feature.enable(:support_sha256_repositories)
  2. Create a new project in SHA256 format

Screenshot_2024-02-14_at_16.08.44

  1. Go to the new project page
  2. Click on Initial commit link (something like https://staging.gitlab.com/vyaklushin/my-sha256/-/commit/479c421a108facb7975c0ab51450651be7be2c5bd6940e02e879d363dbdd9aa8)
  3. You should see a 500 error
  4. Enable feature flag Feature.enable(:dynamic_empty_tree_id)
  5. Visit Initial commit page again
  6. It should be loaded successfully
Edited by Vasilii Iakliushin

Merge request reports