Skip to content

Update blank revision checks to handle sha256 repositories

What does this MR do and why?

In various places around the codebase, we check if a revision has a blank reference (i.e. zero object id) through one of the following ways:

  • .blank_ref? method – See example.
  • == BLANK_SHA statement (or variants like == Gitlab::Git::BLANK_SHA) – See example.

This however works for SHA1-based repositories (in which a reference length is 40), but will not work with SHA256 repositories (for which references are 64 characters/digits long), therefore, we have to update these checks to work for the latter too.

Note: I also took the liberty of updating BLANK_SHA to SHA1_BLANK_SHA to distingush it from SHA256_BLANK_SHA.

Resolves #434693 (closed).

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 Ahmed Hemdan

Merge request reports