Git development
 help / color / mirror / Atom feed
* [PATCH 0/4] Enable Rust by default
@ 2026-04-03  1:12 brian m. carlson
  2026-04-03  1:12 ` [PATCH 1/4] docs: update version with default Rust support brian m. carlson
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: brian m. carlson @ 2026-04-03  1:12 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Ezekiel Newren

Our breaking changes document said that we would enable Rust support by
default in Git 2.53, while still leaving the ability for it to be
disabled.  Unfortunately, we forgot to do that and my time machine is
broken right now, so this series sets it up for Git 2.54.

The first patch updates the documentation accordingly and the next two
fix a few cases that are broken in our CI system.  The final patch
simply enables Rust by default except for two jobs to make sure that we
continue to build correctly without Rust for the moment.

I didn't force Rust on with the breaking changes mode because it's
already on by default with this series and it seemed unnecessary.

The GitHub Actions CI passes on all platforms with this series.

brian m. carlson (4):
  docs: update version with default Rust support
  ci: install cargo on Alpine
  Linux: link against libdl
  Enable Rust by default

 Documentation/BreakingChanges.adoc |  2 +-
 Makefile                           | 10 +++++-----
 ci/install-dependencies.sh         |  2 +-
 ci/lib.sh                          |  3 +++
 ci/run-build-and-tests.sh          |  2 +-
 config.mak.uname                   |  1 +
 meson.build                        |  2 +-
 meson_options.txt                  |  2 +-
 8 files changed, 14 insertions(+), 10 deletions(-)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/4] docs: update version with default Rust support
  2026-04-03  1:12 [PATCH 0/4] Enable Rust by default brian m. carlson
@ 2026-04-03  1:12 ` brian m. carlson
  2026-04-03  1:12 ` [PATCH 2/4] ci: install cargo on Alpine brian m. carlson
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: brian m. carlson @ 2026-04-03  1:12 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Ezekiel Newren

We missed the cut-off for Rust by default in 2.53, but we still can
enable it by default for 2.54, so update our breaking changes document
accordingly.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 Documentation/BreakingChanges.adoc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/BreakingChanges.adoc b/Documentation/BreakingChanges.adoc
index f814450d2f..510ed98b65 100644
--- a/Documentation/BreakingChanges.adoc
+++ b/Documentation/BreakingChanges.adoc
@@ -190,7 +190,7 @@ milestones for the introduction of Rust:
 1. Initially, with Git 2.52, support for Rust will be auto-detected by Meson and
    disabled in our Makefile so that the project can sort out the initial
    infrastructure.
-2. In Git 2.53, both build systems will default-enable support for Rust.
+2. In Git 2.54, both build systems will default-enable support for Rust.
    Consequently, builds will break by default if Rust is not available on the
    build host. The use of Rust can still be explicitly disabled via build
    flags.

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] ci: install cargo on Alpine
  2026-04-03  1:12 [PATCH 0/4] Enable Rust by default brian m. carlson
  2026-04-03  1:12 ` [PATCH 1/4] docs: update version with default Rust support brian m. carlson
@ 2026-04-03  1:12 ` brian m. carlson
  2026-04-08 10:12   ` Patrick Steinhardt
  2026-04-03  1:12 ` [PATCH 3/4] Linux: link against libdl brian m. carlson
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: brian m. carlson @ 2026-04-03  1:12 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Ezekiel Newren

We'll make Rust the default in a future commit, so be sure to install
Cargo (which will also install Rust) to prepare for that case.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 ci/install-dependencies.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh
index c55441d9df..10c3530d1a 100755
--- a/ci/install-dependencies.sh
+++ b/ci/install-dependencies.sh
@@ -29,7 +29,7 @@ alpine-*)
 	apk add --update shadow sudo meson ninja-build gcc libc-dev curl-dev openssl-dev expat-dev gettext \
 		zlib-ng-dev pcre2-dev python3 musl-libintl perl-utils ncurses \
 		apache2 apache2-http2 apache2-proxy apache2-ssl apache2-webdav apr-util-dbd_sqlite3 \
-		bash cvs gnupg perl-cgi perl-dbd-sqlite perl-io-tty >/dev/null
+		bash cvs gnupg perl-cgi perl-dbd-sqlite perl-io-tty cargo >/dev/null
 	;;
 fedora-*|almalinux-*)
 	case "$jobname" in

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] Linux: link against libdl
  2026-04-03  1:12 [PATCH 0/4] Enable Rust by default brian m. carlson
  2026-04-03  1:12 ` [PATCH 1/4] docs: update version with default Rust support brian m. carlson
  2026-04-03  1:12 ` [PATCH 2/4] ci: install cargo on Alpine brian m. carlson
@ 2026-04-03  1:12 ` brian m. carlson
  2026-04-08 10:12   ` Patrick Steinhardt
  2026-04-03  1:12 ` [PATCH 4/4] Enable Rust by default brian m. carlson
  2026-04-03  5:04 ` [PATCH 0/4] " Junio C Hamano
  4 siblings, 1 reply; 9+ messages in thread
From: brian m. carlson @ 2026-04-03  1:12 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Ezekiel Newren

Older versions of Rust on Linux, such as that used in Debian 11 in our
CI, require linking against libdl.  Were we linking with Cargo, this
would be included automatically, but since we're not, explicitly set it
in the system-specific config.

This library is part of libc, so linking against it if it happens to be
unnecessary will add no dependencies to the resulting binary.  In
addition, it is provided by both glibc and musl, so it should be
portable to almost all Linux systems.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 config.mak.uname | 1 +
 1 file changed, 1 insertion(+)

diff --git a/config.mak.uname b/config.mak.uname
index ccb3f71881..7aab56c590 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -63,6 +63,7 @@ ifeq ($(uname_S),Linux)
 	PROCFS_EXECUTABLE_PATH = /proc/self/exe
 	HAVE_PLATFORM_PROCINFO = YesPlease
 	COMPAT_OBJS += compat/linux/procinfo.o
+	EXTLIBS += -ldl
 	# centos7/rhel7 provides gcc 4.8.5 and zlib 1.2.7.
         ifneq ($(findstring .el7.,$(uname_R)),)
 		BASIC_CFLAGS += -std=c99

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] Enable Rust by default
  2026-04-03  1:12 [PATCH 0/4] Enable Rust by default brian m. carlson
                   ` (2 preceding siblings ...)
  2026-04-03  1:12 ` [PATCH 3/4] Linux: link against libdl brian m. carlson
@ 2026-04-03  1:12 ` brian m. carlson
  2026-04-08 10:12   ` Patrick Steinhardt
  2026-04-03  5:04 ` [PATCH 0/4] " Junio C Hamano
  4 siblings, 1 reply; 9+ messages in thread
From: brian m. carlson @ 2026-04-03  1:12 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Ezekiel Newren

Our breaking changes document says that we'll enable Rust by default in
Git 2.54.  Adjust the Makefile to switch the option from WITH_RUST to
NO_RUST to enable it by default and update the help text accordingly.
Similarly, for Meson, enable the option by default and do not
automatically disable it if Cargo is missing, since the goal is to help
users find where they are likely to have problems in the future.

Update our CI tests to swap out the single Linux job with Rust to a
single job without.  Similarly, update the Windows Makefile job to not
use Rust, while the Meson job (which does not build with ci/lib.sh) will
default to having it enabled.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 Makefile                  | 10 +++++-----
 ci/lib.sh                 |  3 +++
 ci/run-build-and-tests.sh |  2 +-
 meson.build               |  2 +-
 meson_options.txt         |  2 +-
 5 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index dbf0022054..84b59959de 100644
--- a/Makefile
+++ b/Makefile
@@ -498,9 +498,9 @@ include shared.mak
 #
 # == Optional Rust support ==
 #
-# Define WITH_RUST if you want to include features and subsystems written in
-# Rust into Git. For now, Rust is still an optional feature of the build
-# process. With Git 3.0 though, Rust will always be enabled.
+# Define NO_RUST if you want to disable features and subsystems written in Rust
+# from being compiled into Git. For now, Rust is still an optional feature of
+# the build process. With Git 3.0 though, Rust will always be enabled.
 #
 # Building Rust code requires Cargo.
 #
@@ -1351,7 +1351,7 @@ LIB_OBJS += urlmatch.o
 LIB_OBJS += usage.o
 LIB_OBJS += userdiff.o
 LIB_OBJS += utf8.o
-ifndef WITH_RUST
+ifdef NO_RUST
 LIB_OBJS += varint.o
 endif
 LIB_OBJS += version.o
@@ -1590,7 +1590,7 @@ endif
 ALL_CFLAGS = $(DEVELOPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_APPEND)
 ALL_LDFLAGS = $(LDFLAGS) $(LDFLAGS_APPEND)
 
-ifdef WITH_RUST
+ifndef NO_RUST
 BASIC_CFLAGS += -DWITH_RUST
 GITLIBS += $(RUST_LIB)
 ifeq ($(uname_S),Windows)
diff --git a/ci/lib.sh b/ci/lib.sh
index 42a2b6a318..1cfc8c6efc 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -372,6 +372,9 @@ linux-asan-ubsan)
 osx-meson)
 	MESONFLAGS="$MESONFLAGS -Dcredential_helpers=osxkeychain"
 	;;
+windows-*)
+	export NO_RUST=UnfortunatelyYes
+	;;
 esac
 
 MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}"
diff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh
index 28cfe730ee..bf1fdbe968 100755
--- a/ci/run-build-and-tests.sh
+++ b/ci/run-build-and-tests.sh
@@ -10,7 +10,6 @@ export TEST_CONTRIB_TOO=yes
 case "$jobname" in
 fedora-breaking-changes-musl|linux-breaking-changes)
 	export WITH_BREAKING_CHANGES=YesPlease
-	export WITH_RUST=YesPlease
 	MESONFLAGS="$MESONFLAGS -Dbreaking_changes=true"
 	MESONFLAGS="$MESONFLAGS -Drust=enabled"
 	;;
@@ -30,6 +29,7 @@ linux-TEST-vars)
 	export GIT_TEST_PACK_USE_BITMAP_BOUNDARY_TRAVERSAL=1
 	;;
 linux-clang)
+	export NO_RUST=UnfortunatelyYes
 	export GIT_TEST_DEFAULT_HASH=sha1
 	;;
 linux-sha256)
diff --git a/meson.build b/meson.build
index 8309942d18..4e1a58ee01 100644
--- a/meson.build
+++ b/meson.build
@@ -1746,7 +1746,7 @@ version_def_h = custom_target(
 libgit_sources += version_def_h
 
 cargo = find_program('cargo', dirs: program_path, native: true, required: get_option('rust'))
-rust_option = get_option('rust').disable_auto_if(not cargo.found())
+rust_option = get_option('rust')
 if rust_option.allowed()
   subdir('src')
   libgit_c_args += '-DWITH_RUST'
diff --git a/meson_options.txt b/meson_options.txt
index 659cbb218f..80a8025f20 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -77,7 +77,7 @@ option('zlib_backend', type: 'combo', choices: ['auto', 'zlib', 'zlib-ng'], valu
 # Build tweaks.
 option('breaking_changes', type: 'boolean', value: false,
   description: 'Enable upcoming breaking changes.')
-option('rust', type: 'feature', value: 'auto',
+option('rust', type: 'feature', value: 'enabled',
   description: 'Enable building with Rust.')
 option('macos_use_homebrew_gettext', type: 'boolean', value: true,
   description: 'Use gettext from Homebrew instead of the slightly-broken system-provided one.')

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/4] Enable Rust by default
  2026-04-03  1:12 [PATCH 0/4] Enable Rust by default brian m. carlson
                   ` (3 preceding siblings ...)
  2026-04-03  1:12 ` [PATCH 4/4] Enable Rust by default brian m. carlson
@ 2026-04-03  5:04 ` Junio C Hamano
  4 siblings, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2026-04-03  5:04 UTC (permalink / raw)
  To: brian m. carlson; +Cc: git, Patrick Steinhardt, Ezekiel Newren

"brian m. carlson" <sandals@crustytoothpaste.net> writes:

> Our breaking changes document said that we would enable Rust support by
> default in Git 2.53, while still leaving the ability for it to be
> disabled.  Unfortunately, we forgot to do that and my time machine is
> broken right now, so this series sets it up for Git 2.54.
>
> The first patch updates the documentation accordingly and the next two
> fix a few cases that are broken in our CI system.  The final patch
> simply enables Rust by default except for two jobs to make sure that we
> continue to build correctly without Rust for the moment.
>
> I didn't force Rust on with the breaking changes mode because it's
> already on by default with this series and it seemed unnecessary.

Thanks.

>
> The GitHub Actions CI passes on all platforms with this series.
>
> brian m. carlson (4):
>   docs: update version with default Rust support
>   ci: install cargo on Alpine
>   Linux: link against libdl
>   Enable Rust by default
>
>  Documentation/BreakingChanges.adoc |  2 +-
>  Makefile                           | 10 +++++-----
>  ci/install-dependencies.sh         |  2 +-
>  ci/lib.sh                          |  3 +++
>  ci/run-build-and-tests.sh          |  2 +-
>  config.mak.uname                   |  1 +
>  meson.build                        |  2 +-
>  meson_options.txt                  |  2 +-
>  8 files changed, 14 insertions(+), 10 deletions(-)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] ci: install cargo on Alpine
  2026-04-03  1:12 ` [PATCH 2/4] ci: install cargo on Alpine brian m. carlson
@ 2026-04-08 10:12   ` Patrick Steinhardt
  0 siblings, 0 replies; 9+ messages in thread
From: Patrick Steinhardt @ 2026-04-08 10:12 UTC (permalink / raw)
  To: brian m. carlson; +Cc: git, Junio C Hamano, Ezekiel Newren

On Fri, Apr 03, 2026 at 01:12:47AM +0000, brian m. carlson wrote:
> We'll make Rust the default in a future commit, so be sure to install
> Cargo (which will also install Rust) to prepare for that case.

Do we have one CI job that runs tests without Rust? If not I think
we should have one so that we can verify that Git continues to build
just fine without it while it's not yet mandatory.

Edit: I see you ensure that we do in a later commit.

Patrick

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/4] Linux: link against libdl
  2026-04-03  1:12 ` [PATCH 3/4] Linux: link against libdl brian m. carlson
@ 2026-04-08 10:12   ` Patrick Steinhardt
  0 siblings, 0 replies; 9+ messages in thread
From: Patrick Steinhardt @ 2026-04-08 10:12 UTC (permalink / raw)
  To: brian m. carlson; +Cc: git, Junio C Hamano, Ezekiel Newren

On Fri, Apr 03, 2026 at 01:12:48AM +0000, brian m. carlson wrote:
> Older versions of Rust on Linux, such as that used in Debian 11 in our
> CI, require linking against libdl.  Were we linking with Cargo, this
> would be included automatically, but since we're not, explicitly set it
> in the system-specific config.
> 
> This library is part of libc, so linking against it if it happens to be
> unnecessary will add no dependencies to the resulting binary.  In
> addition, it is provided by both glibc and musl, so it should be
> portable to almost all Linux systems.

Fair. I was wondering whether we should make this conditional on
WITH_RUST, but if it doesn't make a difference anyway I don't see why we
should.

Patrick

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] Enable Rust by default
  2026-04-03  1:12 ` [PATCH 4/4] Enable Rust by default brian m. carlson
@ 2026-04-08 10:12   ` Patrick Steinhardt
  0 siblings, 0 replies; 9+ messages in thread
From: Patrick Steinhardt @ 2026-04-08 10:12 UTC (permalink / raw)
  To: brian m. carlson; +Cc: git, Junio C Hamano, Ezekiel Newren

On Fri, Apr 03, 2026 at 01:12:49AM +0000, brian m. carlson wrote:
> diff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh
> index 28cfe730ee..bf1fdbe968 100755
> --- a/ci/run-build-and-tests.sh
> +++ b/ci/run-build-and-tests.sh
> @@ -10,7 +10,6 @@ export TEST_CONTRIB_TOO=yes
>  case "$jobname" in
>  fedora-breaking-changes-musl|linux-breaking-changes)
>  	export WITH_BREAKING_CHANGES=YesPlease
> -	export WITH_RUST=YesPlease
>  	MESONFLAGS="$MESONFLAGS -Dbreaking_changes=true"
>  	MESONFLAGS="$MESONFLAGS -Drust=enabled"

I guess we can drop this flag, as well.

> @@ -30,6 +29,7 @@ linux-TEST-vars)
>  	export GIT_TEST_PACK_USE_BITMAP_BOUNDARY_TRAVERSAL=1
>  	;;
>  linux-clang)
> +	export NO_RUST=UnfortunatelyYes
>  	export GIT_TEST_DEFAULT_HASH=sha1
>  	;;
>  linux-sha256)

Do we also want to to adjust one of the Meson-based jobs to not run with
Rust?

> diff --git a/meson.build b/meson.build
> index 8309942d18..4e1a58ee01 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1746,7 +1746,7 @@ version_def_h = custom_target(
>  libgit_sources += version_def_h
>  
>  cargo = find_program('cargo', dirs: program_path, native: true, required: get_option('rust'))

We should probably move this line into "src/meson.build".

> -rust_option = get_option('rust').disable_auto_if(not cargo.found())
> +rust_option = get_option('rust')
>  if rust_option.allowed()
>    subdir('src')
>    libgit_c_args += '-DWITH_RUST'

Patrick

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-04-08 10:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-03  1:12 [PATCH 0/4] Enable Rust by default brian m. carlson
2026-04-03  1:12 ` [PATCH 1/4] docs: update version with default Rust support brian m. carlson
2026-04-03  1:12 ` [PATCH 2/4] ci: install cargo on Alpine brian m. carlson
2026-04-08 10:12   ` Patrick Steinhardt
2026-04-03  1:12 ` [PATCH 3/4] Linux: link against libdl brian m. carlson
2026-04-08 10:12   ` Patrick Steinhardt
2026-04-03  1:12 ` [PATCH 4/4] Enable Rust by default brian m. carlson
2026-04-08 10:12   ` Patrick Steinhardt
2026-04-03  5:04 ` [PATCH 0/4] " Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox