-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Cargo dies when in worktree of bare repository #7876
Comments
I can't seem to figure out how to reproduce this. Can you put together an exact series of commands to run to repro it? I tried:
I also tried something similar with the rustc-src tarball. |
I am hitting this as well. Why on earth does a build system care about the version control I'm using?!?! |
This also seems to fail when doing a sparse checkout with recent git (used to cut down cloned repo size). You'll need something like git v2.27 to run the following. Here's a repro with this repo itself:
I get the output
Even though the repo is not bare, ( It seems libgit2 is not quite sparse checkout supporting yet (libgit2/libgit2#2263) but it'd be stellar if Cargo could just notice that the Cargo.toml file actually exists right there anyways. |
I'm not able to reproduce the original worktree issue with the reported versions, but I did find that cargo 1.46 and 1.47 would give an error about "did not expect repo at XYZ to be bare" when run in a worktree. I also was able to get the same error with a sparse checkout, as reported by @chachi. I'm pretty sure the upgrade of git2 in #8778 is what made things work in 1.48. I haven't found any issues with the latest cargo using worktrees or spase checkouts Possible same root cause as #4131 |
@rustbot claim |
test: Add tests for using worktrees and sparse checkouts ### What does this PR try to resolve? Based on `@eminence's` [comment](#7876 (comment)), Add tests for using worktrees or spase checkouts. ### How should we test and review this PR? Checkout and run tests: ``` cargo test --package cargo --test testsuite -- git::git_worktree_with_original_repo_renamed ``` ``` cargo test --package cargo --test testsuite -- git::git_worktree_with_bare_original_repo ```
Problem
When building rustc from a downloaded tarball (in this case, 1.40.0) that is inside a worktree of a bare git repo, Cargo will notice the
.git
directory and attempt to list files and die while trying.Steps
./x.py install
)(This obviously isn't minimized, but is the original environment in which I encountered the problem. I expect the problem would occur when trying to use a path source in any worktree.)
Possible Solution(s)
list-tree
based on the current worktree rather thanlist-files
Notes
This is related to #4131 but actually caused our CI to start failing because the backend switched to bare repos from normal clones to save disk.
I created a separate issue because it is not restricted to
cargo publish
and is not just a workflow issue.Output of
cargo version
:cargo 1.40.0-dev
The text was updated successfully, but these errors were encountered: