Skip to content

revert: Use empty tree OID directly for Git v2.45.0 and later

  • Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA

When reverting a root commit that has no parents, we previously created a temporary commit with an empty tree to feed git-merge-tree. However, since Git 2.45.0, git-merge-tree allows passing tree-ish objects if "ours", "theirs", and "base" are all provided [1]. So we can now drop the overhead and directly use the corresponding empty tree oid.

A related test has been added to better verify the reverting of root commits scenario.

  1. https://github.com/git/git/commit/ae46d5fb98
Edited by 🤖 GitLab Bot 🤖

Merge request reports