-
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
Cargo package says the repo is dirty, but the files are gitignored #12294
Comments
Thanks for filing this report, and sorry for the inconvenience. The function cargo/tests/testsuite/package.rs Lines 1080 to 1100 in 26b7725
I guess the intention was making files being packaged and file tracked by Git in sync. Despite that, this “smart” behaivor does break tools like @epage, @Byron, as you're the maintainers of those tools. Do you have any thought on this behavior? How to make cargo and releases tools inline with each others? |
The behaviour of Speaking only for |
I see!
I was under the impression (can't find the docs where I read this) that there was no guarantee that a cargo package matches a git repo 1-1. I feel that is also implied by the include/exclude? For reference I am including some build artifacts for a couple targets that speed up compilation (the crate implements cxx bindings to a c++ library). The crate is not usable otherwise (10sec vs 20min compilation).. This is in a private registry. I understand this is an edge case though. In case someone else runs into this: another workaround I am using now is when publishing in CI, I make a dummy commit that I don't push just before the publish. Anyways thanks for looking into this! |
Would you have a rustup-based cargo invocation handy that invokes a dry-run publish with gitoxide for file listing? I would have left it here myself, but seem to have lost my old invocations. Thanks in advance. |
I am experiencing this problem too, but the files are not in Cargo.toml's include. No matter what I do cargo thinks the files in .direnv are not commit despite that directory being ignored. |
My guess would be that the .direnv/ And it might work if it looks like this: .direnv/
.direnv Does that work for you? |
No, |
I've just run into the same issue: |
Would you be able to try a nightly cargo, for instance with |
One more aspect, which may relate to the problem: My project is using a slightly particular setup based on nix, so toolchains and other Rust artifacts are installed in a With that said, here is the output of listing files with nightly cargo and $ rustup run nightly -- cargo package -Z gitoxide --list
error: 12 files in the working directory contain changes that were not yet committed into git:
.data/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/share/doc/cargo/README.md
.data/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/share/doc/clippy/README.md
.data/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/share/doc/rust/README.md
.data/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/share/doc/rustfmt/README.md
.data/cargo/lib/rustlib/src/rust/library/stdarch/README.md
.data/cargo/share/doc/cargo/README.md
.data/cargo/share/doc/clippy/README.md
.data/cargo/share/doc/rls/README.md
.data/cargo/share/doc/rust/README.md
.data/cargo/share/doc/rust-analyzer/README.md
.data/cargo/share/doc/rust-demangler/README.md
.data/cargo/share/doc/rustfmt/README.md
to proceed despite this and include the uncommitted changes, pass the `--allow-dirty` flag The top 4 READMEs are new, after installing the nightly toolchain. |
Project link, if you want to check it out for yourself: https://gitlab.com/korrat/nullable-utils/ |
The link is broken btw |
Thanks for the heads-up, repo was still private. Should be fixed now. |
@korrat Can you show how the I suspect that the configuration or |
I figured out the issue. My Cargo.toml had the line |
That is interesting! I wasn't aware that writing (e.g.) |
|
I also got What would interest me is, without the |
I tried that out, but it didn't fix the problem. From reading the Cargo book, it seems that once |
Problem
I have a folder called "extra" that is in my
.gitignore
. git status confirms itCargo package says the repo is dirty, but those files are gitignored.
Note: In my Cargo.toml I am adding this extra folder to the
include
field, because i want this folder present in the package (but not in git).Steps
include
field in the Cargo.tomlPossible Solution(s)
No response
Notes
Normally I worked around the bug with "--allow-dirty", but now that i've switched to
cargo release
to publish my workspace, I cannot (it doesn't support that flag)Version
The text was updated successfully, but these errors were encountered: