3 min Devops

Git prepares set to force transition to Rust programming language

Git prepares set to force transition to Rust programming language

A series of patches has been published on the Git mailing list, taking the first step towards integrating Rust into the core of the project.

Patrick Steinhardt states in his proposal that Rust will become a mandatory part of the build infrastructure starting with Git 3.0. The series is presented as a trial balloon, similar to previous experiments surrounding the introduction of C99 functionality. The goal is to create time for experiments with the new language, to adapt the build infrastructure, and to give distributions the opportunity to incorporate the new dependency.

As a first test, the varint.c subsystem has been converted to Rust. This component was deliberately chosen because it is small and independent and has no dependencies. It allows developers to test the interoperability between C and Rust and provides scope for setting up tooling and infrastructure. All existing tests pass with the new implementation, confirming that the basics work. For now, only support via Meson is offered. If the project agrees with the proposed direction, support in traditional Makefiles will follow later.

According to Steinhardt, several components are still missing at this stage. For example, there is no CI task in place that specifically checks whether Rust builds and works correctly, and there is no tooling available to enforce consistent formatting via cargo format. The intention is to add these elements later, so that the project has a playing field in which further experimentation can take place.

Rust support still optional

The announcement comes at a time when Git is in version 2.51. This makes it clear that the switch to Rust will take a few more releases. However, the patch series already includes an addition to the documentation stating that Rust will be a mandatory build dependency in Git 3.0. This is a major change, as Git has been offering optional support for Rust for some time.

Since version 2.49, there has been a foreign function interface that allows Rust code to work with the existing C implementation. Making it mandatory means that every user and every distribution must have the toolchain available. Because Rust does not work on all systems and is difficult to integrate on some platforms, this may affect the breadth of support that Git offers. Steinhardt acknowledges this. He indicates that the goal of the current process is precisely to give distributions time to prepare.

In addition to the introduction of Rust, another major change is planned for Git 3.0. The new major version will also be the moment when SHA-256 becomes the standard. This marks an important turning point for Git 3.0. Both the underlying cryptographic basis and the programming languages used will be modified. This should make the project future-proof.