-
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
use allow-dirty option in cargo package
to skip vcs checks
#6280
Conversation
r=me, but there are general concerns on introducing too many flags to cargo and also there's a soft feature freeze in effect, so I'm not sure if we should land this. But the change itself makes sense and looks reasonable! 🙂 |
This isn't so much adding a feature as it is removing a feature that was introduced in an August commit. The latest cargo introduced this vcs behavior in |
@zachreizner, Do you happen to know what PR caused the problem? (You say it is from August so I thought you may know.) Can you make a reproducible example, so that we can track it down? Do you have more information on what problems the current behavior is causing you? Can you add a test to this PR? |
The PR was #5886. I don't have a good example, but I will work on one if that helps. |
I think we should be able to fix this by pushing the |
Soft echo that accompanying this the change with a test would be 🔝. |
When you say under |
Want to try a local build with that change to confirm? |
Thanks for the PR @zachreizner! I think we're always up for taking PRs that fix bugs! I would personally be inclined, though, to fix this perhaps not with an option to For example I think we could improve our inference and say something like:
I think that would help prevent reaching too high in your case perhaps? (most crates are their own workspace so they wouldn't look much farther than that directory) |
I apologize, but my analysis of the problem our build system was facing is slightly incorrect. The issue is actually that the
All of those symlinks are outside the sandbox, which is what triggers our problem. Therefore anything that preempts searching inside of the For example, we have a package in |
If someone is publishing with |
Is there an error message available from cargo for the original issue, here? Is it just that the found parent repo is in fact dirty? I don't follow how #5886 (I authored) would have changed that behavior? @Eh2406: specifically, if |
Ok thanks for the explanation @zachreizner, makes sense that my previous suggestion wouldn't work. I think we can't say, though, that a git directory is only searched for in the At this point the best solution may be to update |
To summarize we have the following proposals, as I understand them:
I believe all of these will solve the issue I'm having, and so I've ordered them from easiest to hardest. Which of these solution would the |
Looking back I'm not sure my |
Sorry I should also elaborate more as well. I would personally prefer to not add a new feature (flag) for this since it seems like a pretty niche feature. I'm trying to brainstorm other ideas we can adapt existing concepts and/or existing ideas to avoid adding a new feature/flag. I'd personally be ok with the adaptation of |
Given |
After considering the options, I realized that Because of this realization, I decided to implement the |
If `cargo package` is run for a crate that is not version controlled in a way that cargo expects, git2 will overreach upwards and grab a irrelevant .git repo. This change adds `--no-vcs` as an option to `cargo package` to prevent this.
To avoid introducing another flag, this change uses the `--allow-dirty` flag to skip checking for vcs information. This is logical because a user that passes that flag is indicating to `cargo package` that they do not care about the state of vcs at that time.
LGTM. Invoking with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM too. Want to update the PR description, then we can merge this.
cargo package
cargo package
to skip vcs checks
Title has been updated. Do we want an update added to #6280 (comment) as well? |
Thanks @zachreizner! @bors: r+ |
📌 Commit fd5fb6e has been approved by |
use allow-dirty option in `cargo package` to skip vcs checks If `cargo package` is run for a crate that is not version controlled in a way that cargo expects, git2 will overreach upwards and grab a irrelevant .git repo. This change uses `--allow-dirty` to imply to `cargo package` that it should not be checking for version control information, fixing this issue.
☀️ Test successful - status-appveyor, status-travis |
Update cargo, rls 26 commits in b3d0b2e545b61d4cd08096911724b7d49d213f73..5e85ba14aaa20f8133863373404cb0af69eeef2c 2018-11-15 19:13:04 +0000 to 2018-12-02 14:37:25 +0000 - ConflictStoreTrie: Faster filtered search (rust-lang/cargo#6366) - Remove `cmake` as a requirement (rust-lang/cargo#6368) - progress: display "Downloading 1 crate" instead of "Downloading 1 crates" (rust-lang/cargo#6369) - Use expect over unwrap, for panic-in-panic aborts (rust-lang/cargo#6364) - Switch to pretty_env_logger, under --features pretty-env-logger (rust-lang/cargo#6362) - use allow-dirty option in `cargo package` to skip vcs checks (rust-lang/cargo#6280) - remove clones made redundant by Intern PackageId (rust-lang/cargo#6352) - docs: correct profile usage of `cargo test --release` (rust-lang/cargo#6345) - Improve doc for `cargo install` (rust-lang/cargo#6354) - Intern PackageId (rust-lang/cargo#6332) - Clean only release artifacts if --release option is set (rust-lang/cargo#6349) - remove clones made redundant by Intern SourceId (rust-lang/cargo#6347) - Intern SourceId (rust-lang/cargo#6342) - Tweak Layout to allow for non json file targets with internal "." (rust-lang/cargo#6255) - Correct Target Directory command-line option (rust-lang/cargo#6343) - Persistent data structures by im-rs (rust-lang/cargo#6336) - Move command prelude into main library (rust-lang/cargo#6335) - Distinguish custom build invocations (rust-lang/cargo#6331) - Allow crate_type=bin examples to run (rust-lang/cargo#6330) - Make verify-project honour unstable features (rust-lang/cargo#6326) - Make autodiscovery disable inferred targets (rust-lang/cargo#6329) - Add `c` alias for `check` (rust-lang/cargo#6218) - Allow user aliases to override built-in aliases (rust-lang/cargo#6259) - Fix renaming directory project using build scripts with cross-compiling. (rust-lang/cargo#6328) - Fix add_plugin_deps-related tests. (rust-lang/cargo#6327) - Add a glossary. (rust-lang/cargo#6321)
If
cargo package
is run for a crate that is not version controlled ina way that cargo expects, git2 will overreach upwards and grab a
irrelevant .git repo. This change uses
--allow-dirty
to imply tocargo package
that it should not be checking for version control information, fixing this issue.