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

Add a configuration to Cargo.toml to specify which git submodules have to be fetched #11048

Closed
sdroege opened this issue Sep 3, 2022 · 4 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@sdroege
Copy link
Contributor

sdroege commented Sep 3, 2022

Problem

In gtk-rs we have various git submodules that are only necessary for running the code generator. That is, they're not necessary for compiling the crates inside the repository.

If a crate currently depends on a git version of gtk-rs then cargo will download all those (not very small) git submodules too, unnecessarily.

That it downloads all git submodules currently as a default seems like reasonable behaviour as they might be required for building the crates, but it's not optimal in all cases.

Proposed Solution

Something like the following in Cargo.toml for the repository example above

[package.metadata.git.submodules.gir]
fetch = false

[package.metadata.git.submodules.gir-files]
fetch = false

For backwards compatibility reasons this would obviously default to fetch = true.

Notes

No response

@sdroege sdroege added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Sep 3, 2022
@GuillaumeGomez
Copy link
Member

Nice idea1 👍

@ehuss
Copy link
Contributor

ehuss commented Sep 3, 2022

Thanks for the suggestion! I believe this is essentially a duplicate of #4247, so closing in favor of that. If possible, you can adjust the submodule update strategy in .gitmodules.

@ehuss ehuss closed this as not planned Won't fix, can't repro, duplicate, stale Sep 3, 2022
@sdroege
Copy link
Contributor Author

sdroege commented Sep 3, 2022

Thanks, I was not aware of the configuration in .gitmodules. I believe this would work but I'll have to try that. Apart from that, yes this is a duplicate of that other issue :)

@sdroege
Copy link
Contributor Author

sdroege commented Sep 6, 2022

Yes that solves it nicely for our use case, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

No branches or pull requests

3 participants