{"thread":{"id":"64921","subject":"[RFC PATCH] Move rust gitcore crate to a different subdirectory","startedAt":"2026-02-05T00:00:55Z","lastAt":"2026-09-18T15:02:59Z","messageCount":18,"participants":["Mike Hommey","brian m. carlson","Junio C Hamano","Tuomas Ahola"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"535198","messageId":"20260204232208.1615320-1-mh@glandium.org","threadId":"64921","inReplyTo":null,"subject":"[RFC PATCH] Move rust gitcore crate to a different subdirectory","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2026-02-04T23:22:08Z","receivedAt":"2026-02-05T00:00:55Z","isPatch":true,"body":"While `src/` is the default directory convention for Rust projects, it\nis too generic in the context of a multi-language project that is barely\nstarting to (optionally) use Rust code.\n\nAdditionally, having `Cargo.toml` at the top-level of the repository\nimplies that one can run `cargo build` directly, but this doesn't\nproduce anything useful on its own.\n\nMoving all Rust-specific files into a dedicated `rust/` subdirectory\nmakes things clearer.\n\n---\n\nThe above is a post hoc justification. I do think it makes sense to do,\nbut I should mention my real immediate motivation.\n\ngit-cinnabar, a git remote helper used to talk to Mercurial servers, is\na project based on libgit (the C parts). As such, its repository\nincludes the git codebase as a submodule.\n\nAs of about 3 years ago, most code that is not libgit in git-cinnabar is\nwritten in Rust, and is published on crates.io.\n\nPart of publishing on crates.io involves running `cargo publish`, which\ndoes `cargo package` under the hood. `cargo package` has the feature\nof... not including directories that contain a Cargo.toml, so upgrading\nlibgit to 2.52.0 breaks the publishing process because all of the git\nsource code is skipped, and git-cinnabar can't be built as a result.\n\nOf course, what this means is that this change is merely kicking the can\ndown the road, because the problem will reappear when the rust code\nbecomes non-optional in Git, thus why I'm making this RFC at the moment.\n\n .gitignore                    |  2 ++\n Makefile                      | 12 ++++++------\n meson.build                   |  2 +-\n Cargo.toml => rust/Cargo.toml |  1 +\n {src => rust}/cargo-meson.sh  |  0\n {src => rust}/lib.rs          |  0\n {src => rust}/meson.build     |  0\n {src => rust}/varint.rs       |  0\n 8 files changed, 10 insertions(+), 7 deletions(-)\n rename Cargo.toml => rust/Cargo.toml (89%)\n rename {src => rust}/cargo-meson.sh (100%)\n rename {src => rust}/lib.rs (100%)\n rename {src => rust}/meson.build (100%)\n rename {src => rust}/varint.rs (100%)\n\ndiff --git a/.gitignore b/.gitignore\nindex 78a45cb5be..c7453b6fb2 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -258,3 +258,5 @@ Release/\n /contrib/buildsystems/out\n /contrib/libgit-rs/target\n /contrib/libgit-sys/target\n+/rust/target\n+/rust/Cargo.lock\ndiff --git a/Makefile b/Makefile\nindex 8aa489f3b6..d7e9b7fd75 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -939,9 +939,9 @@ TEST_SHELL_PATH = $(SHELL_PATH)\n LIB_FILE = libgit.a\n \n ifdef DEBUG\n-RUST_TARGET_DIR = target/debug\n+RUST_TARGET_DIR = rust/target/debug\n else\n-RUST_TARGET_DIR = target/release\n+RUST_TARGET_DIR = rust/target/release\n endif\n \n ifeq ($(uname_S),Windows)\n@@ -1545,8 +1545,8 @@ CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/unit-test.o\n \n UNIT_TEST_OBJS += $(UNIT_TEST_DIR)/test-lib.o\n \n-RUST_SOURCES += src/lib.rs\n-RUST_SOURCES += src/varint.rs\n+RUST_SOURCES += rust/lib.rs\n+RUST_SOURCES += rust/varint.rs\n \n GIT-VERSION-FILE: FORCE\n \t@OLD=$$(cat $@ 2>/dev/null || :) && \\\n@@ -3007,8 +3007,8 @@ scalar$X: scalar.o GIT-LDFLAGS $(GITLIBS)\n $(LIB_FILE): $(LIB_OBJS)\n \t$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^\n \n-$(RUST_LIB): Cargo.toml $(RUST_SOURCES)\n-\t$(QUIET_CARGO)cargo build $(CARGO_ARGS)\n+$(RUST_LIB): rust/Cargo.toml $(RUST_SOURCES)\n+\t$(QUIET_CARGO)cargo build --manifest-path rust/Cargo.toml $(CARGO_ARGS)\n \n .PHONY: rust\n rust: $(RUST_LIB)\ndiff --git a/meson.build b/meson.build\nindex dd52efd1c8..6732198042 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -1723,7 +1723,7 @@ libgit_sources += version_def_h\n cargo = find_program('cargo', dirs: program_path, native: true, required: get_option('rust'))\n rust_option = get_option('rust').disable_auto_if(not cargo.found())\n if rust_option.allowed()\n-  subdir('src')\n+  subdir('rust')\n   libgit_c_args += '-DWITH_RUST'\n \n   if host_machine.system() == 'windows'\ndiff --git a/Cargo.toml b/rust/Cargo.toml\nsimilarity index 89%\nrename from Cargo.toml\nrename to rust/Cargo.toml\nindex 2f51bf5d5f..29e6d1f4e1 100644\n--- a/Cargo.toml\n+++ b/rust/Cargo.toml\n@@ -6,5 +6,6 @@ rust-version = \"1.49.0\"\n \n [lib]\n crate-type = [\"staticlib\"]\n+path = \"lib.rs\"\n \n [dependencies]\ndiff --git a/src/cargo-meson.sh b/rust/cargo-meson.sh\nsimilarity index 100%\nrename from src/cargo-meson.sh\nrename to rust/cargo-meson.sh\ndiff --git a/src/lib.rs b/rust/lib.rs\nsimilarity index 100%\nrename from src/lib.rs\nrename to rust/lib.rs\ndiff --git a/src/meson.build b/rust/meson.build\nsimilarity index 100%\nrename from src/meson.build\nrename to rust/meson.build\ndiff --git a/src/varint.rs b/rust/varint.rs\nsimilarity index 100%\nrename from src/varint.rs\nrename to rust/varint.rs\n-- \n2.53.0.1.g318204b87e.dirty\n\n"},{"id":"535200","messageId":"aYPf9CnNLjJtinqw@fruit.crustytoothpaste.net","threadId":"64921","inReplyTo":"20260204232208.1615320-1-mh@glandium.org","subject":"Re: [RFC PATCH] Move rust gitcore crate to a different subdirectory","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2026-02-05T00:10:28Z","receivedAt":"2026-02-05T00:10:31Z","isPatch":true,"body":"On 2026-02-04 at 23:22:08, Mike Hommey wrote:\n> While `src/` is the default directory convention for Rust projects, it\n> is too generic in the context of a multi-language project that is barely\n> starting to (optionally) use Rust code.\n> \n> Additionally, having `Cargo.toml` at the top-level of the repository\n> implies that one can run `cargo build` directly, but this doesn't\n> produce anything useful on its own.\n> \n> Moving all Rust-specific files into a dedicated `rust/` subdirectory\n> makes things clearer.\n\nIf we're going to do this, we should place the `src` directory under the\n`rust` subdirectory to maintain the normal layout.  There are many tools\nthat depend on this repository layout and we want to make it as easy as\npossible for people to use native, standard tooling to build things.\n\nNote that I don't have strong opinions for or against placing the Rust\ncode in a subdirectory, but I do very much want the standard layout to\nbe honoured.\n\n> The above is a post hoc justification. I do think it makes sense to do,\n> but I should mention my real immediate motivation.\n> \n> git-cinnabar, a git remote helper used to talk to Mercurial servers, is\n> a project based on libgit (the C parts). As such, its repository\n> includes the git codebase as a submodule.\n> \n> As of about 3 years ago, most code that is not libgit in git-cinnabar is\n> written in Rust, and is published on crates.io.\n> \n> Part of publishing on crates.io involves running `cargo publish`, which\n> does `cargo package` under the hood. `cargo package` has the feature\n> of... not including directories that contain a Cargo.toml, so upgrading\n> libgit to 2.52.0 breaks the publishing process because all of the git\n> source code is skipped, and git-cinnabar can't be built as a result.\n> \n> Of course, what this means is that this change is merely kicking the can\n> down the road, because the problem will reappear when the rust code\n> becomes non-optional in Git, thus why I'm making this RFC at the moment.\n\nPerhaps you could ask Cargo upstream to add a feature to override that\nin the meantime (or add such a feature yourself).  I can imagine other\nuses for such a feature.\n-- \nbrian m. carlson (they/them)\nToronto, Ontario, CA\n"},{"id":"535202","messageId":"5h7fs4smilvvuqyry4uef3rjgky5woodmapb3fy72src2hvlzv@o3bbh7zxqqvt","threadId":"64921","inReplyTo":"aYPf9CnNLjJtinqw@fruit.crustytoothpaste.net","subject":"Re: [RFC PATCH] Move rust gitcore crate to a different subdirectory","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2026-02-05T01:45:53Z","receivedAt":"2026-02-05T01:46:09Z","isPatch":true,"body":"On Thu, Feb 05, 2026 at 12:10:28AM +0000, brian m. carlson wrote:\n> On 2026-02-04 at 23:22:08, Mike Hommey wrote:\n> > While `src/` is the default directory convention for Rust projects, it\n> > is too generic in the context of a multi-language project that is barely\n> > starting to (optionally) use Rust code.\n> > \n> > Additionally, having `Cargo.toml` at the top-level of the repository\n> > implies that one can run `cargo build` directly, but this doesn't\n> > produce anything useful on its own.\n> > \n> > Moving all Rust-specific files into a dedicated `rust/` subdirectory\n> > makes things clearer.\n> \n> If we're going to do this, we should place the `src` directory under the\n> `rust` subdirectory to maintain the normal layout.  There are many tools\n> that depend on this repository layout and we want to make it as easy as\n> possible for people to use native, standard tooling to build things.\n\nNot that I'm going to argue your preference, but I'm curious what tools\nyou'd know that would not support a layout different than the typical\none, because that means they're broken with some existing crates (e.g.\nthose from https://github.com/servo/servo/) and should probably be\nfixed.\n\nIt might also be worth moving into a rust/gitcore/src directory too,\nincluding the crate name in the path.\n\n> Note that I don't have strong opinions for or against placing the Rust\n> code in a subdirectory, but I do very much want the standard layout to\n> be honoured.\n> \n> > The above is a post hoc justification. I do think it makes sense to do,\n> > but I should mention my real immediate motivation.\n> > \n> > git-cinnabar, a git remote helper used to talk to Mercurial servers, is\n> > a project based on libgit (the C parts). As such, its repository\n> > includes the git codebase as a submodule.\n> > \n> > As of about 3 years ago, most code that is not libgit in git-cinnabar is\n> > written in Rust, and is published on crates.io.\n> > \n> > Part of publishing on crates.io involves running `cargo publish`, which\n> > does `cargo package` under the hood. `cargo package` has the feature\n> > of... not including directories that contain a Cargo.toml, so upgrading\n> > libgit to 2.52.0 breaks the publishing process because all of the git\n> > source code is skipped, and git-cinnabar can't be built as a result.\n> > \n> > Of course, what this means is that this change is merely kicking the can\n> > down the road, because the problem will reappear when the rust code\n> > becomes non-optional in Git, thus why I'm making this RFC at the moment.\n> \n> Perhaps you could ask Cargo upstream to add a feature to override that\n> in the meantime (or add such a feature yourself).  I can imagine other\n> uses for such a feature.\n\nI'm not sure this would be well received, considering there are already\n`exclude` and `include` fields to control such things, and they\nexplicitly and purposely don't act on directories with a Cargo.toml:\n\n| Regardless of whether exclude or include is specified, the following\n| files are always excluded:\n|   - Any sub-packages will be skipped (any subdirectory that contains a\n|     Cargo.toml file).\n|   - A directory named target in the root of the package will be skipped.\nhttps://doc.rust-lang.org/cargo/reference/manifest.html#the-exclude-and-include-fields\n\nMike\n"},{"id":"535204","messageId":"aYP7KKD1tDsormI3@fruit.crustytoothpaste.net","threadId":"64921","inReplyTo":"5h7fs4smilvvuqyry4uef3rjgky5woodmapb3fy72src2hvlzv@o3bbh7zxqqvt","subject":"Re: [RFC PATCH] Move rust gitcore crate to a different subdirectory","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2026-02-05T02:06:32Z","receivedAt":"2026-02-05T02:06:34Z","isPatch":true,"body":"On 2026-02-05 at 01:45:53, Mike Hommey wrote:\n> On Thu, Feb 05, 2026 at 12:10:28AM +0000, brian m. carlson wrote:\n> > On 2026-02-04 at 23:22:08, Mike Hommey wrote:\n> > > While `src/` is the default directory convention for Rust projects, it\n> > > is too generic in the context of a multi-language project that is barely\n> > > starting to (optionally) use Rust code.\n> > > \n> > > Additionally, having `Cargo.toml` at the top-level of the repository\n> > > implies that one can run `cargo build` directly, but this doesn't\n> > > produce anything useful on its own.\n> > > \n> > > Moving all Rust-specific files into a dedicated `rust/` subdirectory\n> > > makes things clearer.\n> > \n> > If we're going to do this, we should place the `src` directory under the\n> > `rust` subdirectory to maintain the normal layout.  There are many tools\n> > that depend on this repository layout and we want to make it as easy as\n> > possible for people to use native, standard tooling to build things.\n> \n> Not that I'm going to argue your preference, but I'm curious what tools\n> you'd know that would not support a layout different than the typical\n> one, because that means they're broken with some existing crates (e.g.\n> those from https://github.com/servo/servo/) and should probably be\n> fixed.\n\nOne of my goals is to see if we can get Git's Rust code to compile with\nmrustc since that might make it easier for NonStop, as well as some\nLinux OSes on obsolete architectures.\n\nI can tell you from my experience that mrustc's cargo implementation is\nextremely limited and does only the bare minimum in terms of\nfunctionality.  It already needs some help to work with static\nlibraries, but I'd really like to minimize the work that needs to be\ndone on it since it's not lovely code, and using a standard layout is\ngoing to help with minimizing the necessary changes.  I will admit that\nI haven't tested using a non-standard layout, but I fully expect it will\nnot work based on my experience of the codebase.\n\nCertainly people may think this is folly, but it costs nothing for us to\nkeep the standard layout and make the porting process a little easier.\n-- \nbrian m. carlson (they/them)\nToronto, Ontario, CA\n"},{"id":"535207","messageId":"nabuy27x5sqyp5sjselp7lbxqnvov2mtemvke7geucn6a2ixg2@62s4t5gkhsdo","threadId":"64921","inReplyTo":"aYP7KKD1tDsormI3@fruit.crustytoothpaste.net","subject":"Re: [RFC PATCH] Move rust gitcore crate to a different subdirectory","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2026-02-05T04:55:16Z","receivedAt":"2026-02-05T04:55:28Z","isPatch":true,"body":"On Thu, Feb 05, 2026 at 02:06:32AM +0000, brian m. carlson wrote:\n> I can tell you from my experience that mrustc's cargo implementation is\n> extremely limited and does only the bare minimum in terms of\n> functionality.  It already needs some help to work with static\n> libraries, but I'd really like to minimize the work that needs to be\n> done on it since it's not lovely code, and using a standard layout is\n> going to help with minimizing the necessary changes.  I will admit that\n> I haven't tested using a non-standard layout, but I fully expect it will\n> not work based on my experience of the codebase.\n\nFor what it's worth, it looks like mrustc supports non-standard layout\njust fine[1], and that's not totally surprising, because the rustc codebase\nused to use non-standard layouts a lot (although that's not true\nanymore)\n\n1. https://github.com/thepowersgang/mrustc/blob/7ff9513adb7cdbe0f8799e7b1f2e4df00ae21a14/tools/minicargo/manifest.cpp#L772\n"},{"id":"535617","messageId":"20260209224847.1416916-1-mh@glandium.org","threadId":"64921","inReplyTo":"20260204232208.1615320-1-mh@glandium.org","subject":"[PATCH v2] Move rust gitcore crate to a different subdirectory","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2026-02-09T22:48:47Z","receivedAt":"2026-02-09T22:49:11Z","isPatch":true,"body":"While `src/` is the default directory convention for Rust projects, it\nis too generic in the context of a multi-language project that is barely\nstarting to (optionally) use Rust code.\n\nAdditionally, having `Cargo.toml` at the top-level of the repository\nimplies that one can run `cargo build` directly, but this doesn't\nproduce anything useful on its own.\n\nMoving all Rust-specific files into a dedicated `rust/` subdirectory\nmakes things clearer.\n\nSigned-off-by: Mike Hommey <mh@glandium.org>\n---\n .gitignore                    |  2 ++\n Makefile                      | 12 ++++++------\n meson.build                   |  2 +-\n Cargo.toml => rust/Cargo.toml |  0\n {src => rust}/cargo-meson.sh  |  0\n {src => rust}/meson.build     |  6 +++---\n {src => rust/src}/lib.rs      |  0\n {src => rust/src}/varint.rs   |  0\n 8 files changed, 12 insertions(+), 10 deletions(-)\n rename Cargo.toml => rust/Cargo.toml (100%)\n rename {src => rust}/cargo-meson.sh (100%)\n rename {src => rust}/meson.build (87%)\n rename {src => rust/src}/lib.rs (100%)\n rename {src => rust/src}/varint.rs (100%)\n\ndiff --git a/.gitignore b/.gitignore\nindex 78a45cb5be..c7453b6fb2 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -258,3 +258,5 @@ Release/\n /contrib/buildsystems/out\n /contrib/libgit-rs/target\n /contrib/libgit-sys/target\n+/rust/target\n+/rust/Cargo.lock\ndiff --git a/Makefile b/Makefile\nindex 8aa489f3b6..b60af704ed 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -939,9 +939,9 @@ TEST_SHELL_PATH = $(SHELL_PATH)\n LIB_FILE = libgit.a\n \n ifdef DEBUG\n-RUST_TARGET_DIR = target/debug\n+RUST_TARGET_DIR = rust/target/debug\n else\n-RUST_TARGET_DIR = target/release\n+RUST_TARGET_DIR = rust/target/release\n endif\n \n ifeq ($(uname_S),Windows)\n@@ -1545,8 +1545,8 @@ CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/unit-test.o\n \n UNIT_TEST_OBJS += $(UNIT_TEST_DIR)/test-lib.o\n \n-RUST_SOURCES += src/lib.rs\n-RUST_SOURCES += src/varint.rs\n+RUST_SOURCES += rust/src/lib.rs\n+RUST_SOURCES += rust/src/varint.rs\n \n GIT-VERSION-FILE: FORCE\n \t@OLD=$$(cat $@ 2>/dev/null || :) && \\\n@@ -3007,8 +3007,8 @@ scalar$X: scalar.o GIT-LDFLAGS $(GITLIBS)\n $(LIB_FILE): $(LIB_OBJS)\n \t$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^\n \n-$(RUST_LIB): Cargo.toml $(RUST_SOURCES)\n-\t$(QUIET_CARGO)cargo build $(CARGO_ARGS)\n+$(RUST_LIB): rust/Cargo.toml $(RUST_SOURCES)\n+\t$(QUIET_CARGO)cargo build --manifest-path rust/Cargo.toml $(CARGO_ARGS)\n \n .PHONY: rust\n rust: $(RUST_LIB)\ndiff --git a/meson.build b/meson.build\nindex dd52efd1c8..3a92936241 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -1723,7 +1723,7 @@ libgit_sources += version_def_h\n cargo = find_program('cargo', dirs: program_path, native: true, required: get_option('rust'))\n rust_option = get_option('rust').disable_auto_if(not cargo.found())\n if rust_option.allowed()\n-  subdir('src')\n+  subdir('rust/src')\n   libgit_c_args += '-DWITH_RUST'\n \n   if host_machine.system() == 'windows'\ndiff --git a/Cargo.toml b/rust/Cargo.toml\nsimilarity index 100%\nrename from Cargo.toml\nrename to rust/Cargo.toml\ndiff --git a/src/cargo-meson.sh b/rust/cargo-meson.sh\nsimilarity index 100%\nrename from src/cargo-meson.sh\nrename to rust/cargo-meson.sh\ndiff --git a/src/meson.build b/rust/meson.build\nsimilarity index 87%\nrename from src/meson.build\nrename to rust/meson.build\nindex 25b9ad5a14..9490272521 100644\n--- a/src/meson.build\n+++ b/rust/meson.build\n@@ -10,7 +10,7 @@ libgit_rs_sources = [\n cargo_command = [\n   shell,\n   meson.current_source_dir() / 'cargo-meson.sh',\n-  meson.project_source_root(),\n+  meson.current_source_dir(),\n   meson.current_build_dir(),\n ]\n if get_option('buildtype') == 'release'\n@@ -19,7 +19,7 @@ endif\n \n libgit_rs = custom_target('git_rs',\n   input: libgit_rs_sources + [\n-    meson.project_source_root() / 'Cargo.toml',\n+    meson.current_source_dir() / 'Cargo.toml',\n   ],\n   output: 'libgitcore.a',\n   command: cargo_command,\n@@ -31,7 +31,7 @@ if get_option('tests')\n     args: [\n       'test',\n       '--manifest-path',\n-      meson.project_source_root() / 'Cargo.toml',\n+      meson.current_source_dir() / 'Cargo.toml',\n       '--target-dir',\n       meson.current_build_dir() / 'target',\n     ],\ndiff --git a/src/lib.rs b/rust/src/lib.rs\nsimilarity index 100%\nrename from src/lib.rs\nrename to rust/src/lib.rs\ndiff --git a/src/varint.rs b/rust/src/varint.rs\nsimilarity index 100%\nrename from src/varint.rs\nrename to rust/src/varint.rs\n-- \n2.52.0\n\n"},{"id":"552276","messageId":"20260909013858.1729643-1-mh@glandium.org","threadId":"64921","inReplyTo":"20260209224847.1416916-1-mh@glandium.org","subject":"[PATCH v3] Move rust gitcore crate to a different subdirectory","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2026-09-09T01:38:58Z","receivedAt":"2026-09-09T02:02:41Z","isPatch":true,"body":"Having `Cargo.toml` at the top-level of the repository implies that one\ncan run `cargo build` directly, but this doesn't produce anything useful\non its own.\n\nAdditionally, when including the git source as a submodule of a Rust\nproject, it prevents the git source from being included at all in the\ncrate package because cargo skips directories that contain a Cargo.toml,\nassuming that everything in the directory is relevant to the crate.\n\nThis moves all Rust-specific files into a dedicated `rust/`\nsubdirectory.\n\nSigned-off-by: Mike Hommey <mh@glandium.org>\n---\n .gitignore                     |  2 ++\n Makefile                       | 26 ++++++++++++++------------\n meson.build                    |  2 +-\n Cargo.toml => rust/Cargo.toml  |  0\n {src => rust}/cargo-meson.sh   |  0\n {src => rust}/meson.build      |  6 +++---\n {src => rust/src}/csum_file.rs |  0\n {src => rust/src}/hash.rs      |  0\n {src => rust/src}/lib.rs       |  0\n {src => rust/src}/loose.rs     |  0\n {src => rust/src}/varint.rs    |  0\n 11 files changed, 20 insertions(+), 16 deletions(-)\n rename Cargo.toml => rust/Cargo.toml (100%)\n rename {src => rust}/cargo-meson.sh (100%)\n rename {src => rust}/meson.build (88%)\n rename {src => rust/src}/csum_file.rs (100%)\n rename {src => rust/src}/hash.rs (100%)\n rename {src => rust/src}/lib.rs (100%)\n rename {src => rust/src}/loose.rs (100%)\n rename {src => rust/src}/varint.rs (100%)\n\ndiff --git a/.gitignore b/.gitignore\nindex 4da58c6754..3ac0685800 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -261,3 +261,5 @@ Release/\n /contrib/buildsystems/out\n /contrib/libgit-rs/target\n /contrib/libgit-sys/target\n+/rust/target\n+/rust/Cargo.lock\ndiff --git a/Makefile b/Makefile\nindex d4b775953d..7991fa378d 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -959,7 +959,7 @@ RUST_LIB_NAME = gitcore.lib\n else\n RUST_LIB_NAME = libgitcore.a\n endif\n-RUST_LIB = target/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME)\n+RUST_LIB = rust/target/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME)\n endif\n \n GITLIBS = common-main.o $(LIB_FILE)\n@@ -1571,11 +1571,13 @@ CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/unit-test.o\n \n UNIT_TEST_OBJS += $(UNIT_TEST_DIR)/test-lib.o\n \n-RUST_SOURCES += src/csum_file.rs\n-RUST_SOURCES += src/hash.rs\n-RUST_SOURCES += src/lib.rs\n-RUST_SOURCES += src/loose.rs\n-RUST_SOURCES += src/varint.rs\n+RUST_SOURCES += rust/src/csum_file.rs\n+RUST_SOURCES += rust/src/hash.rs\n+RUST_SOURCES += rust/src/lib.rs\n+RUST_SOURCES += rust/src/loose.rs\n+RUST_SOURCES += rust/src/varint.rs\n+RUST_SOURCES += rust/src/lib.rs\n+RUST_SOURCES += rust/src/varint.rs\n \n GIT-VERSION-FILE: FORCE\n \t@OLD=$$(cat $@ 2>/dev/null || :) && \\\n@@ -3038,8 +3040,8 @@ $(LIB_FILE): $(LIB_OBJS)\n \n ifndef NO_RUST\n ifeq ($(RUST_TARGETS),)\n-$(RUST_LIB): Cargo.toml $(RUST_SOURCES) $(LIB_FILE)\n-\t$(QUIET_CARGO)cargo build $(CARGO_ARGS)\n+$(RUST_LIB): rust/Cargo.toml $(RUST_SOURCES) $(LIB_FILE)\n+\t$(QUIET_CARGO)cargo build --manifest-path rust/Cargo.toml $(CARGO_ARGS)\n else\n ifneq ($(words $(RUST_TARGETS)),1)\n ifneq ($(uname_S),Darwin)\n@@ -3047,9 +3049,9 @@ $(error Building universal Rust libraries requires macOS (lipo is not available\n endif\n endif\n \n-RUST_MEMBER_LIBS = $(foreach target,$(RUST_TARGETS),target/$(target)/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME))\n-$(RUST_MEMBER_LIBS): target/%/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME): Cargo.toml $(RUST_SOURCES) $(LIB_FILE)\n-\t$(QUIET_CARGO)cargo build $(CARGO_ARGS) --target $*\n+RUST_MEMBER_LIBS = $(foreach target,$(RUST_TARGETS),rust/target/$(target)/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME))\n+$(RUST_MEMBER_LIBS): rust/target/%/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME): rust/Cargo.toml $(RUST_SOURCES) $(LIB_FILE)\n+\t$(QUIET_CARGO)cargo build --manifest-path rust/Cargo.toml $(CARGO_ARGS) --target $*\n \n $(RUST_LIB): $(RUST_MEMBER_LIBS)\n \t$(call mkdir_p_parent_template)\n@@ -3913,7 +3915,7 @@ clean: profile-clean coverage-clean cocciclean\n \t$(RM) $(FUZZ_PROGRAMS)\n \t$(RM) $(SP_OBJ)\n \t$(RM) $(HCC)\n-\t$(RM) -r Cargo.lock target/\n+\t$(RM) -r Cargo.lock rust/target/\n \t$(RM) version-def.h\n \t$(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json\n \t$(RM) $(test_bindir_programs)\ndiff --git a/meson.build b/meson.build\nindex d86f2acd2b..b91d30666e 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -1782,7 +1782,7 @@ libgit_sources += version_def_h\n \n rust_option = get_option('rust')\n if rust_option.allowed()\n-  subdir('src')\n+  subdir('rust/src')\n   libgit_c_args += '-DWITH_RUST'\n \n   if host_machine.system() == 'windows'\ndiff --git a/Cargo.toml b/rust/Cargo.toml\nsimilarity index 100%\nrename from Cargo.toml\nrename to rust/Cargo.toml\ndiff --git a/src/cargo-meson.sh b/rust/cargo-meson.sh\nsimilarity index 100%\nrename from src/cargo-meson.sh\nrename to rust/cargo-meson.sh\ndiff --git a/src/meson.build b/rust/meson.build\nsimilarity index 88%\nrename from src/meson.build\nrename to rust/meson.build\nindex 41a4b231e6..495931f75a 100644\n--- a/src/meson.build\n+++ b/rust/meson.build\n@@ -13,7 +13,7 @@ libgit_rs_sources = [\n cargo_command = [\n   shell,\n   meson.current_source_dir() / 'cargo-meson.sh',\n-  meson.project_source_root(),\n+  meson.current_source_dir(),\n   meson.current_build_dir(),\n ]\n if get_option('buildtype') == 'release'\n@@ -22,7 +22,7 @@ endif\n \n libgit_rs = custom_target('git_rs',\n   input: libgit_rs_sources + [\n-    meson.project_source_root() / 'Cargo.toml',\n+    meson.current_source_dir() / 'Cargo.toml',\n   ],\n   output: 'libgitcore.a',\n   command: cargo_command,\n@@ -35,7 +35,7 @@ if get_option('tests')\n     args: [\n       'test',\n       '--manifest-path',\n-      meson.project_source_root() / 'Cargo.toml',\n+      meson.current_source_dir() / 'Cargo.toml',\n       '--target-dir',\n       meson.current_build_dir() / 'target',\n     ],\ndiff --git a/src/csum_file.rs b/rust/src/csum_file.rs\nsimilarity index 100%\nrename from src/csum_file.rs\nrename to rust/src/csum_file.rs\ndiff --git a/src/hash.rs b/rust/src/hash.rs\nsimilarity index 100%\nrename from src/hash.rs\nrename to rust/src/hash.rs\ndiff --git a/src/lib.rs b/rust/src/lib.rs\nsimilarity index 100%\nrename from src/lib.rs\nrename to rust/src/lib.rs\ndiff --git a/src/loose.rs b/rust/src/loose.rs\nsimilarity index 100%\nrename from src/loose.rs\nrename to rust/src/loose.rs\ndiff --git a/src/varint.rs b/rust/src/varint.rs\nsimilarity index 100%\nrename from src/varint.rs\nrename to rust/src/varint.rs\n-- \n2.55.0.806.gb8242b093d.dirty\n\n"},{"id":"552371","messageId":"xmqqbja6qjyc.fsf@gitster.g","threadId":"64921","inReplyTo":"20260909013858.1729643-1-mh@glandium.org","subject":"Re: [PATCH v3] Move rust gitcore crate to a different subdirectory","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-09-09T19:54:35Z","receivedAt":"2026-09-09T19:54:37Z","isPatch":true,"body":"Mike Hommey <mh@glandium.org> writes:\n> \n> Having `Cargo.toml` at the top-level of the repository implies that one\n> can run `cargo build` directly, but this doesn't produce anything useful\n> on its own.\n>\n> Additionally, when including the git source as a submodule of a Rust\n> project, it prevents the git source from being included at all in the\n> crate package because cargo skips directories that contain a Cargo.toml,\n> assuming that everything in the directory is relevant to the crate.\n>\n> This moves all Rust-specific files into a dedicated `rust/`\n> subdirectory.\n\nVery readable and understandable.  It is customary in this project\nto write that last sentence in imperative mood, though.  I.e.  \"Move\nall files there\".\n\n> Signed-off-by: Mike Hommey <mh@glandium.org>\n\n\n> diff --git a/.gitignore b/.gitignore\n> index 4da58c6754..3ac0685800 100644\n> --- a/.gitignore\n> +++ b/.gitignore\n> @@ -261,3 +261,5 @@ Release/\n>  /contrib/buildsystems/out\n>  /contrib/libgit-rs/target\n>  /contrib/libgit-sys/target\n> +/rust/target\n> +/rust/Cargo.lock\n\nThere are /target/ and /Cargo.lock listed in this file; aren't these\ntwo entries meant to _replace_ them?  I am wondering if they need to\ndisappear as part of this patfch.\n\n> diff --git a/Makefile b/Makefile\n> index d4b775953d..7991fa378d 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -1571,11 +1571,13 @@ CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/unit-test.o\n>  \n>  UNIT_TEST_OBJS += $(UNIT_TEST_DIR)/test-lib.o\n>  \n> -RUST_SOURCES += src/csum_file.rs\n> -RUST_SOURCES += src/hash.rs\n> -RUST_SOURCES += src/lib.rs\n> -RUST_SOURCES += src/loose.rs\n> -RUST_SOURCES += src/varint.rs\n\n> +RUST_SOURCES += rust/src/csum_file.rs\n> +RUST_SOURCES += rust/src/hash.rs\n> +RUST_SOURCES += rust/src/lib.rs\n> +RUST_SOURCES += rust/src/loose.rs\n> +RUST_SOURCES += rust/src/varint.rs\n> +RUST_SOURCES += rust/src/lib.rs\n> +RUST_SOURCES += rust/src/varint.rs\n\nTwo files, lib and varint, are listed twice here.  A rebase error or\nsomething?\n\n> @@ -3913,7 +3915,7 @@ clean: profile-clean coverage-clean cocciclean\n>  \t$(RM) $(FUZZ_PROGRAMS)\n>  \t$(RM) $(SP_OBJ)\n>  \t$(RM) $(HCC)\n> -\t$(RM) -r Cargo.lock target/\n> +\t$(RM) -r Cargo.lock rust/target/\n\nThe Cargo.lock file does not move together with the rest?  That\ncontradicts with what .gitignore says, doesn't it?\n"},{"id":"552380","messageId":"aqHMDErmQ0BdQlVD@fruit.crustytoothpaste.net","threadId":"64921","inReplyTo":"20260909013858.1729643-1-mh@glandium.org","subject":"Re: [PATCH v3] Move rust gitcore crate to a different subdirectory","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2026-09-09T21:13:49Z","receivedAt":"2026-09-09T21:13:59Z","isPatch":true,"body":"On 2026-09-09 at 01:38:58, Mike Hommey wrote:\n> Having `Cargo.toml` at the top-level of the repository implies that one\n> can run `cargo build` directly, but this doesn't produce anything useful\n> on its own.\n> \n> Additionally, when including the git source as a submodule of a Rust\n> project, it prevents the git source from being included at all in the\n> crate package because cargo skips directories that contain a Cargo.toml,\n> assuming that everything in the directory is relevant to the crate.\n\nSo what I understand is that you have a project which has Git as a\nsubmodule and you want to include the Git source code into the crate\npackage for that project.  In other words, you're vendoring Git to use\nits C components, but not its Rust components.\n\nIf that's the case, how do you plan that to work in a few releases when\nGit 3.0 comes out and the Rust components become mandatory?  If you\ndon't plan for it to work, wouldn't it be better to adopt a different\nstrategy now rather than implementing a workaround that will be broken\nin a short time?\n-- \nbrian m. carlson (they/them)\nToronto, Ontario, CA\n"},{"id":"552411","messageId":"20260910062758.RcjdX%taahol@utu.fi","threadId":"64921","inReplyTo":"20260909013858.1729643-1-mh@glandium.org","subject":"Re: [PATCH v3] Move rust gitcore crate to a different subdirectory","fromName":"Tuomas Ahola","fromEmail":"taahol@utu.fi","sentAt":"2026-09-10T06:27:58Z","receivedAt":"2026-09-10T06:28:27Z","isPatch":true,"body":"Mike Hommey <mh@glandium.org> wrote:\n\n> [...]\n\n> diff --git a/meson.build b/meson.build\n> index d86f2acd2b..b91d30666e 100644\n> --- a/meson.build\n> +++ b/meson.build\n> @@ -1782,7 +1782,7 @@ libgit_sources += version_def_h\n>  \n>  rust_option = get_option('rust')\n>  if rust_option.allowed()\n> -  subdir('src')\n> +  subdir('rust/src')\n>    libgit_c_args += '-DWITH_RUST'\n>  \n\nI think that's bound to fail---there's no meson.build in rust/src, right?\n\n--Tuomas\n"},{"id":"552436","messageId":"nqxjptlfu47fcxdep2djdv4tjtltsjacp35mncwjygv47nauru@vvx5464kcjm5","threadId":"64921","inReplyTo":"aqHMDErmQ0BdQlVD@fruit.crustytoothpaste.net","subject":"Re: [PATCH v3] Move rust gitcore crate to a different subdirectory","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2026-09-10T12:05:31Z","receivedAt":"2026-09-10T12:05:47Z","isPatch":true,"body":"On Wed, Sep 09, 2026 at 09:13:49PM +0000, brian m. carlson wrote:\n> On 2026-09-09 at 01:38:58, Mike Hommey wrote:\n> > Having `Cargo.toml` at the top-level of the repository implies that one\n> > can run `cargo build` directly, but this doesn't produce anything useful\n> > on its own.\n> > \n> > Additionally, when including the git source as a submodule of a Rust\n> > project, it prevents the git source from being included at all in the\n> > crate package because cargo skips directories that contain a Cargo.toml,\n> > assuming that everything in the directory is relevant to the crate.\n> \n> So what I understand is that you have a project which has Git as a\n> submodule and you want to include the Git source code into the crate\n> package for that project.  In other words, you're vendoring Git to use\n> its C components, but not its Rust components.\n\nIndeed.\n\n> If that's the case, how do you plan that to work in a few releases when\n> Git 3.0 comes out and the Rust components become mandatory?\n\nAssuming the crate doesn't grow to the point of adding a dependency on\nlibgit-rs or libgit-sys, I'm thinking of publishing the gitcore crate to\ncrates.io in a namespaced manner (although if it could be published by\nthe git project that would be even better).\n\nMike\n"},{"id":"552437","messageId":"mzrpnwtg3nkij74yp35gz74u7svzedx2kom2dsiq3dk7zhb7yp@4fihynejp63w","threadId":"64921","inReplyTo":"xmqqbja6qjyc.fsf@gitster.g","subject":"Re: [PATCH v3] Move rust gitcore crate to a different subdirectory","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2026-09-10T12:09:38Z","receivedAt":"2026-09-10T12:09:47Z","isPatch":true,"body":"On Wed, Sep 09, 2026 at 12:54:35PM -0700, Junio C Hamano wrote:\n> Mike Hommey <mh@glandium.org> writes:\n> > \n> > Having `Cargo.toml` at the top-level of the repository implies that one\n> > can run `cargo build` directly, but this doesn't produce anything useful\n> > on its own.\n> >\n> > Additionally, when including the git source as a submodule of a Rust\n> > project, it prevents the git source from being included at all in the\n> > crate package because cargo skips directories that contain a Cargo.toml,\n> > assuming that everything in the directory is relevant to the crate.\n> >\n> > This moves all Rust-specific files into a dedicated `rust/`\n> > subdirectory.\n> \n> Very readable and understandable.  It is customary in this project\n> to write that last sentence in imperative mood, though.  I.e.  \"Move\n> all files there\".\n> \n> > Signed-off-by: Mike Hommey <mh@glandium.org>\n> \n> \n> > diff --git a/.gitignore b/.gitignore\n> > index 4da58c6754..3ac0685800 100644\n> > --- a/.gitignore\n> > +++ b/.gitignore\n> > @@ -261,3 +261,5 @@ Release/\n> >  /contrib/buildsystems/out\n> >  /contrib/libgit-rs/target\n> >  /contrib/libgit-sys/target\n> > +/rust/target\n> > +/rust/Cargo.lock\n> \n> There are /target/ and /Cargo.lock listed in this file; aren't these\n> two entries meant to _replace_ them?  I am wondering if they need to\n> disappear as part of this patfch.\n\nThis and the RUST_SOURCES thing you raised are rebase errors,\napparently.\n\n> > @@ -3913,7 +3915,7 @@ clean: profile-clean coverage-clean cocciclean\n> >  \t$(RM) $(FUZZ_PROGRAMS)\n> >  \t$(RM) $(SP_OBJ)\n> >  \t$(RM) $(HCC)\n> > -\t$(RM) -r Cargo.lock target/\n> > +\t$(RM) -r Cargo.lock rust/target/\n> \n> The Cargo.lock file does not move together with the rest?  That\n> contradicts with what .gitignore says, doesn't it?\n\nHuh, thanks for noticing this one.\n\nMike\n"},{"id":"552438","messageId":"20260910121056.2749578-1-mh@glandium.org","threadId":"64921","inReplyTo":"20260909013858.1729643-1-mh@glandium.org","subject":"[PATCH v4] Move rust gitcore crate to a different subdirectory","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2026-09-10T12:10:56Z","receivedAt":"2026-09-10T12:11:08Z","isPatch":true,"body":"Having `Cargo.toml` at the top-level of the repository implies that one\ncan run `cargo build` directly, but this doesn't produce anything useful\non its own.\n\nAdditionally, when including the git source as a submodule of a Rust\nproject, it prevents the git source from being included at all in the\ncrate package because cargo skips directories that contain a Cargo.toml,\nassuming that everything in the directory is relevant to the crate.\n\nMove all Rust-specific files into a dedicated `rust/` subdirectory.\n\nSigned-off-by: Mike Hommey <mh@glandium.org>\n---\n .gitignore                     |  4 ++--\n Makefile                       | 24 ++++++++++++------------\n meson.build                    |  2 +-\n Cargo.toml => rust/Cargo.toml  |  0\n build.rs => rust/build.rs      |  0\n {src => rust}/cargo-meson.sh   |  0\n {src => rust}/meson.build      | 16 ++++++++--------\n {src => rust/src}/csum_file.rs |  0\n {src => rust/src}/hash.rs      |  0\n {src => rust/src}/lib.rs       |  0\n {src => rust/src}/loose.rs     |  0\n {src => rust/src}/varint.rs    |  0\n 12 files changed, 23 insertions(+), 23 deletions(-)\n rename Cargo.toml => rust/Cargo.toml (100%)\n rename build.rs => rust/build.rs (100%)\n rename {src => rust}/cargo-meson.sh (100%)\n rename {src => rust}/meson.build (81%)\n rename {src => rust/src}/csum_file.rs (100%)\n rename {src => rust/src}/hash.rs (100%)\n rename {src => rust/src}/lib.rs (100%)\n rename {src => rust/src}/loose.rs (100%)\n rename {src => rust/src}/varint.rs (100%)\n\ndiff --git a/.gitignore b/.gitignore\nindex 4da58c6754..add6597643 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -1,6 +1,4 @@\n /fuzz_corpora\n-/target/\n-/Cargo.lock\n /GIT-BUILD-DIR\n /GIT-BUILD-OPTIONS\n /GIT-CFLAGS\n@@ -261,3 +259,5 @@ Release/\n /contrib/buildsystems/out\n /contrib/libgit-rs/target\n /contrib/libgit-sys/target\n+/rust/target\n+/rust/Cargo.lock\ndiff --git a/Makefile b/Makefile\nindex d4b775953d..38dc3cc548 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -959,7 +959,7 @@ RUST_LIB_NAME = gitcore.lib\n else\n RUST_LIB_NAME = libgitcore.a\n endif\n-RUST_LIB = target/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME)\n+RUST_LIB = rust/target/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME)\n endif\n \n GITLIBS = common-main.o $(LIB_FILE)\n@@ -1571,11 +1571,11 @@ CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/unit-test.o\n \n UNIT_TEST_OBJS += $(UNIT_TEST_DIR)/test-lib.o\n \n-RUST_SOURCES += src/csum_file.rs\n-RUST_SOURCES += src/hash.rs\n-RUST_SOURCES += src/lib.rs\n-RUST_SOURCES += src/loose.rs\n-RUST_SOURCES += src/varint.rs\n+RUST_SOURCES += rust/src/csum_file.rs\n+RUST_SOURCES += rust/src/hash.rs\n+RUST_SOURCES += rust/src/lib.rs\n+RUST_SOURCES += rust/src/loose.rs\n+RUST_SOURCES += rust/src/varint.rs\n \n GIT-VERSION-FILE: FORCE\n \t@OLD=$$(cat $@ 2>/dev/null || :) && \\\n@@ -3038,8 +3038,8 @@ $(LIB_FILE): $(LIB_OBJS)\n \n ifndef NO_RUST\n ifeq ($(RUST_TARGETS),)\n-$(RUST_LIB): Cargo.toml $(RUST_SOURCES) $(LIB_FILE)\n-\t$(QUIET_CARGO)cargo build $(CARGO_ARGS)\n+$(RUST_LIB): rust/Cargo.toml $(RUST_SOURCES) $(LIB_FILE)\n+\t$(QUIET_CARGO)cargo build --manifest-path rust/Cargo.toml $(CARGO_ARGS)\n else\n ifneq ($(words $(RUST_TARGETS)),1)\n ifneq ($(uname_S),Darwin)\n@@ -3047,9 +3047,9 @@ $(error Building universal Rust libraries requires macOS (lipo is not available\n endif\n endif\n \n-RUST_MEMBER_LIBS = $(foreach target,$(RUST_TARGETS),target/$(target)/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME))\n-$(RUST_MEMBER_LIBS): target/%/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME): Cargo.toml $(RUST_SOURCES) $(LIB_FILE)\n-\t$(QUIET_CARGO)cargo build $(CARGO_ARGS) --target $*\n+RUST_MEMBER_LIBS = $(foreach target,$(RUST_TARGETS),rust/target/$(target)/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME))\n+$(RUST_MEMBER_LIBS): rust/target/%/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME): rust/Cargo.toml $(RUST_SOURCES) $(LIB_FILE)\n+\t$(QUIET_CARGO)cargo build --manifest-path rust/Cargo.toml $(CARGO_ARGS) --target $*\n \n $(RUST_LIB): $(RUST_MEMBER_LIBS)\n \t$(call mkdir_p_parent_template)\n@@ -3913,7 +3913,7 @@ clean: profile-clean coverage-clean cocciclean\n \t$(RM) $(FUZZ_PROGRAMS)\n \t$(RM) $(SP_OBJ)\n \t$(RM) $(HCC)\n-\t$(RM) -r Cargo.lock target/\n+\t$(RM) -r rust/Cargo.lock rust/target/\n \t$(RM) version-def.h\n \t$(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json\n \t$(RM) $(test_bindir_programs)\ndiff --git a/meson.build b/meson.build\nindex d86f2acd2b..c7ff7c2a73 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -1782,7 +1782,7 @@ libgit_sources += version_def_h\n \n rust_option = get_option('rust')\n if rust_option.allowed()\n-  subdir('src')\n+  subdir('rust')\n   libgit_c_args += '-DWITH_RUST'\n \n   if host_machine.system() == 'windows'\ndiff --git a/Cargo.toml b/rust/Cargo.toml\nsimilarity index 100%\nrename from Cargo.toml\nrename to rust/Cargo.toml\ndiff --git a/build.rs b/rust/build.rs\nsimilarity index 100%\nrename from build.rs\nrename to rust/build.rs\ndiff --git a/src/cargo-meson.sh b/rust/cargo-meson.sh\nsimilarity index 100%\nrename from src/cargo-meson.sh\nrename to rust/cargo-meson.sh\ndiff --git a/src/meson.build b/rust/meson.build\nsimilarity index 81%\nrename from src/meson.build\nrename to rust/meson.build\nindex 41a4b231e6..4c617371a5 100644\n--- a/src/meson.build\n+++ b/rust/meson.build\n@@ -1,9 +1,9 @@\n libgit_rs_sources = [\n-  'csum_file.rs',\n-  'hash.rs',\n-  'lib.rs',\n-  'loose.rs',\n-  'varint.rs',\n+  'src/csum_file.rs',\n+  'src/hash.rs',\n+  'src/lib.rs',\n+  'src/loose.rs',\n+  'src/varint.rs',\n ]\n \n # Unfortunately we must use a wrapper command to move the output file into the\n@@ -13,7 +13,7 @@ libgit_rs_sources = [\n cargo_command = [\n   shell,\n   meson.current_source_dir() / 'cargo-meson.sh',\n-  meson.project_source_root(),\n+  meson.current_source_dir(),\n   meson.current_build_dir(),\n ]\n if get_option('buildtype') == 'release'\n@@ -22,7 +22,7 @@ endif\n \n libgit_rs = custom_target('git_rs',\n   input: libgit_rs_sources + [\n-    meson.project_source_root() / 'Cargo.toml',\n+    meson.current_source_dir() / 'Cargo.toml',\n   ],\n   output: 'libgitcore.a',\n   command: cargo_command,\n@@ -35,7 +35,7 @@ if get_option('tests')\n     args: [\n       'test',\n       '--manifest-path',\n-      meson.project_source_root() / 'Cargo.toml',\n+      meson.current_source_dir() / 'Cargo.toml',\n       '--target-dir',\n       meson.current_build_dir() / 'target',\n     ],\ndiff --git a/src/csum_file.rs b/rust/src/csum_file.rs\nsimilarity index 100%\nrename from src/csum_file.rs\nrename to rust/src/csum_file.rs\ndiff --git a/src/hash.rs b/rust/src/hash.rs\nsimilarity index 100%\nrename from src/hash.rs\nrename to rust/src/hash.rs\ndiff --git a/src/lib.rs b/rust/src/lib.rs\nsimilarity index 100%\nrename from src/lib.rs\nrename to rust/src/lib.rs\ndiff --git a/src/loose.rs b/rust/src/loose.rs\nsimilarity index 100%\nrename from src/loose.rs\nrename to rust/src/loose.rs\ndiff --git a/src/varint.rs b/rust/src/varint.rs\nsimilarity index 100%\nrename from src/varint.rs\nrename to rust/src/varint.rs\n-- \n2.55.0.807.gc06c3eb732\n\n"},{"id":"552440","messageId":"xmqqwlst2t67.fsf@gitster.g","threadId":"64921","inReplyTo":"20260910062758.RcjdX%taahol@utu.fi","subject":"Re: [PATCH v3] Move rust gitcore crate to a different subdirectory","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-09-10T12:21:36Z","receivedAt":"2026-09-10T12:21:39Z","isPatch":true,"body":"Tuomas Ahola <taahol@utu.fi> writes:\n\n> Mike Hommey <mh@glandium.org> wrote:\n>\n>> [...]\n>\n>> diff --git a/meson.build b/meson.build\n>> index d86f2acd2b..b91d30666e 100644\n>> --- a/meson.build\n>> +++ b/meson.build\n>> @@ -1782,7 +1782,7 @@ libgit_sources += version_def_h\n>>  \n>>  rust_option = get_option('rust')\n>>  if rust_option.allowed()\n>> -  subdir('src')\n>> +  subdir('rust/src')\n>>    libgit_c_args += '-DWITH_RUST'\n>>  \n>\n> I think that's bound to fail---there's no meson.build in rust/src, right?\n\nThanks for catching it.  Indeed our CI builds are failing since this\ntopic was injested in 'seen'.\n\nWill kick it out and wait for updates.\n\nThanks.\n"},{"id":"552477","messageId":"xmqq5x0df19l.fsf@gitster.g","threadId":"64921","inReplyTo":"20260910121056.2749578-1-mh@glandium.org","subject":"Re: [PATCH v4] Move rust gitcore crate to a different subdirectory","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-09-10T17:45:58Z","receivedAt":"2026-09-10T17:46:06Z","isPatch":true,"body":"Mike Hommey <mh@glandium.org> writes:\n\n> Subject: Re: [PATCH v4] Move rust gitcore crate to a different subdirectory\n\nDocumentation/SubmittingPatches::[[summary-section]]\n\n> Having `Cargo.toml` at the top-level of the repository implies that one\n> can run `cargo build` directly, but this doesn't produce anything useful\n> on its own.\n>\n> Additionally, when including the git source as a submodule of a Rust\n> project, it prevents the git source from being included at all in the\n> crate package because cargo skips directories that contain a Cargo.toml,\n> assuming that everything in the directory is relevant to the crate.\n>\n> Move all Rust-specific files into a dedicated `rust/` subdirectory.\n>\n> Signed-off-by: Mike Hommey <mh@glandium.org>\n> ---\n\nThis still leaves the source tree in somewhat inconsistent state.\n\nhttps://github.com/git/git/actions/runs/34505483626/job/102966561269#step:5:120\n\nI do not offhand know if ci/run-rust-checks.sh needs updating or the\nmoving of files needs tweaking to avoid the breakage, though.\n"},{"id":"552804","messageId":"20260917060415.2986259-1-mh@glandium.org","threadId":"64921","inReplyTo":"xmqq5x0df19l.fsf@gitster.g","subject":"[PATCH v5] move rust gitcore crate to a different subdirectory","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2026-09-17T06:04:15Z","receivedAt":"2026-09-17T06:04:44Z","isPatch":true,"body":"Having `Cargo.toml` at the top-level of the repository implies that one\ncan run `cargo build` directly, but this doesn't produce anything useful\non its own.\n\nAdditionally, when including the git source as a submodule of a Rust\nproject, it prevents the git source from being included at all in the\ncrate package because cargo skips directories that contain a Cargo.toml,\nassuming that everything in the directory is relevant to the crate.\n\nMove all Rust-specific files into a dedicated `rust/` subdirectory.\n\nSigned-off-by: Mike Hommey <mh@glandium.org>\n---\n .gitignore                     |  4 ++--\n Makefile                       | 24 ++++++++++++------------\n ci/run-rust-checks.sh          |  6 +++---\n meson.build                    |  2 +-\n Cargo.toml => rust/Cargo.toml  |  0\n build.rs => rust/build.rs      |  0\n {src => rust}/cargo-meson.sh   |  0\n {src => rust}/meson.build      | 16 ++++++++--------\n {src => rust/src}/csum_file.rs |  0\n {src => rust/src}/hash.rs      |  0\n {src => rust/src}/lib.rs       |  0\n {src => rust/src}/loose.rs     |  0\n {src => rust/src}/varint.rs    |  0\n 13 files changed, 26 insertions(+), 26 deletions(-)\n rename Cargo.toml => rust/Cargo.toml (100%)\n rename build.rs => rust/build.rs (100%)\n rename {src => rust}/cargo-meson.sh (100%)\n rename {src => rust}/meson.build (81%)\n rename {src => rust/src}/csum_file.rs (100%)\n rename {src => rust/src}/hash.rs (100%)\n rename {src => rust/src}/lib.rs (100%)\n rename {src => rust/src}/loose.rs (100%)\n rename {src => rust/src}/varint.rs (100%)\n\ndiff --git a/.gitignore b/.gitignore\nindex 4da58c6754..add6597643 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -1,6 +1,4 @@\n /fuzz_corpora\n-/target/\n-/Cargo.lock\n /GIT-BUILD-DIR\n /GIT-BUILD-OPTIONS\n /GIT-CFLAGS\n@@ -261,3 +259,5 @@ Release/\n /contrib/buildsystems/out\n /contrib/libgit-rs/target\n /contrib/libgit-sys/target\n+/rust/target\n+/rust/Cargo.lock\ndiff --git a/Makefile b/Makefile\nindex c649c93c51..67e74c30cc 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -959,7 +959,7 @@ RUST_LIB_NAME = gitcore.lib\n else\n RUST_LIB_NAME = libgitcore.a\n endif\n-RUST_LIB = target$(if $(CARGO_BUILD_TARGET),/$(CARGO_BUILD_TARGET))/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME)\n+RUST_LIB = rust/target$(if $(CARGO_BUILD_TARGET),/$(CARGO_BUILD_TARGET))/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME)\n endif\n \n GITLIBS = common-main.o $(LIB_FILE)\n@@ -1571,11 +1571,11 @@ CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/unit-test.o\n \n UNIT_TEST_OBJS += $(UNIT_TEST_DIR)/test-lib.o\n \n-RUST_SOURCES += src/csum_file.rs\n-RUST_SOURCES += src/hash.rs\n-RUST_SOURCES += src/lib.rs\n-RUST_SOURCES += src/loose.rs\n-RUST_SOURCES += src/varint.rs\n+RUST_SOURCES += rust/src/csum_file.rs\n+RUST_SOURCES += rust/src/hash.rs\n+RUST_SOURCES += rust/src/lib.rs\n+RUST_SOURCES += rust/src/loose.rs\n+RUST_SOURCES += rust/src/varint.rs\n \n GIT-VERSION-FILE: FORCE\n \t@OLD=$$(cat $@ 2>/dev/null || :) && \\\n@@ -3038,8 +3038,8 @@ $(LIB_FILE): $(LIB_OBJS)\n \n ifndef NO_RUST\n ifeq ($(RUST_TARGETS),)\n-$(RUST_LIB): Cargo.toml $(RUST_SOURCES) $(LIB_FILE)\n-\t$(QUIET_CARGO)cargo build $(CARGO_ARGS)\n+$(RUST_LIB): rust/Cargo.toml $(RUST_SOURCES) $(LIB_FILE)\n+\t$(QUIET_CARGO)cargo build --manifest-path rust/Cargo.toml $(CARGO_ARGS)\n else\n ifneq ($(words $(RUST_TARGETS)),1)\n ifneq ($(uname_S),Darwin)\n@@ -3047,9 +3047,9 @@ $(error Building universal Rust libraries requires macOS (lipo is not available\n endif\n endif\n \n-RUST_MEMBER_LIBS = $(foreach target,$(RUST_TARGETS),target/$(target)/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME))\n-$(RUST_MEMBER_LIBS): target/%/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME): Cargo.toml $(RUST_SOURCES) $(LIB_FILE)\n-\t$(QUIET_CARGO)cargo build $(CARGO_ARGS) --target $*\n+RUST_MEMBER_LIBS = $(foreach target,$(RUST_TARGETS),rust/target/$(target)/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME))\n+$(RUST_MEMBER_LIBS): rust/target/%/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME): rust/Cargo.toml $(RUST_SOURCES) $(LIB_FILE)\n+\t$(QUIET_CARGO)cargo build --manifest-path rust/Cargo.toml $(CARGO_ARGS) --target $*\n \n $(RUST_LIB): $(RUST_MEMBER_LIBS)\n \t$(call mkdir_p_parent_template)\n@@ -3913,7 +3913,7 @@ clean: profile-clean coverage-clean cocciclean\n \t$(RM) $(FUZZ_PROGRAMS)\n \t$(RM) $(SP_OBJ)\n \t$(RM) $(HCC)\n-\t$(RM) -r Cargo.lock target/\n+\t$(RM) -r rust/Cargo.lock rust/target/\n \t$(RM) version-def.h\n \t$(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json\n \t$(RM) $(test_bindir_programs)\ndiff --git a/ci/run-rust-checks.sh b/ci/run-rust-checks.sh\nindex b5ad9e8dc6..47fccc3a02 100755\n--- a/ci/run-rust-checks.sh\n+++ b/ci/run-rust-checks.sh\n@@ -4,17 +4,17 @@\n \n set +x\n \n-if ! group \"Check Rust formatting\" cargo fmt --all --check\n+if ! group \"Check Rust formatting\" cargo fmt --manifest-path rust/Cargo.toml --all --check\n then\n \tRET=1\n fi\n \n-if ! group \"Check for common Rust mistakes\" cargo clippy --all-targets --all-features -- -Dwarnings\n+if ! group \"Check for common Rust mistakes\" cargo clippy --manifest-path rust/Cargo.toml --all-targets --all-features -- -Dwarnings\n then\n \tRET=1\n fi\n \n-if ! group \"Check for minimum required Rust version\" cargo msrv verify\n+if ! group \"Check for minimum required Rust version\" cargo msrv --path rust verify\n then\n \tRET=1\n fi\ndiff --git a/meson.build b/meson.build\nindex 0a95d90d21..432e306b21 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -1795,7 +1795,7 @@ libgit_sources += version_def_h\n \n rust_option = get_option('rust')\n if rust_option.allowed()\n-  subdir('src')\n+  subdir('rust')\n   libgit_c_args += '-DWITH_RUST'\n \n   if host_machine.system() == 'windows'\ndiff --git a/Cargo.toml b/rust/Cargo.toml\nsimilarity index 100%\nrename from Cargo.toml\nrename to rust/Cargo.toml\ndiff --git a/build.rs b/rust/build.rs\nsimilarity index 100%\nrename from build.rs\nrename to rust/build.rs\ndiff --git a/src/cargo-meson.sh b/rust/cargo-meson.sh\nsimilarity index 100%\nrename from src/cargo-meson.sh\nrename to rust/cargo-meson.sh\ndiff --git a/src/meson.build b/rust/meson.build\nsimilarity index 81%\nrename from src/meson.build\nrename to rust/meson.build\nindex 41a4b231e6..4c617371a5 100644\n--- a/src/meson.build\n+++ b/rust/meson.build\n@@ -1,9 +1,9 @@\n libgit_rs_sources = [\n-  'csum_file.rs',\n-  'hash.rs',\n-  'lib.rs',\n-  'loose.rs',\n-  'varint.rs',\n+  'src/csum_file.rs',\n+  'src/hash.rs',\n+  'src/lib.rs',\n+  'src/loose.rs',\n+  'src/varint.rs',\n ]\n \n # Unfortunately we must use a wrapper command to move the output file into the\n@@ -13,7 +13,7 @@ libgit_rs_sources = [\n cargo_command = [\n   shell,\n   meson.current_source_dir() / 'cargo-meson.sh',\n-  meson.project_source_root(),\n+  meson.current_source_dir(),\n   meson.current_build_dir(),\n ]\n if get_option('buildtype') == 'release'\n@@ -22,7 +22,7 @@ endif\n \n libgit_rs = custom_target('git_rs',\n   input: libgit_rs_sources + [\n-    meson.project_source_root() / 'Cargo.toml',\n+    meson.current_source_dir() / 'Cargo.toml',\n   ],\n   output: 'libgitcore.a',\n   command: cargo_command,\n@@ -35,7 +35,7 @@ if get_option('tests')\n     args: [\n       'test',\n       '--manifest-path',\n-      meson.project_source_root() / 'Cargo.toml',\n+      meson.current_source_dir() / 'Cargo.toml',\n       '--target-dir',\n       meson.current_build_dir() / 'target',\n     ],\ndiff --git a/src/csum_file.rs b/rust/src/csum_file.rs\nsimilarity index 100%\nrename from src/csum_file.rs\nrename to rust/src/csum_file.rs\ndiff --git a/src/hash.rs b/rust/src/hash.rs\nsimilarity index 100%\nrename from src/hash.rs\nrename to rust/src/hash.rs\ndiff --git a/src/lib.rs b/rust/src/lib.rs\nsimilarity index 100%\nrename from src/lib.rs\nrename to rust/src/lib.rs\ndiff --git a/src/loose.rs b/rust/src/loose.rs\nsimilarity index 100%\nrename from src/loose.rs\nrename to rust/src/loose.rs\ndiff --git a/src/varint.rs b/rust/src/varint.rs\nsimilarity index 100%\nrename from src/varint.rs\nrename to rust/src/varint.rs\n-- \n2.55.0.807.gc06c3eb732\n\n"},{"id":"552852","messageId":"xmqqfqz7otr0.fsf@gitster.g","threadId":"64921","inReplyTo":"20260917060415.2986259-1-mh@glandium.org","subject":"Re: [PATCH v5] move rust gitcore crate to a different subdirectory","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-09-18T08:20:51Z","receivedAt":"2026-09-18T08:20:55Z","isPatch":true,"body":"Mike Hommey <mh@glandium.org> writes:\n\n> Having `Cargo.toml` at the top-level of the repository implies that one\n> can run `cargo build` directly, but this doesn't produce anything useful\n> on its own.\n>\n> Additionally, when including the git source as a submodule of a Rust\n> project, it prevents the git source from being included at all in the\n> crate package because cargo skips directories that contain a Cargo.toml,\n> assuming that everything in the directory is relevant to the crate.\n>\n> Move all Rust-specific files into a dedicated `rust/` subdirectory.\n>\n> Signed-off-by: Mike Hommey <mh@glandium.org>\n> ---\n\nIt would have been a friendly thing to do to describe what base was\nchosen, especially with a few other topics in flight that touch the\nbuild procedure for Rust part of the system recently, here below the\nthree-dash line.  \n\nIt seems that this patch is designed to apply cleanly on top of Git\n2.56-rc1, which already has these topics merged, so I do not have to\nworry about conflicts with them when queueing this patch, which is\ngood.\n\n>  .gitignore                     |  4 ++--\n>  Makefile                       | 24 ++++++++++++------------\n>  ci/run-rust-checks.sh          |  6 +++---\n>  meson.build                    |  2 +-\n>  Cargo.toml => rust/Cargo.toml  |  0\n>  build.rs => rust/build.rs      |  0\n>  {src => rust}/cargo-meson.sh   |  0\n>  {src => rust}/meson.build      | 16 ++++++++--------\n>  {src => rust/src}/csum_file.rs |  0\n>  {src => rust/src}/hash.rs      |  0\n>  {src => rust/src}/lib.rs       |  0\n>  {src => rust/src}/loose.rs     |  0\n>  {src => rust/src}/varint.rs    |  0\n>  13 files changed, 26 insertions(+), 26 deletions(-)\n>  rename Cargo.toml => rust/Cargo.toml (100%)\n>  rename build.rs => rust/build.rs (100%)\n>  rename {src => rust}/cargo-meson.sh (100%)\n>  rename {src => rust}/meson.build (81%)\n>  rename {src => rust/src}/csum_file.rs (100%)\n>  rename {src => rust/src}/hash.rs (100%)\n>  rename {src => rust/src}/lib.rs (100%)\n>  rename {src => rust/src}/loose.rs (100%)\n>  rename {src => rust/src}/varint.rs (100%)\n\nSo things in src/ move to either rust/ directory or rust/src/\ndirectory.\n\n> diff --git a/Makefile b/Makefile\n> index c649c93c51..67e74c30cc 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -959,7 +959,7 @@ RUST_LIB_NAME = gitcore.lib\n>  else\n>  RUST_LIB_NAME = libgitcore.a\n>  endif\n> -RUST_LIB = target$(if $(CARGO_BUILD_TARGET),/$(CARGO_BUILD_TARGET))/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME)\n> +RUST_LIB = rust/target$(if $(CARGO_BUILD_TARGET),/$(CARGO_BUILD_TARGET))/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME)\n>  endif\n\nThis part was touched by a few topics in the recent past and I\ndidn't want to resolve conflicts there.  This patch being on top of\nthese two topics makes my life easier and is very much appreciated.\n\n> @@ -1571,11 +1571,11 @@ CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/unit-test.o\n>  \n>  UNIT_TEST_OBJS += $(UNIT_TEST_DIR)/test-lib.o\n>  \n> -RUST_SOURCES += src/csum_file.rs\n> -RUST_SOURCES += src/hash.rs\n> -RUST_SOURCES += src/lib.rs\n> -RUST_SOURCES += src/loose.rs\n> -RUST_SOURCES += src/varint.rs\n> +RUST_SOURCES += rust/src/csum_file.rs\n> +RUST_SOURCES += rust/src/hash.rs\n> +RUST_SOURCES += rust/src/lib.rs\n> +RUST_SOURCES += rust/src/loose.rs\n> +RUST_SOURCES += rust/src/varint.rs\n\nSo the sources are all in rust/src/ directory now.\n\n> -$(RUST_LIB): Cargo.toml $(RUST_SOURCES) $(LIB_FILE)\n> -\t$(QUIET_CARGO)cargo build $(CARGO_ARGS)\n> +$(RUST_LIB): rust/Cargo.toml $(RUST_SOURCES) $(LIB_FILE)\n> +\t$(QUIET_CARGO)cargo build --manifest-path rust/Cargo.toml $(CARGO_ARGS)\n> ...\n> -RUST_MEMBER_LIBS = $(foreach target,$(RUST_TARGETS),target/$(target)/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME))\n> -$(RUST_MEMBER_LIBS): target/%/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME): Cargo.toml $(RUST_SOURCES) $(LIB_FILE)\n> -\t$(QUIET_CARGO)cargo build $(CARGO_ARGS) --target $*\n> +RUST_MEMBER_LIBS = $(foreach target,$(RUST_TARGETS),rust/target/$(target)/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME))\n> +$(RUST_MEMBER_LIBS): rust/target/%/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME): rust/Cargo.toml $(RUST_SOURCES) $(LIB_FILE)\n> +\t$(QUIET_CARGO)cargo build --manifest-path rust/Cargo.toml $(CARGO_ARGS) --target $*\n\nIs the reason why we now need to sprinkle --manifest-path all over\nis because rust/Cargo.toml is a non-standard place for cargo tool?\nNot complaining, but am wondering if it is simpler to set and export\nCARGO_MANIFEST_DIR from the Makefile.\n\n> diff --git a/meson.build b/meson.build\n> index 0a95d90d21..432e306b21 100644\n> --- a/meson.build\n> +++ b/meson.build\n> @@ -1795,7 +1795,7 @@ libgit_sources += version_def_h\n>  \n>  rust_option = get_option('rust')\n>  if rust_option.allowed()\n> -  subdir('src')\n> +  subdir('rust')\n\nNot 'rust/src'?  Just double-checking.\n\n> @@ -13,7 +13,7 @@ libgit_rs_sources = [\n>  cargo_command = [\n>    shell,\n>    meson.current_source_dir() / 'cargo-meson.sh',\n> -  meson.project_source_root(),\n> +  meson.current_source_dir(),\n>    meson.current_build_dir(),\n>  ]\n\nWhat is this change about?\n"},{"id":"552865","messageId":"yc4bgjoyxnm6o7q4gwols4d6zvdrq3ydw2c65wjdwof3hjyde6@2osv37jtuxx3","threadId":"64921","inReplyTo":"xmqqfqz7otr0.fsf@gitster.g","subject":"Re: [PATCH v5] move rust gitcore crate to a different subdirectory","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2026-09-18T15:02:38Z","receivedAt":"2026-09-18T15:02:59Z","isPatch":true,"body":"On Fri, Sep 18, 2026 at 01:20:51AM -0700, Junio C Hamano wrote:\n> It would have been a friendly thing to do to describe what base was\n> chosen, especially with a few other topics in flight that touch the\n> build procedure for Rust part of the system recently, here below the\n> three-dash line.  \n> \n> It seems that this patch is designed to apply cleanly on top of Git\n> 2.56-rc1, which already has these topics merged, so I do not have to\n> worry about conflicts with them when queueing this patch, which is\n> good.\n\nI must admit I hadn't given much thought about where this would be\napplied, but it was based off master at the time of refreshing the\npatch, which was, indeed, v2.56.0-rc1.\n\n> So things in src/ move to either rust/ directory or rust/src/\n> directory.\n\nCorrect. Mostly rs files (except build.rs) move to rust/src/, and the\nrest to rust/.\n\n> > -$(RUST_LIB): Cargo.toml $(RUST_SOURCES) $(LIB_FILE)\n> > -\t$(QUIET_CARGO)cargo build $(CARGO_ARGS)\n> > +$(RUST_LIB): rust/Cargo.toml $(RUST_SOURCES) $(LIB_FILE)\n> > +\t$(QUIET_CARGO)cargo build --manifest-path rust/Cargo.toml $(CARGO_ARGS)\n> > ...\n> > -RUST_MEMBER_LIBS = $(foreach target,$(RUST_TARGETS),target/$(target)/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME))\n> > -$(RUST_MEMBER_LIBS): target/%/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME): Cargo.toml $(RUST_SOURCES) $(LIB_FILE)\n> > -\t$(QUIET_CARGO)cargo build $(CARGO_ARGS) --target $*\n> > +RUST_MEMBER_LIBS = $(foreach target,$(RUST_TARGETS),rust/target/$(target)/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME))\n> > +$(RUST_MEMBER_LIBS): rust/target/%/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME): rust/Cargo.toml $(RUST_SOURCES) $(LIB_FILE)\n> > +\t$(QUIET_CARGO)cargo build --manifest-path rust/Cargo.toml $(CARGO_ARGS) --target $*\n> \n> Is the reason why we now need to sprinkle --manifest-path all over\n> is because rust/Cargo.toml is a non-standard place for cargo tool?\n> Not complaining, but am wondering if it is simpler to set and export\n> CARGO_MANIFEST_DIR from the Makefile.\n\nIt's non-standard in the sense that it's not Cargo.toml is $PWD. An\nalternative could be to `cd rust` before running cargo commands.\n\n> > diff --git a/meson.build b/meson.build\n> > index 0a95d90d21..432e306b21 100644\n> > --- a/meson.build\n> > +++ b/meson.build\n> > @@ -1795,7 +1795,7 @@ libgit_sources += version_def_h\n> >  \n> >  rust_option = get_option('rust')\n> >  if rust_option.allowed()\n> > -  subdir('src')\n> > +  subdir('rust')\n> \n> Not 'rust/src'?  Just double-checking.\n\nNot rust/src because the rust meson.build was moved to rust/, not\nrust/src. It felt like it was in src/ along the .rs files just because\nthere was no other place for it in the first place.\n\n> > @@ -13,7 +13,7 @@ libgit_rs_sources = [\n> >  cargo_command = [\n> >    shell,\n> >    meson.current_source_dir() / 'cargo-meson.sh',\n> > -  meson.project_source_root(),\n> > +  meson.current_source_dir(),\n> >    meson.current_build_dir(),\n> >  ]\n> \n> What is this change about?\n\nIIRC project_source_root is the git top-level directory, and\ncurrent_source_dir is the one containing meson.build. Keeping\nproject_source_root would put the target directory at the git top-level,\nwhich would be different from what the Makefile does (since it doesn't\npass a --target-dir)\n\nMike\n"}]}