Skip to content

Use gix for cargo package #15534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
213 changes: 112 additions & 101 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ flate2 = { version = "1.1.1", default-features = false, features = ["zlib-rs"] }
git2 = "0.20.0"
git2-curl = "0.21.0"
# When updating this, also see if `gix-transport` further down needs updating or some auth-related tests will fail.
gix = { version = "0.72.0", default-features = false, features = ["blocking-http-transport-curl", "progress-tree", "parallel", "dirwalk"] }
gix = { git = "https://github.com/GitoxideLabs/gitoxide", branch = "improvements", version = "0.72.1", default-features = false, features = ["blocking-http-transport-curl", "progress-tree", "parallel", "dirwalk", "status"] }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be set to the latest release on the 22nd or 23rd.

glob = "0.3.2"
handlebars = { version = "6.3.1", features = ["dir_source"] }
hex = "0.4.3"
Expand Down Expand Up @@ -256,7 +256,7 @@ cargo-test-support.workspace = true
gix = { workspace = true, features = ["revision"] }
# When building Cargo for tests, a safety-measure in `gix` needs to be disabled
# to allow sending credentials over HTTP connections.
gix-transport = { version = "0.47.0", features = ["http-client-insecure-credentials"] }
gix-transport = { git = "https://github.com/GitoxideLabs/gitoxide", branch = "improvements", features = ["http-client-insecure-credentials"] }
same-file.workspace = true
snapbox.workspace = true

Expand Down
6 changes: 5 additions & 1 deletion src/cargo/ops/cargo_package/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,11 @@ fn prepare_archive(
let src_files = src.list_files(pkg)?;

// Check (git) repository state, getting the current commit hash.
let vcs_info = vcs::check_repo_state(pkg, &src_files, ws, &opts)?;
let vcs_info = if ws.gctx().cli_unstable().gitoxide.is_some() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping both worlds neatly separated would allow for a staged rollout:

  • nightly and opt-in
  • stable and opt-out
  • stable (with git2 codepath removed)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I would lean towards making it insta-stable, as I mentioned the check is a best-effort, though I'll put this in Cargo team meeting agenda next week!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty much like this approach

#13696

Copy link
Member

@weihanglo weihanglo May 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid wasting efforts, let's hold off feature-gate until we hear back from the team :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#15534 (comment)

Looks like people are okay with no fallback to libgit2. I think we can move forward just changing the implementation of vcs::check_repo_state.

vcs::gix::check_repo_state(pkg, &src_files, ws, &opts)
} else {
vcs::check_repo_state(pkg, &src_files, ws, &opts)
}?;

build_ar_list(ws, pkg, src_files, vcs_info, opts.include_lockfile)
}
Expand Down
Loading
Loading