Skip to content
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 vendor breaks crates such as rusty_v8, removes .gn file #9481

Closed
apaprocki opened this issue May 12, 2021 · 6 comments
Closed

cargo vendor breaks crates such as rusty_v8, removes .gn file #9481

apaprocki opened this issue May 12, 2021 · 6 comments

Comments

@apaprocki
Copy link

let no_include_option = pkg.manifest().include().is_empty();
let git_repo = if no_include_option {
self.discover_git_repo(root)?
} else {
None
};
let mut exclude_builder = GitignoreBuilder::new(root);
if no_include_option && git_repo.is_none() {
// no include option and not git repo discovered (see rust-lang/cargo#7183).
exclude_builder.add_line(None, ".*")?;
}

The denoland/rusty_v8 crate has a .gn file that is included by saying:

exclude = [
 ...
 ".*",
 ...
 "!.gn"
]

This excludes all dotfiles except .gn, but when this crate is vendored into a project, the .gn file is missing. Given that this is legal syntax, it seems the path.rs logic above needs to handle this situation?

@ehuss
Copy link
Contributor

ehuss commented May 12, 2021

This should be fixed via #9186. Can you try the latest nightly to see if it works? cargo +nightly package --list can be used to verify which files are included.

@weihanglo
Copy link
Member

This snippet can also verify the exclusion rule.

git clone https://github.com/denoland/deno.git
cd deno
cargo +nightly vendor
ls vendor/rusty_v8/.gn

In addition, these files cannot be re-included due to the limitation of gitignore rule.

It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined.

@samanpa
Copy link

samanpa commented May 13, 2021

Confirmed that it works on nightly.

@PaulDance
Copy link
Contributor

@apaprocki Does it work on nightly for you as well?

@apaprocki
Copy link
Author

@PaulDance yes, nightly worked

@ehuss
Copy link
Contributor

ehuss commented May 19, 2021

Thanks for the check, closing as fixed by #9186.

@ehuss ehuss closed this as completed May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants