Skip to content
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

git-fetch-with-cli: Set GIT_DIR for bare repository compatibility #14860

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

charmitro
Copy link
Contributor

When using net.git-fetch-with-cli = true , Cargo fails to clone the git repository into the cache because safe.bareRepository defaults to explicit. This results in an error stating that a bare repository cannot be used.

This patch sets the GIT_DIR environment variable to the correct repository path instead of removing it. This ensures that Git uses the correct repository directory and avoids the "cannot use bare repository" error.

Fixes #14758

@rustbot
Copy link
Collaborator

rustbot commented Nov 26, 2024

r? @ehuss

rustbot has assigned @ehuss.
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

@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 Nov 26, 2024
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

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

Thanks for the patch!

src/cargo/sources/git/utils.rs Outdated Show resolved Hide resolved
When using `net.git-fetch-with-cli = true` , Cargo fails to clone the
git repository into the cache because `safe.bareRepository` defaults
to `explicit`. This results in an error stating that a bare repository
cannot be used.

This patch sets the `GIT_DIR` environment variable to the correct
repository path instead of removing it. This ensures that Git uses the
correct repository directory and avoids the "cannot use bare
repository" error.

Fixes rust-lang#14758

Signed-off-by: Charalampos Mitrodimas <charmitro@posteo.net>
@weihanglo weihanglo added this pull request to the merge queue Nov 26, 2024
Merged via the queue into rust-lang:master with commit 7aa570a Nov 26, 2024
20 checks passed
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.

net.git-fetch-with-cli fails with "cannot use bare repository" with safe.bareRepository = explicit
4 participants