git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v5] move rust gitcore crate to a different subdirectory

From
Mike Hommey <mh@glandium.org>
Date
Sep 18, 2026, 15:02 UTC
Message-ID
<yc4bgjoyxnm6o7q4gwols4d6zvdrq3ydw2c65wjdwof3hjyde6@2osv37jtuxx3>
In-Reply-To
<xmqqfqz7otr0.fsf@gitster.g>
On Fri, Sep 18, 2026 at 01:20:51AM -0700, Junio C Hamano wrote:
Show 9 quoted lines
> It would have been a friendly thing to do to describe what base was
> chosen, especially with a few other topics in flight that touch the
> build procedure for Rust part of the system recently, here below the
> three-dash line.  
> 
> It seems that this patch is designed to apply cleanly on top of Git
> 2.56-rc1, which already has these topics merged, so I do not have to
> worry about conflicts with them when queueing this patch, which is
> good.

I must admit I hadn't given much thought about where this would be applied, but it was based off master at the time of refreshing the patch, which was, indeed, v2.56.0-rc1.

> So things in src/ move to either rust/ directory or rust/src/
> directory.

Correct. Mostly rs files (except build.rs) move to rust/src/, and the rest to rust/.

Show 16 quoted lines
> > -$(RUST_LIB): Cargo.toml $(RUST_SOURCES) $(LIB_FILE)
> > -	$(QUIET_CARGO)cargo build $(CARGO_ARGS)
> > +$(RUST_LIB): rust/Cargo.toml $(RUST_SOURCES) $(LIB_FILE)
> > +	$(QUIET_CARGO)cargo build --manifest-path rust/Cargo.toml $(CARGO_ARGS)
> > ...
> > -RUST_MEMBER_LIBS = $(foreach target,$(RUST_TARGETS),target/$(target)/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME))
> > -$(RUST_MEMBER_LIBS): target/%/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME): Cargo.toml $(RUST_SOURCES) $(LIB_FILE)
> > -	$(QUIET_CARGO)cargo build $(CARGO_ARGS) --target $*
> > +RUST_MEMBER_LIBS = $(foreach target,$(RUST_TARGETS),rust/target/$(target)/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME))
> > +$(RUST_MEMBER_LIBS): rust/target/%/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME): rust/Cargo.toml $(RUST_SOURCES) $(LIB_FILE)
> > +	$(QUIET_CARGO)cargo build --manifest-path rust/Cargo.toml $(CARGO_ARGS) --target $*
> 
> Is the reason why we now need to sprinkle --manifest-path all over
> is because rust/Cargo.toml is a non-standard place for cargo tool?
> Not complaining, but am wondering if it is simpler to set and export
> CARGO_MANIFEST_DIR from the Makefile.

It's non-standard in the sense that it's not Cargo.toml is $PWD. An alternative could be to `cd rust` before running cargo commands.

Show 12 quoted lines
> > diff --git a/meson.build b/meson.build
> > index 0a95d90d21..432e306b21 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -1795,7 +1795,7 @@ libgit_sources += version_def_h
> >  
> >  rust_option = get_option('rust')
> >  if rust_option.allowed()
> > -  subdir('src')
> > +  subdir('rust')
> 
> Not 'rust/src'?  Just double-checking.

Not rust/src because the rust meson.build was moved to rust/, not rust/src. It felt like it was in src/ along the .rs files just because there was no other place for it in the first place.

Show 10 quoted lines
> > @@ -13,7 +13,7 @@ libgit_rs_sources = [
> >  cargo_command = [
> >    shell,
> >    meson.current_source_dir() / 'cargo-meson.sh',
> > -  meson.project_source_root(),
> > +  meson.current_source_dir(),
> >    meson.current_build_dir(),
> >  ]
> 
> What is this change about?

IIRC project_source_root is the git top-level directory, and current_source_dir is the one containing meson.build. Keeping project_source_root would put the target directory at the git top-level, which would be different from what the Makefile does (since it doesn't pass a --target-dir)

Mike
Previous: Junio C Hamano
Message 18 of 18 in “Move rust gitcore crate to a different subdirectory”
  1. Move rust gitcore crate to a different subdirectoryMike Hommey, Feb 4, 2026
  2. brian m. carlsonFeb 5, 2026
  3. Mike HommeyFeb 5, 2026
  4. brian m. carlsonFeb 5, 2026
  5. Mike HommeyFeb 5, 2026
  6. Move rust gitcore crate to a different subdirectoryMike Hommey, Feb 9, 2026
  7. Move rust gitcore crate to a different subdirectoryMike Hommey, Sep 9, 2026
  8. Junio C HamanoSep 9, 2026
  9. Mike HommeySep 10, 2026
  10. brian m. carlsonSep 9, 2026
  11. Mike HommeySep 10, 2026
  12. Tuomas AholaSep 10, 2026
  13. Junio C HamanoSep 10, 2026
  14. Move rust gitcore crate to a different subdirectoryMike Hommey, Sep 10, 2026
  15. Junio C HamanoSep 10, 2026
  16. move rust gitcore crate to a different subdirectoryMike Hommey, Sep 17, 2026
  17. Junio C HamanoSep 18, 2026
  18. Mike HommeySep 18, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.