Skip to content

fix(git)!: Default to net.git-fetch-with-cli if git is present - #17329

Open
epage wants to merge 2 commits into
rust-lang:masterfrom
epage:lazy-git
Open

fix(git)!: Default to net.git-fetch-with-cli if git is present#17329
epage wants to merge 2 commits into
rust-lang:masterfrom
epage:lazy-git

Conversation

@epage

@epage epage commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What does this PR try to resolve?

This changes the default for how we fetch to use the git CLI if present for better conformity and performance without breaking people (yet) who don't have it.

Part of #17227

How to test and review this PR?

I have triaged open issues related to git-fetch-with-cli.

corrupt_git.rs is an interesting case. From what an agent told me that sounds reasonable, we hit an infinite loop in libgit2. We should report that but not feeling it is bad enough to be a blocker for merging this, especially since people are using a sparse index.

Future goals:

  • Remove git2 fetch to unblock moving off of curl
  • Remove git2 to speed up startup and reduce C deps

Future steps:

  1. Add future-incompat when the default falls back to git2
  2. Remove the git check, always defaulting to git-cli
  3. Remove git2 fetch

epage added 2 commits August 5, 2026 16:08
This changes the default for how we fetch to use the git CLI if present for better conformity and performance without breaking people (yet) who don't have it.

Part of rust-lang#17227
@rustbot rustbot added A-git Area: anything dealing with git S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 6, 2026
@rustbot

rustbot commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

r? @weihanglo

rustbot has assigned @weihanglo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @epage, @weihanglo
  • @epage, @weihanglo expanded to epage, weihanglo

@weihanglo

Copy link
Copy Markdown
Member

corrupt_git.rs is an interesting case. From what an agent told me that sounds reasonable, we hit an infinite loop in libgit2. We should report that but not feeling it is bad enough to be a blocker for merging this, especially since people are using a sparse index.

A possible upstream fix: libgit2/libgit2#7346

Comment thread src/sources/git/utils.rs
}

fn is_git_cli_present() -> bool {
#[tracing::instrument(skip_all)]

@weihanglo weihanglo Aug 16, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think before making it default, we may want to make sure:

  • What the minimum required Git CLI version we depend on.
    • This doesn't need to be precise, but at least we figure out an approximate.
  • What Git CLI v3 would ship and whether it would be hard to keep our compatibility story: https://git-scm.com/docs/BreakingChanges#_git_3_0.
    • Looked over the proposed change, refutable and sha256 may require a bit more attention, as old Git may not be able to read the new index format.
    • If there is any more defaults we need to make explicit and opt-out, it is better to as early as possible. (e.g. safe.bareRepository though we already set GIT_DIR explicitly for fetch in git-fetch-with-cli: Set GIT_DIR for bare repository compatibility #14860).

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Made this: #17370

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-git Area: anything dealing with git S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants