-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Regression: git ignored Cargo.lock prevents cargo publish #7705
Comments
Thanks for the report, this has been fixed in 1.40 via #7448. |
I don't believe #7448 fixed this. I'm still getting the above error on Steps to reproduce: $ cargo --version --verbose
cargo 1.42.0-nightly (6e1ca924a 2020-01-06)
release: 1.42.0
commit-hash: 6e1ca924a67dd1ac89c33f294ef26b5c43b89168
commit-date: 2020-01-06
$ rustc --version --verbose
rustc 1.42.0-nightly (859764425 2020-01-07)
binary: rustc
commit-hash: 85976442558bf2d09cec3aa49c9c9ba86fb15c1f
commit-date: 2020-01-07
host: x86_64-unknown-linux-gnu
release: 1.42.0-nightly
LLVM version: 9.0
$ cd /tmp
$ git clone https://github.com/Michael-F-Bryan/arcs
$ cd arcs/arcs
$ git clone 49887a61254003257cc61120cb4237778e89f243
$ cargo publish --dry-run
Updating crates.io index
error: 1 files in the working directory contain changes that were not yet committed into git:
Cargo.lock
to proceed despite this and include the uncommitted changes, pass the `--allow-dirty` flag If it makes any difference, the crate is in a sub-directory and not the project root. It's also never been published before and I originally had |
@Michael-F-Bryan Ah, mistakenly didn't consider that the paths were relative to the repository, not the package. Fixed in #7779. |
Fix .gitignore of Cargo.lock in a subdirectory. The code for checking if `Cargo.lock` is ignored was erroneously assuming it was at the root of the git repo. This would cause a problem if `Cargo.lock` is in `.gitignore` in a subdirectory. Fixes issue noted in #7705 (comment)
The issue is still happening for me:
Switching to
with the same result. Deleting |
@xnuter |
The fn main() {
let crate_dir = env::var("CARGO_MANIFEST_DIR")
.expect("CARGO_MANIFEST_DIR variable is not set");
let out_dir = env::var("OUT_DIR")
.expect("OUT_DIR variable is not set");
cbindgen::generate(&crate_dir)
.unwrap()
.write_to_file(format!("{}/my_header_file.h", out_dir));
} The file is written into the Also it shows that the |
Perhaps follow up with the cbindgen project? Unfortunately cargo won't automatically include a |
Problem
git ignored
Cargo.lock
preventscargo publish
Steps
Cargo.lock
into gitignore like*.lock
cargo publish
Possible Solution(s)
This is likely a regression, because it was ok before 1.39
Should be reverted back
Notes
Output of
cargo version
:cargo 1.39.0 (1c6ec66 2019-09-30)
The text was updated successfully, but these errors were encountered: