-
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: list of dirty files contains ignored files #8407
Comments
What are your gitignore rules? |
Nothing special, just:
I originally had .*.swp in my |
Ah, I see what is happening. Git reports the entire directory as untracked if there is at least one non-ignored file. Cargo walks the entire directory without further consulting git. Git has an option to recurse into untracked dirs, but then Cargo would need to apply additional filtering, like skipping the |
As far as I'm concerned, I'd actually be fine with cargo just reporting the directory instead of the individual files. I do wonder whether you would really need additional filtering. I understand it that the option causes git to recurse into the directory and report the individual untracked files, but ignored files are still excluded, and there's no recursion into directories that are completely ignored anyway. Without really knowing if that's the right place, I made the following change, and it seems to do the right thing: diff --git src/cargo/sources/path.rs src/cargo/sources/path.rs
index cf406e8dd..eb5e26512 100644
--- src/cargo/sources/path.rs
+++ src/cargo/sources/path.rs
@@ -254,6 +254,7 @@ impl<'cfg> PathSource<'cfg> {
});
let mut opts = git2::StatusOptions::new();
opts.include_untracked(true);
+ opts.recurse_untracked_dirs(true);
if let Ok(suffix) = pkg_path.strip_prefix(root) {
opts.pathspec(suffix);
} |
To clarify: It does the right thing because the I suppose there's already a special case that handles not recursing into "target", which is actually not needed when that directory is already ignored via .gitignore. So this would be a breaking change for users that don't ignore the |
Heh, so I found the special case that ignores the target directory here and it's broken in that it doesn't just ignore the target directory, but anything called
So from my POV I think a viable approach would be to perform the change from above and remove the special case for |
I think it would probably be fine to make the above addition of |
I am experiencing a possible variant of this, but even if it's not it's probably worth piggybacking on this issue to keep it simple. First of all, I believe this will do my best to assure this gets fixed in the Now for the problem I am seeing:
We can validate this with
Even though it didn't reproduce this time, I also ran into problems with files that couldn't be packed into the CC @weihanglo |
Similar case here, I believe. On macOS, packaging fails for one of my packages because of verification error: failed to verify package tarball
Caused by:
Source directory was modified by build.rs during cargo publish. Build scripts should not modify anything outside of OUT_DIR.
Added: /Users/jost/Desktop/holochain/holochain-client-rust/target/package/holochain_client-0.4.5-rc.0/.DS_Store
To proceed despite this, pass the `--no-verify` flag. I have another package on my system which I could package and publish without such issues. Both contain a As an attempt I added This reproduces the issue on my system:
|
I also ran into this issue on mcaOS as soon as I converted one of my packages to a workspace: git clone https://github.com/cubing/cubing.rs && cd cubing.rs
git checkout 139fe2cca6985f1f6d980f46999df26fbfef87dc
cargo package --package cubing_core The output ends with:
I'm using the |
I was about to say that maybe it's related to the way the [core]
excludesFile = ~/.gitignore …but re-reading this means that it can't be the case. However, I believe that once the next stage of #11813 ( |
For what it's worth, my issue was with So my issues seems to be more a race condition with macOS creating |
It's interesting as the list of source files (for packaging) is curated using the This means both algorithms, run at different times, would have picked up that single From my experience, these errors also persist, so repeated |
I thought this issue might be gone, but alas. This is still causing me failures while publishing a workspace, at which point I have to dig in and:
This is awfully error-prone for out-of-the-box behaviour when publishing from a workspace on macOS. 😭 |
This is particularly undesirable, but I don't know of any other programmatic way to work around rust-lang/cargo#8407
I am really sorry to hear that and per my previous comment still puzzled how that happens. My hope would be that the |
Problem
When running "cargo package" it complains about some files containing uncommited change, even though they're ignored by my .gitignore rules.
This seems to only happen when the file is in a directory that contains a mix of ignored and non-ignored files, but no tracked files at all.
I expect to only see the entry for
new_dir/file
there, notnew_dir/.file.swp
.Notes
Output of
cargo version
:The text was updated successfully, but these errors were encountered: